Moved all interface headers into a 'wx' subdirectory for proper use of Doxygen path settings.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54385 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Bryan Petty
2008-06-27 16:22:58 +00:00
parent 92b6654b66
commit ae3c17b401
277 changed files with 0 additions and 0 deletions

224
interface/wx/aboutdlg.h Normal file
View File

@@ -0,0 +1,224 @@
/////////////////////////////////////////////////////////////////////////////
// Name: aboutdlg.h
// Purpose: interface of wxAboutDialogInfo
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxAboutDialogInfo
@wxheader{aboutdlg.h}
wxAboutDialogInfo contains information shown in the standard @e About
dialog displayed by the wxAboutBox() function.
This class contains the general information about the program, such as its
name, version, copyright and so on, as well as lists of the program developers,
documentation writers, artists and translators. The simple properties from the
former group are represented as a string with the exception of the program icon
and the program web site, while the lists from the latter group are stored as
wxArrayString and can be either set entirely at once using
wxAboutDialogInfo::SetDevelopers and similar functions or built one by one using
wxAboutDialogInfo::AddDeveloper etc.
Please also notice that while all the main platforms have the native
implementation of the about dialog, they are often more limited than the
generic version provided by wxWidgets and so the generic version is used if
wxAboutDialogInfo has any fields not supported by the native version. Currently
GTK+ version supports all the possible fields natively but MSW and Mac versions
don't support URLs, licence text nor custom icons in the about dialog and if
either of those is used, wxAboutBox() will automatically use the generic version
so you should avoid specifying these fields to achieve more native look and feel.
@library{wxadv}
@category{misc}
@see wxAboutDialogInfo::SetArtists
*/
class wxAboutDialogInfo
{
public:
/**
Default constructor leaves all fields are initially uninitialized, in general
you should call at least SetVersion(), SetCopyright() and SetDescription().
*/
wxAboutDialogInfo();
/**
Adds an artist name to be shown in the program credits.
@see SetArtists()
*/
void AddArtist(const wxString& artist);
/**
Adds a developer name to be shown in the program credits.
@see SetDevelopers()
*/
void AddDeveloper(const wxString& developer);
/**
Adds a documentation writer name to be shown in the program credits.
@see SetDocWriters()
*/
void AddDocWriter(const wxString& docwriter);
/**
Adds a translator name to be shown in the program credits. Notice that if no
translator names are specified explicitely, wxAboutBox() will try to use the
translation of the string @c translator-credits from the currently used message
catalog -- this can be used to show just the name of the translator of the
program in the current language.
@see SetTranslators()
*/
void AddTranslator(const wxString& translator);
/**
Sets the the list of artists to be shown in the program credits.
@see AddArtist()
*/
void SetArtists(const wxArrayString& artists);
/**
Set the short string containing the program copyright information. Notice that
any occurrences of @c "(C)" in @a copyright will be replaced by the
copyright symbol (circled C) automatically, which means that you can avoid
using this symbol in the program source code which can be problematic,
*/
void SetCopyright(const wxString& copyright);
/**
Set brief, but possibly multiline, description of the program.
*/
void SetDescription(const wxString& desc);
/**
Set the list of developers of the program.
@see AddDeveloper()
*/
void SetDevelopers(const wxArrayString& developers);
/**
Set the list of documentation writers.
@see AddDocWriter()
*/
void SetDocWriters(const wxArrayString& docwriters);
/**
Set the icon to be shown in the dialog. By default the icon of the main frame
will be shown if the native about dialog supports custom icons. If it doesn't
but a valid icon is specified using this method, the generic about dialog is
used instead so you should avoid calling this function for maximally native
look and feel.
*/
void SetIcon(const wxIcon& icon);
/**
Set the long, multiline string containing the text of the program licence.
Only GTK+ version supports showing the licence text in the native about dialog
currently so the generic version will be used under all the other platforms if
this method is called. To preserve the native look and feel it is advised that
you do not call this method but provide a separate menu item in the
@c "Help" menu for displaying the text of your program licence.
*/
void SetLicence(const wxString& licence);
/**
This is the same as SetLicence().
*/
void SetLicense(const wxString& licence);
/**
Set the name of the program. If this method is not called, the string returned
by wxApp::GetAppName will be shown in the dialog.
*/
void SetName(const wxString& name);
/**
Set the list of translators. Please see AddTranslator() for additional
discussion.
*/
void SetTranslators(const wxArrayString& translators);
/**
Set the version of the program. The version is in free format, i.e. not
necessarily in the @c x.y.z form but it shouldn't contain the "version" word.
*/
void SetVersion(const wxString& version);
/**
Set the web site for the program and its description (which defaults to @a url
itself if empty).
Please notice that only GTK+ version currently supports showing the link in the
native about dialog so if this method is called, the generic version will be
used under all the other platforms.
*/
void SetWebSite(const wxString& url,
const wxString& desc = wxEmptyString);
};
// ============================================================================
// Global functions/macros
// ============================================================================
/** @ingroup group_funcmacro_dialog */
//@{
/**
This function shows the standard about dialog containing the information
specified in @a info. If the current platform has a native about dialog
which is capable of showing all the fields in @a info, the native dialog is
used, otherwise the function falls back to the generic wxWidgets version of
the dialog, i.e. does the same thing as wxGenericAboutBox.
Here is an example of how this function may be used:
@code
void MyFrame::ShowSimpleAboutDialog(wxCommandEvent& WXUNUSED(event))
{
wxAboutDialogInfo info;
info.SetName(_("My Program"));
info.SetVersion(_("1.2.3 Beta"));
info.SetDescription(_("This program does something great."));
info.SetCopyright(_T("(C) 2007 Me <my@email.addre.ss>"));
wxAboutBox(info);
}
@endcode
Please see the @ref page_samples_dialogs for more examples of using this
function and wxAboutDialogInfo for the description of the information which
can be shown in the about dialog.
@header{wx/aboutdlg.h}
*/
void wxAboutBox(const wxAboutDialogInfo& info);
/**
This function does the same thing as wxAboutBox() except that it always uses
the generic wxWidgets version of the dialog instead of the native one.
This is mainly useful if you need to customize the dialog by e.g. adding
custom controls to it (customizing the native dialog is not currently
supported).
See the @ref page_samples_dialogs for an example of about dialog
customization.
@see wxAboutDialogInfo
@header{wx/aboutdlg.h}
*/
void wxGenericAboutBox(const wxAboutDialogInfo& info);
//@}

216
interface/wx/accel.h Normal file
View File

@@ -0,0 +1,216 @@
/////////////////////////////////////////////////////////////////////////////
// Name: accel.h
// Purpose: interface of wxAccelerator* classes
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/** wxAcceleratorEntry flags */
enum wxAcceleratorEntryFlags
{
/** no modifiers */
wxACCEL_NORMAL,
/** hold Alt key down */
wxACCEL_ALT,
/** hold Ctrl key down */
wxACCEL_CTRL,
/** hold Shift key down */
wxACCEL_SHIFT,
/** Command key on OS X; identic to wxACCEL_CTRL on other platforms. */
wxACCEL_CMD
};
/**
@class wxAcceleratorEntry
@wxheader{accel.h}
An object used by an application wishing to create an accelerator table
(see wxAcceleratorTable).
@library{wxcore}
@category{misc}
@see wxAcceleratorTable, wxWindow::SetAcceleratorTable
*/
class wxAcceleratorEntry
{
public:
/**
Constructor.
@param flags
A combination of the wxAcceleratorEntryFlags values, which
indicates which modifier keys are held down.
@param keyCode
The keycode to be detected. See @ref page_keycodes for a full list of keycodes.
@param cmd
The menu or control command identifier (ID).
@param item
The menu item associated with this accelerator.
*/
wxAcceleratorEntry(int flags = 0, int keyCode = 0, int cmd = 0,
wxMenuItem *item = NULL);
/**
Copy ctor.
*/
wxAcceleratorEntry(const wxAcceleratorEntry& entry);
/**
Returns the command identifier for the accelerator table entry.
*/
int GetCommand() const;
/**
Returns the flags for the accelerator table entry.
*/
int GetFlags() const;
/**
Returns the keycode for the accelerator table entry.
*/
int GetKeyCode() const;
/**
Returns the menu item associated with this accelerator entry.
*/
wxMenuItem *GetMenuItem() const;
/**
Sets the accelerator entry parameters.
@param flags
A combination of the wxAcceleratorEntryFlags values, which
indicates which modifier keys are held down.
@param keyCode
The keycode to be detected. See @ref page_keycodes for a full list of keycodes.
@param cmd
The menu or control command identifier (ID).
@param item
The menu item associated with this accelerator.
*/
void Set(int flags, int keyCode, int cmd, wxMenuItem *item = NULL);
/**
Returns @true if this object is correctly initialized.
*/
bool IsOk() const;
/**
Returns a wxString for this accelerator.
This function formats it using the @c "flags-keycode" format
where @c flags maybe a hyphen-separed list of @c "shift|alt|ctrl".
*/
wxString ToString() const;
/**
Parses the given string and sets the accelerator accordingly.
@param str
Should be a string in the form "flags-keycode"
@return @true if the given string correctly initialized this object
(i.e. if IsOk() returns true after this call)
*/
bool FromString(const wxString& str);
wxAcceleratorEntry& operator=(const wxAcceleratorEntry& entry);
bool operator==(const wxAcceleratorEntry& entry) const;
bool operator!=(const wxAcceleratorEntry& entry) const;
};
/**
@class wxAcceleratorTable
@wxheader{accel.h}
An accelerator table allows the application to specify a table of keyboard
shortcuts for menu or button commands.
The object ::wxNullAcceleratorTable is defined to be a table with no data, and
is the initial accelerator table for a window.
Example:
@code
wxAcceleratorEntry entries[4];
entries[0].Set(wxACCEL_CTRL, (int) 'N', ID_NEW_WINDOW);
entries[1].Set(wxACCEL_CTRL, (int) 'X', wxID_EXIT);
entries[2].Set(wxACCEL_SHIFT, (int) 'A', ID_ABOUT);
entries[3].Set(wxACCEL_NORMAL, WXK_DELETE, wxID_CUT);
wxAcceleratorTable accel(4, entries);
frame->SetAcceleratorTable(accel);
@endcode
@remarks
An accelerator takes precedence over normal processing and can be a convenient
way to program some event handling. For example, you can use an accelerator table
to enable a dialog with a multi-line text control to accept CTRL-Enter as meaning
'OK'.
@library{wxcore}
@category{misc}
@stdobjects
::wxNullAcceleratorTable
@see wxAcceleratorEntry, wxWindow::SetAcceleratorTable
*/
class wxAcceleratorTable : public wxObject
{
public:
/**
Default ctor.
*/
wxAcceleratorTable();
/**
Initializes the accelerator table from an array of wxAcceleratorEntry.
@param n
Number of accelerator entries.
@param entries
The array of entries.
*/
wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]);
/**
Loads the accelerator table from a Windows resource (Windows only).
@onlyfor{wxmsw}
@param resource
Name of a Windows accelerator.
*/
wxAcceleratorTable(const wxString& resource);
/**
Destroys the wxAcceleratorTable object.
See @ref overview_refcount_destruct for more info.
*/
virtual ~wxAcceleratorTable();
/**
Returns @true if the accelerator table is valid.
*/
bool IsOk() const;
};
// ============================================================================
// Global functions/macros
// ============================================================================
/**
An empty accelerator table.
*/
wxAcceleratorTable wxNullAcceleratorTable;

421
interface/wx/access.h Normal file
View File

@@ -0,0 +1,421 @@
/////////////////////////////////////////////////////////////////////////////
// Name: access.h
// Purpose: interface of wxAccessible
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
wxAccessible functions return a wxAccStatus error code,
which may be one of this enum's values.
*/
typedef enum
{
wxACC_FAIL, //!< The function failed.
wxACC_FALSE, //!< The function returned false.
wxACC_OK, //!< The function completed successfully.
wxACC_NOT_IMPLEMENTED, //!< The function is not implemented.
wxACC_NOT_SUPPORTED //!< The function is not supported.
} wxAccStatus;
/**
Directions of navigation are represented by this enum.
*/
typedef enum
{
wxNAVDIR_DOWN,
wxNAVDIR_FIRSTCHILD,
wxNAVDIR_LASTCHILD,
wxNAVDIR_LEFT,
wxNAVDIR_NEXT,
wxNAVDIR_PREVIOUS,
wxNAVDIR_RIGHT,
wxNAVDIR_UP
} wxNavDir;
/**
The role of a user interface element is represented by the values of this enum.
*/
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;
/**
Objects are represented by a wxAccObject enum value.
*/
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;
/**
Selection actions are identified by the wxAccSelectionFlags values.
*/
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;
//@{
/**
Represents a status of the system.
*/
#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
//@}
//@{
/**
An event identifier that can be sent via wxAccessible::NotifyEvent.
*/
#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
//@}
/**
@class wxAccessible
@wxheader{access.h}
The wxAccessible class allows wxWidgets applications, and wxWidgets itself,
to return extended information about user interface elements to client
applications such as screen readers. This is the main way in which wxWidgets
implements accessibility features.
At present, only Microsoft Active Accessibility is supported by this class.
To use this class, derive from wxAccessible, implement appropriate
functions, and associate an object of the class with a window using
wxWindow::SetAccessible.
All functions return an indication of success, failure, or not implemented
using values of the wxAccStatus enum type.
If you return @c wxACC_NOT_IMPLEMENTED from any function, the system will try
to implement the appropriate functionality. However this will not work with
all functions.
Most functions work with an object @e id, which can be zero to refer to
'this' UI element, or greater than zero to refer to the nth child element.
This allows you to specify elements that don't have a corresponding wxWindow or
wxAccessible; for example, the sash of a splitter window.
For details on the semantics of functions and types, please refer to the
Microsoft Active Accessibility 1.2 documentation.
This class is compiled into wxWidgets only if the wxUSE_ACCESSIBILITY setup
symbol is set to 1.
@onlyfor{wxmsw}
@library{wxcore}
@category{misc}
@see @sample{access}
*/
class wxAccessible : public wxObject
{
public:
/**
Constructor, taking an optional window. The object can be associated with
a window later.
*/
wxAccessible(wxWindow* win = NULL);
/**
Destructor.
*/
~wxAccessible();
/**
Performs the default action for the object.
@a childId is 0 (the action for this object) or greater than 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 specified child (starting from 1). If @a child is @NULL and the 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);
/**
Returns the number of children in @a childCount.
*/
virtual wxAccStatus GetChildCount(int* childCount);
/**
Gets the default action for this object (0) or a child (greater than 0).
Return wxACC_OK even if there is no action. @a 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);
/**
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);
/**
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.
Returns e.g. ALT+K.
*/
virtual wxAccStatus GetKeyboardShortcut(int childId,
wxString* shortcut);
/**
Returns the rectangle for this object (id is 0) or a child element (id is
greater than 0).
@a rect is in screen coordinates.
*/
virtual wxAccStatus GetLocation(wxRect& rect, int elementId);
/**
Gets the name of the specified object.
*/
virtual wxAccStatus GetName(int childId, wxString* name);
/**
Returns the parent of this object, or @NULL.
*/
virtual wxAccStatus GetParent(wxAccessible** parent);
/**
Returns a role constant describing this object. See wxAccRole for a list
of these roles.
*/
virtual wxAccStatus GetRole(int childId, wxAccRole* role);
/**
Gets a variant representing the selected children of this object.
Acceptable values are:
@li a null variant (IsNull() returns @true)
@li a list variant (GetType() == wxT("list"))
@li an integer representing the selected child element,
or 0 if this object is selected (GetType() == wxT("long"))
@li a "void*" pointer to a wxAccessible child object
*/
virtual wxAccStatus GetSelections(wxVariant* selections);
/**
Returns a state constant. See wxAccStatus for a list of these states.
*/
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);
/**
Returns the window associated with this object.
*/
wxWindow* GetWindow();
/**
Returns a status value and object id to indicate whether the given point
was on this or a child object. Can return either a child object, or an
integer representing the child element, starting from 1.
@a pt is in screen coordinates.
*/
virtual wxAccStatus HitTest(const wxPoint& pt, int* childId,
wxAccessible** childObject);
/**
Navigates from @a fromId to @a toId or to @a toObject.
*/
virtual wxAccStatus Navigate(wxNavDir navDir, int fromId,
int* toId,
wxAccessible** toObject);
/**
Allows the application to send an event when something changes in
an accessible object.
*/
virtual static void NotifyEvent(int eventType, wxWindow* window,
wxAccObject objectType,
int objectType);
/**
Selects the object or child. See wxAccSelectionFlags for a list
of the selection actions.
*/
virtual wxAccStatus Select(int childId,
wxAccSelectionFlags selectFlags);
/**
Sets the window associated with this object.
*/
void SetWindow(wxWindow* window);
};

290
interface/wx/animate.h Normal file
View File

@@ -0,0 +1,290 @@
/////////////////////////////////////////////////////////////////////////////
// Name: animate.h
// Purpose: interface of wxAnimation* classes
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
Supported animation types.
*/
enum wxAnimationType
{
wxANIMATION_TYPE_INVALID,
/** represents an animated GIF file. */
wxANIMATION_TYPE_GIF,
/** represents an ANI file. */
wxANIMATION_TYPE_ANI,
/** autodetect the filetype. */
wxANIMATION_TYPE_ANY
};
/**
@class wxAnimationCtrl
@wxheader{animate.h}
This is a static control which displays an animation.
wxAnimationCtrl API is as simple as possible and won't give you full control
on the animation; if you need it then use wxMediaCtrl.
This control is useful to display a (small) animation while doing a long task
(e.g. a "throbber").
It is only available if @c wxUSE_ANIMATIONCTRL is set to 1 (the default).
@beginStyleTable
@style{wxAC_DEFAULT_STYLE}
The default style: wxBORDER_NONE.
@style{wxAC_NO_AUTORESIZE}
By default, the control will adjust its size to exactly fit to the
size of the animation when SetAnimation is called. If this style
flag is given, the control will not change its size
@endStyleTable
@library{wxadv}
@category{ctrl}
@nativeimpl{wxgtk,wxmsw}
<!-- @appearance{animationctrl.png} -->
@see wxAnimation, @sample{animate}
*/
class wxAnimationCtrl : public wxControl
{
public:
/**
Initializes the object and calls Create() with
all the parameters.
*/
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);
/**
Creates the control with the given @a anim animation.
After control creation you must explicitely call Play() to start to play
the animation. Until that function won't be called, the first frame
of the animation is displayed.
@param parent
Parent window, must be non-@NULL.
@param id
The identifier for the control.
@param anim
The initial animation shown in the control.
@param pos
Initial position.
@param size
Initial size.
@param style
The window style, see wxAC_* flags.
@param name
Control name.
@return @true if the control was successfully created or @false if
creation failed.
*/
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);
/**
Returns the animation associated with this control.
*/
virtual wxAnimation GetAnimation() const;
/**
Returns the inactive bitmap shown in this control when the;
see SetInactiveBitmap() for more info.
*/
wxBitmap GetInactiveBitmap() const;
/**
Returns @true if the animation is being played.
*/
virtual bool IsPlaying() const;
/**
Loads the animation from the given file and calls SetAnimation().
See wxAnimation::LoadFile for more info.
*/
virtual bool LoadFile(const wxString& file,
wxAnimationType animType = wxANIMATION_TYPE_ANY);
/**
Loads the animation from the given stream and calls SetAnimation().
See wxAnimation::Load() for more info.
*/
virtual bool Load(wxInputStream& file,
wxAnimationType animType = wxANIMATION_TYPE_ANY);
/**
Starts playing the animation.
The animation is always played in loop mode (unless the last frame of the
animation has an infinite delay time) and always start from the first frame
even if you @ref Stop "stopped" it while some other frame was displayed.
*/
virtual bool Play();
/**
Sets the animation to play in this control.
If the previous animation is being played, it's @ref Stop() stopped.
Until Play() isn't called, a static image, the first frame of the given
animation or the background colour will be shown
(see SetInactiveBitmap() for more info).
*/
virtual void SetAnimation(const wxAnimation& anim);
/**
Sets the bitmap to show on the control when it's not playing an animation.
If you set as inactive bitmap ::wxNullBitmap (which is the default), then the
first frame of the animation is instead shown when the control is inactive;
in this case, if there's no valid animation associated with the control
(see SetAnimation()), then the background colour of the window is shown.
If the control is not playing the animation, the given bitmap will be
immediately shown, otherwise it will be shown as soon as Stop() is called.
Note that the inactive bitmap, if smaller than the control's size, will be
centered in the control; if bigger, it will be stretched to fit it.
*/
virtual void SetInactiveBitmap(const wxBitmap& bmp);
/**
Stops playing the animation.
The control will show the first frame of the animation, a custom static image or
the window's background colour as specified by the last SetInactiveBitmap() call.
*/
virtual void Stop();
};
/**
@class wxAnimation
@wxheader{animate.h}
This class encapsulates the concept of a platform-dependent animation.
An animation is a sequence of frames of the same size.
Sound is not supported by wxAnimation.
@library{wxadv}
@category{gdi}
@stdobjects
::wxNullAnimation
@see wxAnimationCtrl, @sample{animate}
*/
class wxAnimation : public wxGDIObject
{
public:
/**
Copy ctor.
*/
wxAnimation(const wxAnimation& anim);
/**
Loads an animation from a file.
@param name
The name of the file to load.
@param type
See LoadFile for more info.
*/
wxAnimation(const wxString& name,
wxAnimationType type = wxANIMATION_TYPE_ANY);
/**
Destructor.
See @ref overview_refcount_destruct for more info.
*/
virtual ~wxAnimation();
/**
Returns the delay for the i-th frame in milliseconds.
If @c -1 is returned the frame is to be displayed forever.
*/
virtual int GetDelay(unsigned int i) const;
/**
Returns the i-th frame as a wxImage.
*/
virtual wxImage GetFrame(unsigned int i) const;
/**
Returns the number of frames for this animation.
*/
virtual unsigned int GetFrameCount() const;
/**
Returns the size of the animation.
*/
virtual wxSize GetSize() const;
/**
Returns @true if animation data is present.
*/
virtual bool IsOk() const;
/**
Loads an animation from the given stream.
@param stream
The stream to use to load the animation.
@param type
One of the following values:
@li wxANIMATION_TYPE_GIF: loads an animated GIF file;
@li wxANIMATION_TYPE_ANI: load an ANI file;
@li wxANIMATION_TYPE_ANY: tries to autodetect the filetype.
@return @true if the operation succeeded, @false otherwise.
*/
virtual bool Load(wxInputStream& stream,
wxAnimationType type = wxANIMATION_TYPE_ANY);
/**
Loads an animation from a file.
@param name
A filename.
@param type
One of the wxAnimationType values; wxANIMATION_TYPE_ANY
means that the function should try to autodetect the filetype.
@return @true if the operation succeeded, @false otherwise.
*/
virtual bool LoadFile(const wxString& name,
wxAnimationType type = wxANIMATION_TYPE_ANY);
/**
Assignment operator, using @ref overview_refcount "reference counting".
*/
wxAnimation& operator =(const wxAnimation& brush);
};
// ============================================================================
// Global functions/macros
// ============================================================================
/**
An empty animation object.
*/
wxAnimation wxNullAnimation;

865
interface/wx/app.h Normal file
View File

@@ -0,0 +1,865 @@
/////////////////////////////////////////////////////////////////////////////
// Name: app.h
// Purpose: interface of wxApp
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxAppConsole
@wxheader{app.h}
This class is essential for writing console-only or hybrid apps without
having to define wxUSE_GUI=0.
@todo MORE INFO
@library{wxbase}
@category{appmanagement}
@see @ref overview_app
*/
class wxAppConsole : public wxEvtHandler
{
protected:
/**
Creates the wxAppTraits object when GetTraits() needs it for the first time.
@see wxAppTraits
*/
virtual wxAppTraits* CreateTraits();
public:
/**
Destructor.
*/
virtual ~wxAppConsole();
/**
Dispatches the next event in the windowing system event queue.
Blocks until an event appears if there are none currently
(use Pending() if this is not wanted).
This can be used for programming event loops, e.g.
@code
while (app.Pending())
Dispatch();
@endcode
@return @false if the event loop should stop and @true otherwise.
@see Pending()
*/
virtual bool Dispatch();
/**
Call this to explicitly exit the main message (event) loop.
You should normally exit the main loop (and the application) by deleting
the top window.
*/
virtual void ExitMainLoop();
/**
This function is called before processing any event and allows the application
to preempt the processing of some events.
If this method returns -1 the event is processed normally, otherwise either
@true or @false should be returned and the event processing stops immediately
considering that the event had been already processed (for the former return
value) or that it is not going to be processed at all (for the latter one).
*/
virtual int FilterEvent(wxEvent& event);
/**
Returns the user-readable application name.
The difference between this string and the one returned by GetAppName() is that
this one is meant to be shown to the user and so should be used for the window
titles, page headers and so on while the other one should be only used internally,
e.g. for the file names or configuration file keys.
By default, returns the same string as GetAppName().
@since 2.9.0
*/
wxString GetAppDisplayName() const;
/**
Returns the application name.
@remarks wxWidgets sets this to a reasonable default before calling
OnInit(), but the application can reset it at will.
@see GetAppDisplayName()
*/
wxString GetAppName() const;
/**
Gets the class name of the application. The class name may be used in a
platform specific manner to refer to the application.
@see SetClassName()
*/
wxString GetClassName() const;
/**
Returns the one and only global application object.
Usually ::wxTheApp is usead instead.
@see SetInstance()
*/
static wxAppConsole* GetInstance();
/**
Returns a pointer to the wxAppTraits object for the application.
If you want to customize the wxAppTraits object, you must override the
CreateTraits() function.
*/
wxAppTraits* GetTraits();
/**
Returns the user-readable vendor name. The difference between this string
and the one returned by GetVendorName() is that this one is meant to be shown
to the user and so should be used for the window titles, page headers and so on
while the other one should be only used internally, e.g. for the file names or
configuration file keys.
By default, returns the same string as GetVendorName().
@since 2.9.0
*/
const wxString& GetVendorDisplayName() const;
/**
Returns the application's vendor name.
*/
const wxString& GetVendorName() const;
/**
This function simply invokes the given method @a func of the specified
event handler @a handler with the @a event as parameter. It exists solely
to allow to catch the C++ exceptions which could be thrown by all event
handlers in the application in one place: if you want to do this, override
this function in your wxApp-derived class and add try/catch clause(s) to it.
*/
virtual void HandleEvent(wxEvtHandler* handler,
wxEventFunction func,
wxEvent& event) const;
/**
Returns @true if the main event loop is currently running, i.e. if the
application is inside OnRun().
This can be useful to test whether events can be dispatched. For example,
if this function returns @false, non-blocking sockets cannot be used because
the events from them would never be processed.
*/
static bool IsMainLoopRunning();
/**
Called in response of an "open-application" Apple event.
Override this to create a new document in your app.
@onlyfor{wxmac}
*/
virtual void MacNewFile();
/**
Called in response of an "open-document" Apple event.
You need to override this method in order to open a document file after the
user double clicked on it or if the document file was dropped on either the
running application or the application icon in Finder.
@onlyfor{wxmac}
*/
virtual void MacOpenFile(const wxString& fileName);
/**
Called in response of a "get-url" Apple event.
@onlyfor{wxmac}
*/
virtual void MacOpenURL(const wxString& url);
/**
Called in response of a "print-document" Apple event.
@onlyfor{wxmac}
*/
virtual void MacPrintFile(const wxString& fileName);
/**
Called in response of a "reopen-application" Apple event.
@onlyfor{wxmac}
*/
virtual void MacReopenApp();
/**
Called by wxWidgets on creation of the application. Override this if you wish
to provide your own (environment-dependent) main loop.
@return 0 under X, and the wParam of the WM_QUIT message under Windows.
*/
virtual int MainLoop();
/**
This function is called when an assert failure occurs, i.e. the condition
specified in wxASSERT() macro evaluated to @false.
It is only called in debug mode (when @c __WXDEBUG__ is defined) as
asserts are not left in the release code at all.
The base class version shows the default assert failure dialog box proposing to
the user to stop the program, continue or ignore all subsequent asserts.
@param file
the name of the source file where the assert occurred
@param line
the line number in this file where the assert occurred
@param func
the name of the function where the assert occurred, may be
empty if the compiler doesn't support C99 __FUNCTION__
@param cond
the condition of the failed assert in text form
@param msg
the message specified as argument to wxASSERT_MSG or wxFAIL_MSG, will
be @NULL if just wxASSERT or wxFAIL was used
*/
virtual void OnAssertFailure(const wxChar *file,
int line,
const wxChar *func,
const wxChar *cond,
const wxChar *msg);
/**
Called when command line parsing fails (i.e. an incorrect command line option
was specified by the user). The default behaviour is to show the program usage
text and abort the program.
Return @true to continue normal execution or @false to return
@false from OnInit() thus terminating the program.
@see OnInitCmdLine()
*/
virtual bool OnCmdLineError(wxCmdLineParser& parser);
/**
Called when the help option (@c --help) was specified on the command line.
The default behaviour is to show the program usage text and abort the program.
Return @true to continue normal execution or @false to return
@false from OnInit() thus terminating the program.
@see OnInitCmdLine()
*/
virtual bool OnCmdLineHelp(wxCmdLineParser& parser);
/**
Called after the command line had been successfully parsed. You may override
this method to test for the values of the various parameters which could be
set from the command line.
Don't forget to call the base class version unless you want to suppress
processing of the standard command line options.
Return @true to continue normal execution or @false to return @false from
OnInit() thus terminating the program.
@see OnInitCmdLine()
*/
virtual bool OnCmdLineParsed(wxCmdLineParser& parser);
/**
This function is called if an unhandled exception occurs inside the main
application event loop. It can return @true to ignore the exception and to
continue running the loop or @false to exit the loop and terminate the
program. In the latter case it can also use C++ @c throw keyword to
rethrow the current exception.
The default behaviour of this function is the latter in all ports except under
Windows where a dialog is shown to the user which allows him to choose between
the different options. You may override this function in your class to do
something more appropriate.
Finally note that if the exception is rethrown from here, it can be caught in
OnUnhandledException().
*/
virtual bool OnExceptionInMainLoop();
/**
Override this member function for any processing which needs to be
done as the application is about to exit. OnExit is called after
destroying all application windows and controls, but before
wxWidgets cleanup. Note that it is not called at all if
OnInit() failed.
The return value of this function is currently ignored, return the same
value as returned by the base class method if you override it.
*/
virtual int OnExit();
/**
This function may be called if something fatal happens: an unhandled
exception under Win32 or a a fatal signal under Unix, for example. However,
this will not happen by default: you have to explicitly call
wxHandleFatalExceptions() to enable this.
Generally speaking, this function should only show a message to the user and
return. You may attempt to save unsaved data but this is not guaranteed to
work and, in fact, probably won't.
@see wxHandleFatalExceptions()
*/
virtual void OnFatalException();
/**
This must be provided by the application, and will usually create the
application's main window, optionally calling SetTopWindow().
You may use OnExit() to clean up anything initialized here, provided
that the function returns @true.
Notice that if you want to to use the command line processing provided by
wxWidgets you have to call the base class version in the derived class
OnInit().
Return @true to continue processing, @false to exit the application
immediately.
*/
virtual bool OnInit();
/**
Called from OnInit() and may be used to initialize the parser with the
command line options for this application. The base class versions adds
support for a few standard options only.
*/
virtual void OnInitCmdLine(wxCmdLineParser& parser);
/**
This virtual function is where the execution of a program written in wxWidgets
starts. The default implementation just enters the main loop and starts
handling the events until it terminates, either because ExitMainLoop() has
been explicitly called or because the last frame has been deleted and
GetExitOnFrameDelete() flag is @true (this is the default).
The return value of this function becomes the exit code of the program, so it
should return 0 in case of successful termination.
*/
virtual int OnRun();
/**
This function is called when an unhandled C++ exception occurs inside
OnRun() (the exceptions which occur during the program startup and shutdown
might not be caught at all). Notice that by now the main event loop has been
terminated and the program will exit, if you want to prevent this from happening
(i.e. continue running after catching an exception) you need to override
OnExceptionInMainLoop().
The default implementation shows information about the exception in debug build
but does nothing in the release build.
*/
virtual void OnUnhandledException();
/**
Returns @true if unprocessed events are in the window system event queue.
@see Dispatch()
*/
virtual bool Pending();
/**
Set the application name to be used in the user-visible places such as window
titles. See GetAppDisplayName() for more about the differences between the
display name and name.
*/
void SetAppDisplayName(const wxString& name);
/**
Sets the name of the application. This name should be used for file names,
configuration file entries and other internal strings. For the user-visible
strings, such as the window titles, the application display name set by
SetAppDisplayName() is used instead.
By default the application name is set to the name of its executable file.
@see GetAppName()
*/
void SetAppName(const wxString& name);
/**
Sets the class name of the application. This may be used in a platform specific
manner to refer to the application.
@see GetClassName()
*/
void SetClassName(const wxString& name);
/**
Allows external code to modify global ::wxTheApp, but you should really
know what you're doing if you call it.
@param app
Replacement for the global application object.
@see GetInstance()
*/
static void SetInstance(wxAppConsole* app);
/**
Set the vendor name to be used in the user-visible places.
See GetVendorDisplayName() for more about the differences between the
display name and name.
*/
void SetVendorDisplayName(const wxString& name);
/**
Sets the name of application's vendor. The name will be used
in registry access. A default name is set by wxWidgets.
@see GetVendorName()
*/
void SetVendorName(const wxString& name);
/**
Yields control to pending messages in the windowing system.
This can be useful, for example, when a time-consuming process writes to a
text window. Without an occasional yield, the text window will not be updated
properly, and on systems with cooperative multitasking, such as Windows 3.1
other processes will not respond.
Caution should be exercised, however, since yielding may allow the
user to perform actions which are not compatible with the current task.
Disabling menu items or whole menus during processing can avoid unwanted
reentrance of code: see ::wxSafeYield for a better function.
Note that Yield() will not flush the message logs. This is intentional as
calling Yield() is usually done to quickly update the screen and popping up
a message box dialog may be undesirable. If you do wish to flush the log
messages immediately (otherwise it will be done during the next idle loop
iteration), call wxLog::FlushActive.
Calling Yield() recursively is normally an error and an assert failure is
raised in debug build if such situation is detected. However if the
@a onlyIfNeeded parameter is @true, the method will just silently
return @false instead.
*/
virtual bool Yield(bool onlyIfNeeded = false);
/**
Number of command line arguments (after environment-specific processing).
*/
int argc;
/**
Command line arguments (after environment-specific processing).
Under Windows and Linux/Unix, you should parse the command line
arguments and check for files to be opened when starting your
application. Under OS X, you need to override MacOpenFile()
since command line arguments are used differently there.
You may use the wxCmdLineParser to parse command line arguments.
*/
wxChar** argv;
};
/**
@class wxApp
@wxheader{app.h}
The wxApp class represents the application itself. It is used to:
@li set and get application-wide properties;
@li implement the windowing system message or event loop;
@li initiate application processing via wxApp::OnInit;
@li allow default processing of events not handled by other
objects in the application.
You should use the macro IMPLEMENT_APP(appClass) in your application
implementation file to tell wxWidgets how to create an instance of your
application class.
Use DECLARE_APP(appClass) in a header file if you want the wxGetApp function
(which returns a reference to your application object) to be visible to other
files.
@library{wxbase}
@category{appmanagement}
@see @ref overview_app
*/
class wxApp : public wxAppConsole
{
public:
/**
Constructor. Called implicitly with a definition of a wxApp object.
*/
wxApp();
/**
Destructor. Will be called implicitly on program exit if the wxApp
object is created on the stack.
*/
virtual ~wxApp();
/**
Returns @true if the application will exit when the top-level frame is deleted.
@see SetExitOnFrameDelete()
*/
bool GetExitOnFrameDelete() const;
/**
Returns @true if the application will use the best visual on systems that support
different visuals, @false otherwise.
@see SetUseBestVisual()
*/
bool GetUseBestVisual() const;
/**
Returns a pointer to the top window.
@remarks If the top window hasn't been set using SetTopWindow(),
this function will find the first top-level window
(frame or dialog) and return that.
@see SetTopWindow()
*/
virtual wxWindow* GetTopWindow() const;
/**
Returns @true if the application is active, i.e. if one of its windows is
currently in the foreground.
If this function returns @false and you need to attract users attention to
the application, you may use wxTopLevelWindow::RequestUserAttention to do it.
*/
virtual bool IsActive() const;
/**
Windows-only function for processing a message. This function is called
from the main message loop, checking for windows that may wish to process it.
The function returns @true if the message was processed, @false otherwise.
If you use wxWidgets with another class library with its own message loop,
you should make sure that this function is called to allow wxWidgets to
receive messages. For example, to allow co-existence with the Microsoft
Foundation Classes, override the PreTranslateMessage function:
@code
// Provide wxWidgets message loop compatibility
BOOL CTheApp::PreTranslateMessage(MSG *msg)
{
if (wxTheApp && wxTheApp->ProcessMessage((WXMSW *)msg))
return true;
else
return CWinApp::PreTranslateMessage(msg);
}
@endcode
@onlyfor{wxmsw}
*/
bool ProcessMessage(WXMSG* msg);
/**
Sends idle events to a window and its children.
Please note that this function is internal to wxWidgets and shouldn't be used
by user code.
@remarks These functions poll the top-level windows, and their children,
for idle event processing. If @true is returned, more OnIdle
processing is requested by one or more window.
@see wxIdleEvent
*/
virtual bool SendIdleEvents(wxWindow* win, wxIdleEvent& event);
/**
Allows the programmer to specify whether the application will exit when the
top-level frame is deleted.
@param flag
If @true (the default), the application will exit when the top-level frame
is deleted. If @false, the application will continue to run.
@see GetExitOnFrameDelete(), @ref overview_app_shutdown
*/
void SetExitOnFrameDelete(bool flag);
/**
Allows external code to modify global ::wxTheApp, but you should really
know what you're doing if you call it.
@param app
Replacement for the global application object.
@see GetInstance()
*/
static void SetInstance(wxAppConsole* app);
/**
Allows runtime switching of the UI environment theme.
Currently implemented for wxGTK2-only.
Return @true if theme was successfully changed.
@param theme
The name of the new theme or an absolute path to a gtkrc-theme-file
*/
virtual bool SetNativeTheme(const wxString& theme);
/**
Sets the 'top' window. You can call this from within OnInit() to let wxWidgets
know which is the main window. You don't have to set the top window;
it is only a convenience so that (for example) certain dialogs without parents
can use a specific window as the top window. If no top window is specified by the
application, wxWidgets just uses the first frame or dialog in its top-level window
list, when it needs to use the top window.
@param window
The new top window.
@see GetTopWindow(), OnInit()
*/
void SetTopWindow(wxWindow* window);
/**
Allows the programmer to specify whether the application will use the best
visual on systems that support several visual on the same display. This is typically
the case under Solaris and IRIX, where the default visual is only 8-bit whereas
certain applications are supposed to run in TrueColour mode.
Note that this function has to be called in the constructor of the wxApp
instance and won't have any effect when called later on.
This function currently only has effect under GTK.
@param flag
If @true, the app will use the best visual.
@param forceTrueColour
If @true then the application will try to force using a TrueColour
visual and abort the app if none is found.
*/
void SetUseBestVisual(bool flag, bool forceTrueColour = false);
};
// ============================================================================
// Global functions/macros
// ============================================================================
/** @ingroup group_funcmacro_rtti */
//@{
/**
This is used in headers to create a forward declaration of the wxGetApp()
function implemented by IMPLEMENT_APP().
It creates the declaration <tt>className& wxGetApp()</tt>.
@header{wx/app.h}
Example:
@code
DECLARE_APP(MyApp)
@endcode
*/
#define DECLARE_APP( className )
/**
This is used in the application class implementation file to make the
application class known to wxWidgets for dynamic construction.
@header{wx/app.h}
Example:
@code
IMPLEMENT_APP(MyApp)
@endcode
@see DECLARE_APP().
*/
#define IMPLEMENT_APP( className )
//@}
/**
The global pointer to the singleton wxApp object.
@see wxApp::GetInstance()
*/
wxApp *wxTheApp;
/** @ingroup group_funcmacro_appinitterm */
//@{
/**
This function doesn't exist in wxWidgets but it is created by using the
IMPLEMENT_APP() macro.
Thus, before using it anywhere but in the same module where this macro is
used, you must make it available using DECLARE_APP().
The advantage of using this function compared to directly using the global
::wxTheApp pointer is that the latter is of type wxApp* and so wouldn't
allow you to access the functions specific to your application class but
not present in wxApp while wxGetApp() returns the object of the right type.
@header{wx/app.h}
*/
wxAppDerivedClass& wxGetApp();
/**
If @a doIt is @true, the fatal exceptions (also known as general protection
faults under Windows or segmentation violations in the Unix world) will be
caught and passed to wxApp::OnFatalException.
By default, i.e. before this function is called, they will be handled in
the normal way which usually just means that the application will be
terminated. Calling wxHandleFatalExceptions() with @a doIt equal to @false
will restore this default behaviour.
Notice that this function is only available if @c wxUSE_ON_FATAL_EXCEPTION
is 1 and under Windows platform this requires a compiler with support for
SEH (structured exception handling) which currently means only Microsoft
Visual C++ or a recent Borland C++ version.
@header{wx/app.h}
*/
bool wxHandleFatalExceptions(bool doIt = true);
/**
This function is used in wxBase only and only if you don't create
wxApp object at all. In this case you must call it from your
@c main() function before calling any other wxWidgets functions.
If the function returns @false the initialization could not be performed,
in this case the library cannot be used and wxUninitialize() shouldn't be
called neither.
This function may be called several times but wxUninitialize() must be
called for each successful call to this function.
@header{wx/app.h}
*/
bool wxInitialize();
/**
This function is for use in console (wxBase) programs only. It must be called
once for each previous successful call to wxInitialize().
@header{wx/app.h}
*/
void wxUninitialize();
/**
This function wakes up the (internal and platform dependent) idle system,
i.e. it will force the system to send an idle event even if the system
currently @e is idle and thus would not send any idle event until after
some other event would get sent. This is also useful for sending events
between two threads and is used by the corresponding functions
wxPostEvent() and wxEvtHandler::AddPendingEvent().
@header{wx/app.h}
*/
void wxWakeUpIdle();
/**
Calls wxApp::Yield.
@deprecated
This function is kept only for backwards compatibility. Please use
the wxApp::Yield method instead in any new code.
@header{wx/app.h}
*/
bool wxYield();
/**
This function is similar to wxYield, except that it disables the user input to
all program windows before calling wxYield and re-enables it again
afterwards. If @a win is not @NULL, this window will remain enabled,
allowing the implementation of some limited user interaction.
Returns the result of the call to ::wxYield.
@header{wx/app.h}
*/
bool wxSafeYield(wxWindow* win = NULL, bool onlyIfNeeded = false);
/**
This function initializes wxWidgets in a platform-dependent way. Use this if you
are not using the default wxWidgets entry code (e.g. main or WinMain).
For example, you can initialize wxWidgets from an Microsoft Foundation Classes
(MFC) application using this function.
@note This overload of wxEntry is available under all platforms.
@see wxEntryStart()
@header{wx/app.h}
*/
int wxEntry(int& argc, wxChar** argv);
/**
See wxEntry(int&,wxChar**) for more info about this function.
Notice that under Windows CE platform, and only there, the type of @a pCmdLine
is @c wchar_t *, otherwise it is @c char *, even in Unicode build.
@remarks To clean up wxWidgets, call wxApp::OnExit followed by the static
function wxApp::CleanUp. For example, if exiting from an MFC application
that also uses wxWidgets:
@code
int CTheApp::ExitInstance()
{
// OnExit isn't called by CleanUp so must be called explicitly.
wxTheApp->OnExit();
wxApp::CleanUp();
return CWinApp::ExitInstance();
}
@endcode
@header{wx/app.h}
*/
int wxEntry(HINSTANCE hInstance,
HINSTANCE hPrevInstance = NULL,
char* pCmdLine = NULL,
int nCmdShow = SW_SHOWNORMAL);
//@}
/** @ingroup group_funcmacro_procctrl */
//@{
/**
Exits application after calling wxApp::OnExit.
Should only be used in an emergency: normally the top-level frame
should be deleted (after deleting all other frames) to terminate the
application. See wxCloseEvent and wxApp.
@header{wx/app.h}
*/
void wxExit();
//@}

125
interface/wx/apptrait.h Normal file
View File

@@ -0,0 +1,125 @@
/////////////////////////////////////////////////////////////////////////////
// Name: apptrait.h
// Purpose: interface of wxAppTraits
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxAppTraits
@wxheader{apptrait.h}
The wxAppTraits class defines various configurable aspects of a wxApp.
You can access it using wxApp::GetTraits() function and you can create your
own wxAppTraits overriding the wxApp::CreateTraits() function.
Note that wxAppTraits is an abstract class since it contains many
pure virtual functions.
In fact, by default, wxWidgets creates a @c wxConsoleAppTraits object for
console applications (i.e. those applications linked against wxBase library
only - see the @ref page_libs page) and a @c wxGUIAppTraits object for GUI
applications.
Both these classes are derived by wxAppTraits and represent concrete
implementation of the wxAppTraits interface.
@library{wxbase}
@category{appmanagement}
@see @ref overview_app, wxApp
*/
class wxAppTraits
{
public:
/**
Called by wxWidgets to create the default configuration object for the
application. The default version creates a registry-based wxRegConfig
class under MSW and wxFileConfig under all other platforms.
The wxApp::GetAppName and wxApp::GetVendorName methods are used to
determine the registry key or file name.
*/
virtual wxConfigBase* CreateConfig();
/**
Creates the global font mapper object used for encodings/charset mapping.
*/
virtual wxFontMapper* CreateFontMapper() = 0;
/**
Creates a wxLog class for the application to use for logging errors.
The default implementation returns a new wxLogGui class.
@see wxLog
*/
virtual wxLog* CreateLogTarget() = 0;
/**
Creates the global object used for printing out messages.
*/
virtual wxMessageOutput* CreateMessageOutput() = 0;
/**
Returns 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 mode only and always returns @NULL
in console.
@note the returned pointer needs to be deleted by the caller.
*/
virtual wxRendererNative* CreateRenderer() = 0;
/**
This method returns the name of the desktop environment currently
running in a Unix desktop. Currently only "KDE" or "GNOME" are
supported and the code uses the X11 session protocol vendor name
to figure out, which desktop environment is running. The method
returns an empty string otherwise and on all other platforms.
*/
virtual wxString GetDesktopEnvironment() const = 0;
/**
Returns the wxStandardPaths object for the application.
It's normally the same for wxBase and wxGUI except in the case of wxMac
and wxCocoa.
@todo the real function returns a reference to wxStandardPathsBase;
user looking at these docs will write code:
wxStandardPaths &ref = ...->GetStandardPaths();
which won't compile...
*/
virtual wxStandardPaths& GetStandardPaths();
/**
Returns the wxWidgets port ID used by the running program and eventually
fills the given pointers with the values of the major and minor digits
of the native toolkit currently used.
The version numbers returned are thus detected at run-time and not compile-time
(except when this is not possible e.g. wxMotif).
E.g. if your program is using wxGTK port this function will return wxPORT_GTK
and put in given pointers the versions of the GTK library in use.
See wxPlatformInfo for more details.
*/
virtual wxPortId GetToolkitVersion(int* major = NULL, int* minor = NULL) const = 0;
/**
Returns @true if @c fprintf(stderr) goes somewhere, @false otherwise.
*/
virtual bool HasStderr() = 0;
/**
Returns @true if the library was built as wxUniversal.
Always returns @false for wxBase-only apps.
*/
virtual bool IsUsingUniversalWidgets() const = 0;
/**
Shows the assert dialog with the specified message in GUI mode or just prints
the string to stderr in console mode.
Returns @true to suppress subsequent asserts, @false to continue as before.
*/
virtual bool ShowAssertDialog(const wxString& msg) = 0;
};

638
interface/wx/archive.h Normal file
View File

@@ -0,0 +1,638 @@
/////////////////////////////////////////////////////////////////////////////
// Name: archive.h
// Purpose: interface of wxArchive* classes
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxArchiveInputStream
@wxheader{archive.h}
This is an abstract base class which serves as a common interface to
archive input streams such as wxZipInputStream.
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().
@library{wxbase}
@category{archive}
@see @ref overview_archive, wxArchiveEntry, wxArchiveOutputStream
*/
class wxArchiveInputStream : public wxFilterInputStream
{
public:
/**
Closes the current entry. On a non-seekable stream reads to the end of
the current entry first.
*/
virtual bool CloseEntry() = 0;
/**
Closes the current entry if one is open, then reads the meta-data for
the next entry and returns it in a wxArchiveEntry object, giving away
ownership. Reading this wxArchiveInputStream then returns the entry's data.
*/
wxArchiveEntry* GetNextEntry();
/**
Closes the current entry if one is open, then opens the entry specified
by the wxArchiveEntry object.
@a entry must be from the same archive file that this wxArchiveInputStream
is reading, and it must be reading it from a seekable stream.
*/
virtual bool OpenEntry(wxArchiveEntry& entry) = 0;
};
/**
@class wxArchiveOutputStream
@wxheader{archive.h}
This is an abstract base class which serves as a common interface to
archive output streams such as wxZipOutputStream.
wxArchiveOutputStream::PutNextEntry is used to create a new entry in the
output archive, then the entry's data is written to the wxArchiveOutputStream.
Another call to PutNextEntry() closes the current entry and begins the next.
@library{wxbase}
@category{archive}
@see @ref overview_archive, wxArchiveEntry, wxArchiveInputStream
*/
class wxArchiveOutputStream : public wxFilterOutputStream
{
public:
/**
Calls Close() if it has not already been called.
*/
virtual ~wxArchiveOutputStream();
/**
Closes the archive, returning @true if it was successfully written.
Called by the destructor if not called explicitly.
@see wxOutputStream::Close()
*/
virtual bool Close();
/**
Close the current entry.
It is called implicitly whenever another new entry is created with CopyEntry()
or PutNextEntry(), or when the archive is closed.
*/
virtual bool CloseEntry() = 0;
/**
Some archive formats have additional meta-data that applies to the archive
as a whole.
For example in the case of zip there is a comment, which is stored at the end
of the zip file. CopyArchiveMetaData() can be used to transfer such information
when writing a modified copy of an archive.
Since the position of the meta-data can vary between the various archive
formats, it is best to call CopyArchiveMetaData() before transferring
the entries. The wxArchiveOutputStream will then hold on to the meta-data
and write it at the correct point in the output file.
When the input archive is being read from a non-seekable stream, the
meta-data may not be available when CopyArchiveMetaData() is called,
in which case the two streams set up a link and transfer the data
when it becomes available.
*/
virtual bool CopyArchiveMetaData(wxArchiveInputStream& stream) = 0;
/**
Takes ownership of @a entry and uses it to create a new entry in the
archive. @a entry is then opened in the input stream @a stream
and its contents copied to this stream.
For archive types which compress entry data, CopyEntry() is likely to be
much more efficient than transferring the data using Read() and Write()
since it will copy them without decompressing and recompressing them.
@a entry must be from the same archive file that @a stream is
accessing. For non-seekable streams, @a entry must also be the last
thing read from @a stream.
*/
virtual bool CopyEntry(wxArchiveEntry* entry,
wxArchiveInputStream& stream) = 0;
/**
Create a new directory entry (see wxArchiveEntry::IsDir) with the given
name and timestamp.
PutNextEntry() can also be used to create directory entries, by supplying
a name with a trailing path separator.
*/
virtual bool PutNextDirEntry(const wxString& name,
const wxDateTime& dt = wxDateTime::Now()) = 0;
/**
Takes ownership of entry and uses it to create a new entry in the archive.
The entry's data can then be written by writing to this wxArchiveOutputStream.
*/
virtual bool PutNextEntry(wxArchiveEntry* entry) = 0;
/**
Create a new entry with the given name, timestamp and size. The entry's
data can then be written by writing to this wxArchiveOutputStream.
*/
virtual bool PutNextEntry(const wxString& name,
const wxDateTime& dt = wxDateTime::Now(),
wxFileOffset size = wxInvalidOffset) = 0;
};
/**
@class wxArchiveEntry
@wxheader{archive.h}
This is an abstract base class which serves as a common interface to
archive entry classes such as wxZipEntry.
These hold the meta-data (filename, timestamp, etc.), for entries
in archive files such as zips and tars.
@section wxarchiveentry_nonseekable About non-seekable streams
This information applies only when reading archives from non-seekable streams.
When the stream is seekable GetNextEntry() returns a fully populated wxArchiveEntry.
See @ref overview_archive_noseek for more information.
For generic programming, when the worst case must be assumed, you can rely on
all the fields of wxArchiveEntry being fully populated when
wxArchiveInputStream::GetNextEntry() returns, with the the following exceptions:
@li GetSize(): guaranteed to be available after the entry has been read to Eof(),
or CloseEntry() has been called;
@li IsReadOnly(): guaranteed to be available after the end of the archive has
been reached, i.e. after GetNextEntry() returns NULL and Eof() is true.
@library{wxbase}
@category{archive}
@see @ref overview_archive, @ref overview_archive_generic,
wxArchiveInputStream, wxArchiveOutputStream, wxArchiveNotifier
*/
class wxArchiveEntry : public wxObject
{
public:
/**
Returns a copy of this entry object.
*/
wxArchiveEntry* Clone() const;
/**
Gets the entry's timestamp.
*/
virtual wxDateTime GetDateTime() const = 0;
/**
Sets the entry's timestamp.
*/
virtual void SetDateTime(const wxDateTime& dt) = 0;
/**
Returns the entry's name, by default in the native format.
The name can include directory components, i.e. it can be a full path.
If this is a directory entry, (i.e. if IsDir() is @true) then the
returned string is the name with a trailing path separator.
*/
virtual wxString GetName(wxPathFormat format = wxPATH_NATIVE) const = 0;
/**
Sets the entry's name.
Setting a name with a trailing path separator sets IsDir().
@see GetName()
*/
virtual void SetName(const wxString& name,
wxPathFormat format = wxPATH_NATIVE) = 0;
/**
Returns the size of the entry's data in bytes.
*/
virtual wxFileOffset GetSize() const = 0;
/**
Sets the size of the entry's data in bytes.
*/
virtual void SetSize(wxFileOffset size) = 0;
/**
Returns the path format used internally within the archive to store
filenames.
*/
virtual wxPathFormat GetInternalFormat() const = 0;
/**
Returns the entry's filename in the internal format used within the
archive. The name can include directory components, i.e. it can be a
full path.
The names of directory entries are returned without any trailing path
separator. This gives a canonical name that can be used in comparisons.
@see @ref overview_archive_byname
*/
virtual wxString GetInternalName() const = 0;
/**
Returns a numeric value unique to the entry within the archive.
*/
virtual wxFileOffset GetOffset() const = 0;
/**
Returns @true if this is a directory entry.
Directory entries are entries with no data, which are used to store
the meta-data of directories. They also make it possible for completely
empty directories to be stored.
@note
The names of entries within an archive can be complete paths, and
unarchivers typically create whatever directories are necessary as they
restore files, even if the archive contains no explicit directory entries.
*/
virtual bool IsDir() const = 0;
/**
Marks this entry as a directory if @a isDir is @true. See IsDir() for more info.
*/
virtual void SetIsDir(bool isDir = true) = 0;
/**
Returns @true if the entry is a read-only file.
*/
virtual bool IsReadOnly() const = 0;
/**
Sets this entry as a read-only file.
*/
virtual void SetIsReadOnly(bool isReadOnly = true) = 0;
/**
Sets the notifier (see wxArchiveNotifier) for this entry.
Whenever the wxArchiveInputStream updates this entry, it will then invoke
the associated notifier's wxArchiveNotifier::OnEntryUpdated method.
Setting a notifier is not usually necessary. It is used to handle
certain cases when modifying an archive in a pipeline (i.e. between
non-seekable streams).
*/
void SetNotifier(wxArchiveNotifier& notifier);
/**
Unsets the notifier eventually attached to this entry.
*/
virtual void UnsetNotifier();
};
/**
Type of stream enumeration; used by wxArchiveClassFactory methods.
*/
enum wxStreamProtocolType
{
wxSTREAM_PROTOCOL, //!< wxFileSystem protocol (should be only one)
wxSTREAM_MIMETYPE, //!< MIME types the stream handles
wxSTREAM_ENCODING, //!< Not used for archives
wxSTREAM_FILEEXT //!< File extensions the stream handles
};
/**
@class wxArchiveClassFactory
@wxheader{archive.h}
Allows the creation of streams to handle archive formats such as zip and tar.
For example, given a filename you can search for a factory that will
handle it and create a stream to read it:
@code
factory = wxArchiveClassFactory::Find(filename, wxSTREAM_FILEEXT);
if (factory)
stream = factory->NewStream(new wxFFileInputStream(filename));
@endcode
wxArchiveClassFactory::Find can also search for a factory by MIME type
or wxFileSystem protocol.
The available factories can be enumerated using
wxArchiveClassFactory::GetFirst() and wxArchiveClassFactory::GetNext().
@library{wxbase}
@category{archive}
@see @ref overview_archive, @ref overview_archive_generic, wxArchiveEntry,
wxArchiveInputStream, wxArchiveOutputStream, wxFilterClassFactory
*/
class wxArchiveClassFactory : public wxObject
{
public:
/**
Returns @true if this factory can handle the given protocol, MIME type
or file extension.
When using wxSTREAM_FILEEXT for the second parameter, the first parameter
can be a complete filename rather than just an extension.
*/
bool CanHandle(const wxChar* protocol,
wxStreamProtocolType type = wxSTREAM_PROTOCOL) const;
/**
A static member that finds a factory that can handle a given protocol, MIME
type or file extension. Returns a pointer to the class factory if found, or
@NULL otherwise. It does not give away ownership of the factory.
When using wxSTREAM_FILEEXT for the second parameter, the first parameter
can be a complete filename rather than just an extension.
*/
static const wxArchiveClassFactory* Find(const wxChar* protocol,
wxStreamProtocolType type = wxSTREAM_PROTOCOL);
/**
Returns the wxMBConv object that the created streams will use when
translating meta-data. The initial default, set by the constructor,
is wxConvLocal.
*/
wxMBConv GetConv() const;
/**
Sets the wxMBConv object that the created streams will use when
translating meta-data.
*/
void SetConv(wxMBConv& conv);
//@{
/**
GetFirst and GetNext can be used to enumerate the available factories.
For example, to list them:
@code
wxString list;
const wxArchiveClassFactory *factory = wxArchiveClassFactory::GetFirst();
while (factory) {
list << factory->GetProtocol() << _T("\n");
factory = factory->GetNext();
}
@endcode
GetFirst() and GetNext() return a pointer to a factory or @NULL if no more
are available. They do not give away ownership of the factory.
*/
static const wxArchiveClassFactory* GetFirst() const;
const wxArchiveClassFactory* GetNext() const;
//@}
/**
Calls the static GetInternalName() function for the archive entry type,
for example wxZipEntry::GetInternalName.
*/
wxString GetInternalName(const wxString& name,
wxPathFormat format = wxPATH_NATIVE) const;
/**
Returns the wxFileSystem protocol supported by this factory.
Equivalent to @code wxString(*GetProtocols()) @endcode.
*/
wxString GetProtocol() const;
/**
Returns the protocols, MIME types or file extensions supported by this
factory, as an array of null terminated strings.
It does not give away ownership of the array or strings.
For example, to list the file extensions a factory supports:
@code
wxString list;
const wxChar *const *p;
for (p = factory->GetProtocols(wxSTREAM_FILEEXT); *p; p++)
list << *p << _T("\n");
@encode
*/
const wxChar* const* GetProtocols(wxStreamProtocolType type = wxSTREAM_PROTOCOL) const;
/**
Create a new wxArchiveEntry object of the appropriate type.
*/
wxArchiveEntry* NewEntry() const;
//@{
/**
Create a new input or output stream to read or write an archive.
If the parent stream is passed as a pointer then the new archive stream
takes ownership of it. If it is passed by reference then it does not.
*/
wxArchiveInputStream* NewStream(wxInputStream& stream) const;
wxArchiveOutputStream* NewStream(wxOutputStream& stream) const;
wxArchiveInputStream* NewStream(wxInputStream* stream) const;
wxArchiveOutputStream* NewStream(wxOutputStream* stream) const;
//@}
/**
Adds this class factory to the list returned by GetFirst() or GetNext().
It is not necessary to do this to use the archive streams. It is usually
used when implementing streams, typically the implementation will
add a static instance of its factory class.
It can also be used to change the order of a factory already in the list,
bringing it to the front. This isn't a thread safe operation
so can't be done when other threads are running that will be using the list.
The list does not take ownership of the factory.
*/
void PushFront();
/**
Removes this class factory from the list returned by GetFirst() and GetNext().
Removing from the list isn't a thread safe operation so can't be done when
other threads are running that will be using the list.
The list does not own the factories, so removing a factory does not delete it.
*/
void Remove();
};
/**
@class wxArchiveNotifier
@wxheader{archive.h}
If you need to know when a wxArchiveInputStream updates a wxArchiveEntry
object, you can create a notifier by deriving from this abstract base class,
overriding wxArchiveNotifier::OnEntryUpdated.
An instance of your notifier class can then be assigned to the wxArchiveEntry
object using wxArchiveEntry::SetNotifier.
Your OnEntryUpdated() method will then be invoked whenever the input
stream updates the entry.
Setting a notifier is not usually necessary. It is used to handle
certain cases when modifying an archive in a pipeline (i.e. between
non-seekable streams).
See @ref overview_archive_noseek.
@library{wxbase}
@category{archive}
@see @ref overview_archive_noseek, wxArchiveEntry, wxArchiveInputStream,
wxArchiveOutputStream
*/
class wxArchiveNotifier
{
public:
/**
This method must be overridden in your derived class.
*/
void OnEntryUpdated(class wxArchiveEntry& entry);
};
/**
@class wxArchiveIterator
@wxheader{archive.h}
An input iterator template class that can be used to transfer an archive's
catalogue to a container. It is only available if wxUSE_STL is set to 1
in setup.h, and the uses for it outlined below require a compiler which
supports member templates.
@code
template class Arc, class T = typename Arc::entry_type*
class wxArchiveIterator
{
// this constructor creates an 'end of sequence' object
wxArchiveIterator();
// template parameter 'Arc' should be the type of an archive input stream
wxArchiveIterator(Arc& arc) {
// ...
}
};
@endcode
The first template parameter should be the type of archive input stream
(e.g. wxArchiveInputStream) and the second can either be a pointer to an entry
(e.g. wxArchiveEntry*), or a string/pointer pair (e.g. std::pairwxString,
wxArchiveEntry*).
The @c wx/archive.h header defines the following typedefs:
@code
typedef wxArchiveIterator<wxArchiveInputStream> wxArchiveIter;
typedef wxArchiveIterator<wxArchiveInputStream,
std::pair<wxString, wxArchiveEntry*> > wxArchivePairIter;
@endcode
The header for any implementation of this interface should define similar
typedefs for its types, for example in @c wx/zipstrm.h there is:
@code
typedef wxArchiveIterator<wxZipInputStream> wxZipIter;
typedef wxArchiveIterator<wxZipInputStream,
std::pair<wxString, wxZipEntry*> > wxZipPairIter;
@endcode
Transferring the catalogue of an archive @e arc to a vector @e cat,
can then be done something like this:
@code
std::vector<wxArchiveEntry*> cat((wxArchiveIter)arc, wxArchiveIter());
@endcode
When the iterator is dereferenced, it gives away ownership of an entry
object. So in the above example, when you have finished with @e cat
you must delete the pointers it contains.
If you have smart pointers with normal copy semantics (i.e. not auto_ptr
or wxScopedPtr), then you can create an iterator which uses them instead.
For example, with a smart pointer class for zip entries @e ZipEntryPtr:
@code
typedef std::vector<ZipEntryPtr> ZipCatalog;
typedef wxArchiveIterator<wxZipInputStream, ZipEntryPtr> ZipIter;
ZipCatalog cat((ZipIter)zip, ZipIter());
@endcode
Iterators that return std::pair objects can be used to populate a std::multimap,
to allow entries to be looked up by name.
The string is initialised using the wxArchiveEntry object's
wxArchiveEntry::GetInternalName function.
@code
typedef std::multimap<wxString, wxZipEntry*> ZipCatalog;
ZipCatalog cat((wxZipPairIter)zip, wxZipPairIter());
@endcode
Note that this iterator also gives away ownership of an entry
object each time it is dereferenced. So in the above example, when
you have finished with @e cat you must delete the pointers it contains.
Or if you have them, a pair containing a smart pointer can be used
(again @e ZipEntryPtr), no worries about ownership:
@code
typedef std::multimap<wxString, ZipEntryPtr> ZipCatalog;
typedef wxArchiveIterator<wxZipInputStream,
std::pair<wxString, ZipEntryPtr> > ZipPairIter;
ZipCatalog cat((ZipPairIter)zip, ZipPairIter());
@endcode
@library{wxbase}
@category{archive}
@see wxArchiveEntry, wxArchiveInputStream, wxArchiveOutputStream
*/
class wxArchiveIterator
{
public:
/**
Default constructor.
*/
wxArchiveIterator();
/**
Construct the iterator that returns all the entries in the archive input
stream @a arc.
*/
wxArchiveIterator(Arc& arc);
/**
Returns an entry object from the archive input stream, giving away
ownership.
*/
const T operator*() const;
//@{
/**
Position the input iterator at the next entry in the archive input stream.
*/
wxArchiveIterator operator++();
wxArchiveIterator operator++(int);
//@}
};

376
interface/wx/arrstr.h Normal file
View File

@@ -0,0 +1,376 @@
/////////////////////////////////////////////////////////////////////////////
// Name: arrstr.h
// Purpose: interface of wxArrayString
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@todo
the following functions are not documented; do they need to be?
WXDLLIMPEXP_BASE int wxCMPFUNC_CONV wxStringSortAscending(wxString*, wxString*);
WXDLLIMPEXP_BASE int wxCMPFUNC_CONV wxStringSortDescending(wxString*, wxString*);
*/
/**
@class wxArrayString
@wxheader{arrstr.h}
wxArrayString is an efficient container for storing wxString objects.
It has the same features as all wxArray classes, i.e. it dynamically expands
when new items are added to it (so it is as easy to use as a linked list),
but the access time to the elements is constant, instead of being linear in
number of elements as in the case of linked lists. It is also very size
efficient and doesn't take more space than a C array @e wxString[] type
(wxArrayString uses its knowledge of internals of wxString class to achieve this).
This class is used in the same way as other dynamic arrays(), except that no
::WX_DEFINE_ARRAY declaration is needed for it.
When a string is added or inserted in the array, a copy of the string is created,
so the original string may be safely deleted (e.g. if it was a @e wxChar *
pointer the memory it was using can be freed immediately after this).
In general, there is no need to worry about string memory deallocation when using
this class - it will always free the memory it uses itself.
The references returned by wxArrayString::Item, wxArrayString::Last or
wxArrayString::operator[] are not constant, so the array elements may
be modified in place like this:
@code
array.Last().MakeUpper();
@endcode
@note none of the methods of wxArrayString is virtual including its
destructor, so this class should not be used as a base class.
Although this is not true strictly speaking, this class may be considered as
a specialization of wxArray class for the wxString member data: it is not
implemented like this, but it does have all of the wxArray functions.
@todo what about stl? how does it integrate?
@library{wxbase}
@category{containers}
@see wxArray, wxString, @ref overview_string
*/
class wxArrayString : public wxArray
{
public:
/**
Default constructor.
*/
wxArrayString();
/**
Copy constructor.
*/
wxArrayString(const wxArrayString& array);
//@{
/**
Constructor from a C string array. Pass a size @a sz and an array @a arr.
**/
wxArrayString(size_t sz, const char** arr);
wxArrayString(size_t sz, const wchar_t** arr);
//@}
/**
Constructor from a wxString array. Pass a size @a sz and array @a arr.
*/
wxArrayString(size_t sz, const wxString* arr);
/**
Destructor frees memory occupied by the array strings. For performance
reasons it is not virtual, so this class should not be derived from.
*/
~wxArrayString();
/**
Appends the given number of @a copies of the new item @a str to the
array and returns the index of the first new item in the array.
@see Insert()
*/
size_t Add(const wxString& str, size_t copies = 1);
/**
Preallocates enough memory to store @a nCount items. This function may be
used to improve array class performance before adding a known number of items
consecutively.
@todo FIX THIS LINK
@see @ref wxArray::memorymanagement "Dynamic array memory management"
*/
void Alloc(size_t nCount);
/**
Clears the array contents and frees memory.
@see Empty()
*/
void Clear();
/**
Empties the array: after a call to this function GetCount() will return 0.
However, this function does not free the memory used by the array and so
should be used when the array is going to be reused for storing other strings.
Otherwise, you should use Clear() to empty the array and free memory.
*/
void Empty();
/**
Returns the number of items in the array.
*/
size_t GetCount() const;
/**
Search the element in the array, starting from the beginning if @a bFromEnd
is @false or from end otherwise. If @a bCase, comparison is case sensitive
(default), otherwise the case is ignored.
This function uses linear search for wxArrayString.
Returns index of the first item matched or @c wxNOT_FOUND if there is no match.
*/
int Index(const wxString& sz, bool bCase = true, bool bFromEnd = false) const;
/**
Insert the given number of @a copies of the new element in the array before the
position @a nIndex. Thus, for example, to insert the string in the beginning of
the array you would write:
@code
Insert("foo", 0);
@endcode
If @a nIndex is equal to GetCount() this function behaves as Add().
*/
void Insert(const wxString& str, size_t nIndex,
size_t copies = 1);
/**
Returns @true if the array is empty, @false otherwise. This function returns the
same result as GetCount() == 0 but is probably easier to read.
*/
bool IsEmpty() const;
/**
Return the array element at position @a nIndex. An assert failure will
result from an attempt to access an element beyond the end of array in debug
mode, but no check is done in release mode.
@see operator[] for the operator version.
*/
wxString& Item(size_t nIndex) const;
/**
Returns the last element of the array. Attempt to access the last element of
an empty array will result in assert failure in debug build, however no checks
are done in release mode.
*/
wxString& Last() const;
/**
Removes the first item matching this value. An assert failure is provoked by
an attempt to remove an element which does not exist in debug build.
@see Index()
*/
void Remove(const wxString& sz);
/**
Removes @a count items starting at position @a nIndex from the array.
*/
void RemoveAt(size_t nIndex, size_t count = 1);
/**
Releases the extra memory allocated by the array. This function is useful to
minimize the array memory consumption.
@todo FIX THIS LINK
@see Alloc(), @ref wxArray::memorymanagement "Dynamic array memory
management"
*/
void Shrink();
/**
Sorts the array in alphabetical order or in reverse alphabetical order if
@a reverseOrder is @true. The sort is case-sensitive.
*/
void Sort(bool reverseOrder = false);
/**
Sorts the array using the specified @a compareFunction for item comparison.
@a CompareFunction is defined as a function taking two @e const wxString
parameters and returning an @e int value less than, equal to or greater
than 0 if the first string is less than, equal to or greater than the
second one.
Example:
The following example sorts strings by their length.
@code
static int CompareStringLen(const wxString& first, const wxString& second)
{
return first.length() - second.length();
}
...
wxArrayString array;
array.Add("one");
array.Add("two");
array.Add("three");
array.Add("four");
array.Sort(CompareStringLen);
@endcode
*/
void Sort(CompareFunction compareFunction);
/**
Compares 2 arrays respecting the case. Returns @true if the arrays have
different number of elements or if the elements don't match pairwise.
*/
bool operator !=(const wxArrayString& array) const;
/**
Assignment operator.
*/
wxArrayString& operator=(const wxArrayString&);
/**
Compares 2 arrays respecting the case. Returns @true only if the arrays have
the same number of elements and the same strings in the same order.
*/
bool operator ==(const wxArrayString& array) const;
/**
Return the array element at position @a nIndex. An assert failure will
result from an attempt to access an element beyond the end of array in
debug mode, but no check is done in release mode.
This is the operator version of the Item() method.
*/
wxString& operator[](size_t nIndex) const;
};
/**
@class wxSortedArrayString
@wxheader{arrstr.h}
wxSortedArrayString is an efficient container for storing wxString objects
which always keeps the string in alphabetical order.
wxSortedArrayString uses binary search in its wxArrayString::Index() function
(instead of linear search for wxArrayString::Index()) which makes it much more
efficient if you add strings to the array rarely (because, of course, you have
to pay for Index() efficiency by having Add() be slower) but search for them
often. Several methods should not be used with sorted array (basically, all
those which break the order of items) which is mentioned in their description.
@todo what about STL? who does it integrates?
@library{wxbase}
@category{containers}
@see wxArray, wxString, @ref overview_string
*/
class wxSortedArrayString : public wxArrayString
{
public:
/**
Copy constructor. Note that when an array is assigned to a sorted array,
its contents is automatically sorted during construction.
*/
wxArrayString(const wxArrayString& array);
/**
@copydoc wxArrayString::Add()
@warning
For sorted arrays, the index of the inserted item will not be, in general,
equal to GetCount() - 1 because the item is inserted at the correct position
to keep the array sorted and not appended.
*/
size_t Add(const wxString& str, size_t copies = 1);
/**
@copydoc wxArrayString::Index()
This function uses binary search for wxSortedArrayString, but it ignores
the @a bCase and @a bFromEnd parameters.
*/
int Index(const wxString& sz, bool bCase = true,
bool bFromEnd = false);
/**
@warning this function should not be used with sorted arrays because it
could break the order of items and, for example, subsequent calls
to Index() would then not work!
*/
void Insert(const wxString& str, size_t nIndex,
size_t copies = 1);
//@{
/**
@warning this function should not be used with sorted array because it could
break the order of items and, for example, subsequent calls to Index()
would then not work! Also, sorting a wxSortedArrayString doesn't make
sense because its elements are always already sorted.
*/
void Sort(bool reverseOrder = false);
void Sort(CompareFunction compareFunction);
//@}
};
// ============================================================================
// Global functions/macros
// ============================================================================
/** @ingroup group_funcmacro_string */
//@{
/**
Splits the given wxString object using the separator @a sep and returns the
result as a wxArrayString.
If the @a escape character is non-@NULL, then the occurrences of @a sep
immediately prefixed with @a escape are not considered as separators.
Note that empty tokens will be generated if there are two or more adjacent
separators.
@see wxJoin()
@header{wx/arrstr.h}
*/
wxArrayString wxSplit(const wxString& str, const wxChar sep,
const wxChar escape = '\\');
/**
Concatenate all lines of the given wxArrayString object using the separator
@a sep and returns the result as a wxString.
If the @a escape character is non-@NULL, then it's used as prefix for each
occurrence of @a sep in the strings contained in @a arr before joining them
which is necessary in order to be able to recover the original array
contents from the string later using wxSplit().
@see wxSplit()
@header{wx/arrstr.h}
*/
wxString wxJoin(const wxArrayString& arr, const wxChar sep,
const wxChar escape = '\\');
//@}

283
interface/wx/artprov.h Normal file
View File

@@ -0,0 +1,283 @@
/////////////////////////////////////////////////////////////////////////////
// Name: artprov.h
// Purpose: interface of wxArtProvider
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxArtProvider
@wxheader{artprov.h}
wxArtProvider class is used to customize the look of wxWidgets application.
When wxWidgets needs to display an icon or a bitmap (e.g. in the standard file
dialog), it does not use a hard-coded resource but asks wxArtProvider for it
instead. This way users can plug in their own wxArtProvider class and easily
replace standard art with their own version.
All that is needed is to derive a class from wxArtProvider, override either its
wxArtProvider::CreateBitmap() and/or its wxArtProvider::CreateIconBundle() methods
and register the provider with wxArtProvider::Push():
@code
class MyProvider : public wxArtProvider
{
protected:
wxBitmap CreateBitmap(const wxArtID& id,
const wxArtClient& client,
const wxSize size)
// optionally override this one as well
wxIconBundle CreateIconBundle(const wxArtID& id,
const wxArtClient& client)
{ ... }
};
...
wxArtProvider::Push(new MyProvider);
@endcode
If you need bitmap images (of the same artwork) that should be displayed at
different sizes you should probably consider overriding wxArtProvider::CreateIconBundle
and supplying icon bundles that contain different bitmap sizes.
There's another way of taking advantage of this class: you can use it in your
code and use platform native icons as provided by wxArtProvider::GetBitmap or
wxArtProvider::GetIcon.
@todo IS THIS NB TRUE?
(@note this is not yet really possible as of wxWidgets 2.3.3, the set of wxArtProvider
bitmaps is too small).
@section wxartprovider_identify Identifying art resources
Every bitmap and icon bundle are known to wxArtProvider under an unique ID that
is used when requesting a resource from it. The ID is represented by wxArtID type
and can have one of these predefined values (you can see bitmaps represented by these
constants in the @ref page_samples_artprovider):
<table>
<tr><td>
@li wxART_ERROR
@li wxART_QUESTION
@li wxART_WARNING
@li wxART_INFORMATION
@li wxART_ADD_BOOKMARK
@li wxART_DEL_BOOKMARK
@li wxART_HELP_SIDE_PANEL
@li wxART_HELP_SETTINGS
@li wxART_HELP_BOOK
@li wxART_HELP_FOLDER
@li wxART_HELP_PAGE
@li wxART_GO_BACK
@li wxART_GO_FORWARD
@li wxART_GO_UP
</td><td>
@li wxART_GO_DOWN
@li wxART_GO_TO_PARENT
@li wxART_GO_HOME
@li wxART_PRINT
@li wxART_HELP
@li wxART_TIP
@li wxART_REPORT_VIEW
@li wxART_LIST_VIEW
@li wxART_NEW_DIR
@li wxART_FOLDER
@li wxART_FOLDER_OPEN
@li wxART_GO_DIR_UP
@li wxART_EXECUTABLE_FILE
@li wxART_NORMAL_FILE
@li wxART_TICK_MARK
@li wxART_CROSS_MARK
</td><td>
@li wxART_MISSING_IMAGE
@li wxART_NEW
@li wxART_FILE_OPEN
@li wxART_FILE_SAVE
@li wxART_FILE_SAVE_AS
@li wxART_DELETE
@li wxART_COPY
@li wxART_CUT
@li wxART_PASTE
@li wxART_UNDO
@li wxART_REDO
@li wxART_QUIT
@li wxART_FIND
@li wxART_FIND_AND_REPLACE
@li wxART_HARDDISK
@li wxART_FLOPPY
@li wxART_CDROM
@li wxART_REMOVABLE
</td></tr>
</table>
Additionally, any string recognized by custom art providers registered using
wxArtProvider::Push may be used.
@note
When running under GTK+ 2, GTK+ stock item IDs (e.g. @c "gtk-cdrom") may be used
as well. Additionally, if wxGTK was compiled against GTK+ >= 2.4, then it is also
possible to load icons from current icon theme by specifying their name (without
extension and directory components).
Icon themes recognized by GTK+ follow the freedesktop.org Icon Themes specification
(see http://freedesktop.org/Standards/icon-theme-spec).
Note that themes are not guaranteed to contain all icons, so wxArtProvider may
return ::wxNullBitmap or ::wxNullIcon.
The default theme is typically installed in @c /usr/share/icons/hicolor.
@section wxartprovider_clients Clients
Client is the entity that calls wxArtProvider's GetBitmap or GetIcon function.
It is represented by wxClientID type and can have one of these values:
@li wxART_TOOLBAR
@li wxART_MENU
@li wxART_BUTTON
@li wxART_FRAME_ICON
@li wxART_CMN_DIALOG
@li wxART_HELP_BROWSER
@li wxART_MESSAGE_BOX
@li wxART_OTHER (used for all requests that don't fit into any of the
categories above)
Client ID servers as a hint to wxArtProvider that is supposed to help it to
choose the best looking bitmap. For example it is often desirable to use
slightly different icons in menus and toolbars even though they represent
the same action (e.g. wxART_FILE_OPEN). Remember that this is really only a
hint for wxArtProvider -- it is common that wxArtProvider::GetBitmap returns
identical bitmap for different client values!
@library{wxcore}
@category{misc,data}
@see the @ref page_samples_artprovider for an example of wxArtProvider usage.
*/
class wxArtProvider : public wxObject
{
public:
/**
The destructor automatically removes the provider from the provider stack used
by GetBitmap().
*/
virtual ~wxArtProvider();
/**
Delete the given @a provider.
*/
static bool Delete(wxArtProvider* provider);
/**
Query registered providers for bitmap with given ID.
@param id
wxArtID unique identifier of the bitmap.
@param client
wxArtClient identifier of the client (i.e. who is asking for the bitmap).
@param size
Size of the returned bitmap or wxDefaultSize if size doesn't matter.
@return The bitmap if one of registered providers recognizes the ID or
wxNullBitmap otherwise.
*/
static wxBitmap GetBitmap(const wxArtID& id,
const wxArtClient& client = wxART_OTHER,
const wxSize& size = wxDefaultSize);
/**
Same as wxArtProvider::GetBitmap, but return a wxIcon object
(or ::wxNullIcon on failure).
*/
static wxIcon GetIcon(const wxArtID& id,
const wxArtClient& client = wxART_OTHER,
const wxSize& size = wxDefaultSize);
/**
Returns a suitable size hint for the given @e wxArtClient. If
@a platform_default is @true, return a size based on the current platform,
otherwise return the size from the topmost wxArtProvider. @e wxDefaultSize may
be returned if the client doesn't have a specified size, like wxART_OTHER for
example.
*/
static wxSize GetSizeHint(const wxArtClient& client,
bool platform_default = false);
/**
Query registered providers for icon bundle with given ID.
@param id
wxArtID unique identifier of the icon bundle.
@param client
wxArtClient identifier of the client (i.e. who is asking for the icon
bundle).
@return The icon bundle if one of registered providers recognizes the ID
or wxNullIconBundle otherwise.
*/
static wxIconBundle GetIconBundle(const wxArtID& id,
const wxArtClient& client = wxART_OTHER);
/**
Register new art provider and add it to the bottom of providers stack
(i.e. it will be queried as the last one).
@see Push()
*/
static void Insert(wxArtProvider* provider);
/**
Remove latest added provider and delete it.
*/
static bool Pop();
/**
Register new art provider and add it to the top of providers stack
(i.e. it will be queried as the first provider).
@see Insert()
*/
static void Push(wxArtProvider* provider);
/**
Remove a provider from the stack if it is on it. The provider is not
deleted, unlike when using Delete().
*/
static bool Remove(wxArtProvider* provider);
protected:
/**
Derived art provider classes must override this method to create requested art
resource. Note that returned bitmaps are cached by wxArtProvider and it is
therefore not necessary to optimize CreateBitmap() for speed (e.g. you may
create wxBitmap objects from XPMs here).
@param id
wxArtID unique identifier of the bitmap.
@param client
wxArtClient identifier of the client (i.e. who is asking for the bitmap).
This only servers as a hint.
@param size
Preferred size of the bitmap. The function may return a bitmap of different
dimensions, it will be automatically rescaled to meet client's request.
@note
This is not part of wxArtProvider's public API, use wxArtProvider::GetBitmap
or wxArtProvider::GetIconBundle or wxArtProvider::GetIcon to query wxArtProvider
for a resource.
@see CreateIconBundle()
*/
virtual wxBitmap CreateBitmap(const wxArtID& id,
const wxArtClient& client,
const wxSize& size);
/**
This method is similar to CreateBitmap() but can be used when a bitmap
(or an icon) exists in several sizes.
*/
virtual wxIconBundle CreateIconBundle(const wxArtID& id,
const wxArtClient& client);
};

43
interface/wx/atomic.h Normal file
View File

@@ -0,0 +1,43 @@
/////////////////////////////////////////////////////////////////////////////
// Name: atomic.h
// Purpose: interface of global functions
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// ============================================================================
// Global functions/macros
// ============================================================================
/** @ingroup group_funcmacro_atomic */
//@{
/**
This function increments @a value in an atomic manner.
Whenever possible wxWidgets provides an efficient, CPU-specific,
implementation of this function. If such implementation is available, the
symbol wxHAS_ATOMIC_OPS is defined. Otherwise this function still exists
but is implemented in a generic way using a critical section which can be
prohibitively expensive for use in performance-sensitive code.
@header{wx/atomic.h}
*/
void wxAtomicInc(wxAtomicInt& value);
/**
This function decrements value in an atomic manner.
Returns 0 if value is 0 after decrement or any non-zero value (not
necessarily equal to the value of the variable) otherwise.
@see wxAtomicInc
@header{wx/atomic.h}
*/
wxInt32 wxAtomicDec(wxAtomicInt& value);
//@}

325
interface/wx/aui/auibook.h Normal file
View File

@@ -0,0 +1,325 @@
/////////////////////////////////////////////////////////////////////////////
// Name: aui/auibook.h
// Purpose: interface of wxAuiNotebook
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxAuiNotebook
@headerfile auibook.h wx/aui/auibook.h
wxAuiNotebook is part of the wxAUI class framework.
See also @ref overview_aui.
wxAuiNotebook is a notebook control which implements many features common in
applications with dockable panes.
Specifically, wxAuiNotebook implements functionality which allows the user to
rearrange tab order via drag-and-drop, split the tab window into many different
splitter configurations, and toggle through different themes to customize
the control's look and feel.
An effort has been made to try to maintain an API as similar to that of
wxNotebook.
The default theme that is used is wxAuiDefaultTabArt, which provides a modern,
glossy look and feel.
The theme can be changed by calling wxAuiNotebook::SetArtProvider.
@beginStyleTable
@style{wxAUI_NB_DEFAULT_STYLE}
Defined as wxAUI_NB_TOP | wxAUI_NB_TAB_SPLIT | wxAUI_NB_TAB_MOVE |
wxAUI_NB_SCROLL_BUTTONS | wxAUI_NB_CLOSE_ON_ACTIVE_TAB.
@style{wxAUI_NB_TAB_SPLIT}
Allows the tab control to be split by dragging a tab.
@style{wxAUI_NB_TAB_MOVE}
Allows a tab to be moved horizontally by dragging.
@style{wxAUI_NB_TAB_EXTERNAL_MOVE}
Allows a tab to be moved to another tab control.
@style{wxAUI_NB_TAB_FIXED_WIDTH}
With this style, all tabs have the same width.
@style{wxAUI_NB_SCROLL_BUTTONS}
With this style, left and right scroll buttons are displayed.
@style{wxAUI_NB_WINDOWLIST_BUTTON}
With this style, a drop-down list of windows is available.
@style{wxAUI_NB_CLOSE_BUTTON}
With this style, a close button is available on the tab bar.
@style{wxAUI_NB_CLOSE_ON_ACTIVE_TAB}
With this style, the close button is visible on the active tab.
@style{wxAUI_NB_CLOSE_ON_ALL_TABS}
With this style, the close button is visible on all tabs.
@style{wxAUI_NB_TOP}
With this style, tabs are drawn along the top of the notebook.
@style{wxAUI_NB_BOTTOM}
With this style, tabs are drawn along the bottom of the notebook.
@endStyleTable
@library{wxaui}
@category{aui}
*/
class wxAuiNotebook : public wxControl
{
public:
wxAuiNotebook();
/**
Constructor. Creates a wxAuiNotebok control.
*/
wxAuiNotebook(wxWindow* parent, wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxAUI_NB_DEFAULT_STYLE);
/**
Adds a page.
If the @a select parameter is @true, calling this will generate a page change event.
*/
bool AddPage(wxWindow* page, const wxString& caption,
bool select = false,
const wxBitmap& bitmap = wxNullBitmap);
/**
Sets the selection to the next or previous page.
*/
void AdvanceSelection(bool forward = true);
/**
Creates the notebook window.
*/
bool Create(wxWindow* parent, wxWindowID id = wxID_ANY,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0);
/**
Deletes a page at the given index.
Calling this method will generate a page change event.
*/
bool DeletePage(size_t page);
/**
Returns the associated art provider.
*/
wxAuiTabArt* GetArtProvider() const;
/**
Returns the desired height of the notebook for the given page height.
Use this to fit the notebook to a given page size.
*/
int GetHeightForPageHeight(int pageHeight);
/**
Returns the page specified by the given index.
*/
wxWindow* GetPage(size_t page_idx) const;
/**
Returns the tab bitmap for the page.
*/
wxBitmap GetPageBitmap(size_t page) const;
/**
Returns the number of pages in the notebook.
*/
size_t GetPageCount() const;
/**
Returns the page index for the specified window.
If the window is not found in the notebook, wxNOT_FOUND is returned.
*/
int GetPageIndex(wxWindow* page_wnd) const;
/**
Returns the tab label for the page.
*/
wxString GetPageText(size_t page) const;
/**
Returns the currently selected page.
*/
int GetSelection() const;
/**
Returns the height of the tab control.
*/
int GetTabCtrlHeight() const;
/**
InsertPage() is similar to AddPage, but allows the ability to specify the
insert location.
If the @a select parameter is @true, calling this will generate a page change
event.
*/
bool InsertPage(size_t page_idx, wxWindow* page,
const wxString& caption,
bool select = false,
const wxBitmap& bitmap = wxNullBitmap);
/**
Removes a page, without deleting the window pointer.
*/
bool RemovePage(size_t page);
/**
Sets the art provider to be used by the notebook.
*/
void SetArtProvider(wxAuiTabArt* art);
/**
Sets the font for drawing the tab labels, using a bold version of the font for
selected tab labels.
*/
virtual bool SetFont(const wxFont& font);
/**
Sets the font for measuring tab labels.
*/
void SetMeasuringFont(const wxFont& font);
/**
Sets the font for drawing unselected tab labels.
*/
void SetNormalFont(const wxFont& font);
/**
Sets the bitmap for the page. To remove a bitmap from the tab caption, pass
wxNullBitmap.
*/
bool SetPageBitmap(size_t page, const wxBitmap& bitmap);
/**
Sets the tab label for the page.
*/
bool SetPageText(size_t page, const wxString& text);
/**
Sets the font for drawing selected tab labels.
*/
void SetSelectedFont(const wxFont& font);
/**
Sets the page selection. Calling this method will generate a page change event.
*/
size_t SetSelection(size_t new_page);
/**
Sets the tab height. By default, the tab control height is calculated
by measuring the text height and bitmap sizes on the tab captions. Calling this
method will override that calculation and set the tab control to the specified
height parameter. A call to this method will override any call to
SetUniformBitmapSize().
Specifying -1 as the height will return the control to its default auto-sizing
behaviour.
*/
virtual void SetTabCtrlHeight(int height);
//@{
/**
Split performs a split operation programmatically. The argument @a page
indicates the page that will be split off. This page will also become the
active page after the split.
The @a direction argument specifies where the pane should go, it should be one
of the following: wxTOP, wxBOTTOM, wxLEFT, or wxRIGHT.
*/
void SetUniformBitmapSize(const wxSize& size);
void Split(size_t page, int direction);
//@}
/**
Shows the window menu for the active tab control associated with this notebook,
and returns @true if a selection was made.
*/
bool ShowWindowMenu();
};
/**
@class wxAuiTabArt
@headerfile auibook.h wx/aui/auibook.h
Tab art class.
@todo BETTER DESCRIPTION NEEDED
@library{wxaui}
@category{aui}
*/
class wxAuiTabArt
{
public:
/**
Constructor.
*/
wxAuiTabArt();
/**
Clones the art object.
*/
virtual wxAuiTabArt* Clone() = 0;
/**
Draws a background on the given area.
*/
virtual void DrawBackground(wxDC& dc, wxWindow* wnd, const wxRect& rect) = 0;
/**
Draws a button.
*/
virtual void DrawButton(wxDC& dc, wxWindow* wnd, const wxRect& in_rect,
int bitmap_id, int button_state, int orientation,
wxRect* out_rect) = 0;
/**
Draws a tab.
*/
virtual void DrawTab(wxDC& dc, wxWindow* wnd, const wxAuiNotebookPage& page,
const wxRect& rect, int close_button_state,
wxRect* out_tab_rect, wxRect* out_button_rect, int* x_extent) = 0;
/**
Returns the tab control size.
*/
virtual int GetBestTabCtrlSize(wxWindow*, const wxAuiNotebookPageArray&, const wxSize&) = 0;
/**
Returns the indent size.
*/
virtual int GetIndentSize() = 0;
/**
Returns the tab size for the given caption, bitmap and state.
*/
virtual wxSize GetTabSize(wxDC& dc, wxWindow* wnd, const wxString& caption,
const wxBitmap& bitmap, bool active,
int close_button_state, int* x_extent) = 0;
/**
Sets flags.
*/
virtual void SetFlags(unsigned int flags) = 0;
/**
Sets the font used for calculating measurements.
*/
virtual void SetMeasuringFont(const wxFont& font) = 0;
/**
Sets the normal font for drawing labels.
*/
virtual void SetNormalFont(const wxFont& font) = 0;
/**
Sets the font for drawing text for selected UI elements.
*/
virtual void SetSelectedFont(const wxFont& font) = 0;
/**
Sets sizing information.
*/
virtual void SetSizingInfo(const wxSize& tab_ctrl_size, size_t tab_count) = 0;
};

180
interface/wx/aui/dockart.h Normal file
View File

@@ -0,0 +1,180 @@
/////////////////////////////////////////////////////////////////////////////
// Name: aui/dockart.h
// Purpose: interface of wxAuiDockArt
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@todo TOWRITE
*/
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
};
/**
@todo TOWRITE
*/
enum wxAuiPaneDockArtGradients
{
wxAUI_GRADIENT_NONE = 0,
wxAUI_GRADIENT_VERTICAL = 1,
wxAUI_GRADIENT_HORIZONTAL = 2
};
/**
@todo TOWRITE
*/
enum wxAuiPaneButtonState
{
wxAUI_BUTTON_STATE_NORMAL = 0,
wxAUI_BUTTON_STATE_HOVER = 1,
wxAUI_BUTTON_STATE_PRESSED = 2
};
/**
@todo TOWRITE
*/
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
};
/**
@class wxAuiDockArt
@headerfile dockart.h wx/aui/dockart.h
wxAuiDockArt is part of the wxAUI class framework.
See also @ref overview_aui.
wxAuiDockArt is the art provider: provides all drawing functionality to the
wxAui dock manager. This allows the dock manager to have a plugable look-and-feel.
By default, a wxAuiManager uses an instance of this class called
wxAuiDefaultDockArt which provides bitmap art and a colour scheme that is
adapted to the major platforms' look. You can either derive from that class
to alter its behaviour or write a completely new dock art class.
Call wxAuiManager::SetArtProvider to force wxAUI to use your new dock art provider.
@library{wxaui}
@category{aui}
@see wxAuiManager, wxAuiPaneInfo
*/
class wxAuiDockArt
{
public:
/**
Constructor.
*/
wxAuiDockArt();
/**
Destructor.
*/
virtual ~wxAuiDockArt();
/**
Draws a background.
*/
virtual void DrawBackground(wxDC& dc, wxWindow* window, int orientation,
const wxRect& rect) = 0;
/**
Draws a border.
*/
virtual void DrawBorder(wxDC& dc, wxWindow* window, const wxRect& rect,
wxAuiPaneInfo& pane) = 0;
/**
Draws a caption.
*/
virtual void DrawCaption(wxDC& dc, wxWindow* window, const wxString& text,
const wxRect& rect, wxAuiPaneInfo& pane) = 0;
/**
Draws a gripper.
*/
virtual void DrawGripper(wxDC& dc, wxWindow* window, const wxRect& rect,
wxAuiPaneInfo& pane) = 0;
/**
Draws a button in the pane's title bar.
@a button can be one of the values of @b wxAuiButtonId.
@a button_state can be one of the values of @b wxAuiPaneButtonState.
*/
virtual void DrawPaneButton(wxDC& dc, wxWindow* window, int button,
int button_state, const wxRect& rect,
wxAuiPaneInfo& pane) = 0;
/**
Draws a sash between two windows.
*/
virtual void DrawSash(wxDC& dc, wxWindow* window, int orientation,
const wxRect& rect) = 0;
/**
Get the colour of a certain setting.
@a id can be one of the colour values of @b wxAuiPaneDockArtSetting.
*/
virtual wxColour GetColour(int id) = 0;
/**
Get a font setting.
*/
virtual wxFont GetFont(int id) = 0;
/**
Get the value of a certain setting.
@a id can be one of the size values of @b wxAuiPaneDockArtSetting.
*/
virtual int GetMetric(int id) = 0;
/**
Set a certain setting with the value @e colour.
@a id can be one of the colour values of @b wxAuiPaneDockArtSetting.
*/
virtual void SetColour(int id, const wxColour& colour) = 0;
/**
Set a font setting.
*/
virtual void SetFont(int id, const wxFont& font) = 0;
/**
Set a certain setting with the value @e new_val.
@a id can be one of the size values of @b wxAuiPaneDockArtSetting.
*/
virtual void SetMetric(int id, int new_val) = 0;
};

View File

@@ -0,0 +1,771 @@
/////////////////////////////////////////////////////////////////////////////
// Name: aui/aui.h
// Purpose: interface of wxAuiManager
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@todo TOWRITE
*/
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
};
/**
@todo TOWRITE
*/
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_DEFAULT = wxAUI_MGR_ALLOW_FLOATING |
wxAUI_MGR_TRANSPARENT_HINT |
wxAUI_MGR_HINT_FADE |
wxAUI_MGR_NO_VENETIAN_BLINDS_FADE
};
/**
@class wxAuiManager
@headerfile aui.h wx/aui/aui.h
wxAuiManager is the central class of the wxAUI class framework.
See also @ref overview_aui.
wxAuiManager manages the panes associated with it for a particular wxFrame,
using a pane's wxAuiPaneInfo information to determine each pane's docking
and floating behavior.
wxAuiManager uses wxWidgets' sizer mechanism to plan the layout of each frame.
It uses a replaceable dock art class to do all drawing, so all drawing is
localized in one area, and may be customized depending on an application's
specific needs.
wxAuiManager works as follows: the programmer adds panes to the class,
or makes changes to existing pane properties (dock position, floating
state, show state, etc.). To apply these changes, wxAuiManager's
Update() function is called. This batch processing can be used to avoid
flicker, by modifying more than one pane at a time, and then "committing"
all of the changes at once by calling Update().
Panes can be added quite easily:
@code
wxTextCtrl* text1 = new wxTextCtrl(this, -1);
wxTextCtrl* text2 = new wxTextCtrl(this, -1);
m_mgr.AddPane(text1, wxLEFT, wxT("Pane Caption"));
m_mgr.AddPane(text2, wxBOTTOM, wxT("Pane Caption"));
m_mgr.Update();
@endcode
Later on, the positions can be modified easily. The following will float
an existing pane in a tool window:
@code
m_mgr.GetPane(text1).Float();
@endcode
@section wxauimanager_layers Layers, Rows and Directions, Positions
Inside wxAUI, the docking layout is figured out by checking several pane
parameters. Four of these are important for determining where a pane will end up:
@li Direction: Each docked pane has a direction, Top, Bottom, Left, Right, or Center.
This is fairly self-explanatory. The pane will be placed in the location specified
by this variable.
@li Position: More than one pane can be placed inside of a dock. Imagine two panes
being docked on the left side of a window. One pane can be placed over another.
In proportionally managed docks, the pane position indicates its sequential position,
starting with zero. So, in our scenario with two panes docked on the left side,
the top pane in the dock would have position 0, and the second one would occupy
position 1.
@li Row: A row can allow for two docks to be placed next to each other. One of the
most common places for this to happen is in the toolbar. Multiple toolbar rows
are allowed, the first row being row 0, and the second row 1. Rows can also be
used on vertically docked panes.
@li Layer: A layer is akin to an onion. Layer 0 is the very center of the managed pane.
Thus, if a pane is in layer 0, it will be closest to the center window (also
sometimes known as the "content window"). Increasing layers "swallow up" all
layers of a lower value. This can look very similar to multiple rows, but is
different because all panes in a lower level yield to panes in higher levels.
The best way to understand layers is by running the wxAUI sample.
@library{wxbase}
@category{aui}
@see wxAuiPaneInfo, wxAuiDockArt
*/
class wxAuiManager : public wxEvtHandler
{
public:
/**
Constructor. @a managed_wnd specifies the wxFrame which should be managed.
@a flags specifies options which allow the frame management behavior
to be modified.
*/
wxAuiManager(wxWindow* managed_wnd = NULL,
unsigned int flags = wxAUI_MGR_DEFAULT);
/**
Dtor.
*/
virtual ~wxAuiManager();
//@{
/**
AddPane() tells the frame manager to start managing a child window.
There are several versions of this function. The first version allows
the full spectrum of pane parameter possibilities. The second version is
used for simpler user interfaces which do not require as much configuration.
The last version allows a drop position to be specified, which will determine
where the pane will be added.
*/
bool AddPane(wxWindow* window, const wxAuiPaneInfo& pane_info);
bool AddPane(wxWindow* window, int direction = wxLEFT,
const wxString& caption = wxEmptyString);
bool AddPane(wxWindow* window,
const wxAuiPaneInfo& pane_info,
const wxPoint& drop_pos);
//@}
/**
Tells the wxAuiManager to stop managing the pane specified by window.
The window, if in a floated frame, is reparented to the frame managed
by wxAuiManager.
*/
bool DetachPane(wxWindow* window);
/**
Returns an array of all panes managed by the frame manager.
*/
wxAuiPaneInfoArray& GetAllPanes();
/**
Returns the current art provider being used.
@see wxAuiDockArt.
*/
wxAuiDockArt* GetArtProvider() const;
/**
Returns the current dock constraint values.
See SetDockSizeConstraint() for more information.
*/
void GetDockSizeConstraint(double* widthpct, double* heightpct) const;
/**
Returns the current manager's flags.
*/
unsigned int GetFlags() const;
/**
Returns the frame currently being managed by wxAuiManager.
*/
wxWindow* GetManagedWindow() const;
/**
Calling this method will return the wxAuiManager for a given window.
The @a window parameter should specify any child window or sub-child
window of the frame or window managed by wxAuiManager.
The @a window parameter need not be managed by the manager itself, nor does it
even need to be a child or sub-child of a managed window. It must however
be inside the window hierarchy underneath the managed window.
*/
static wxAuiManager* GetManager(wxWindow* window);
//@{
/**
GetPane() is used to lookup a wxAuiPaneInfo object either by window pointer
or by pane name, which acts as a unique id for a window pane.
The returned wxAuiPaneInfo object may then be modified to change a pane's
look, state or position. After one or more modifications to wxAuiPaneInfo,
wxAuiManager::Update() should be called to commit the changes to the user
interface. If the lookup failed (meaning the pane could not be found in the
manager), a call to the returned wxAuiPaneInfo's IsOk() method will return @false.
*/
wxAuiPaneInfo GetPane(wxWindow* window);
wxAuiPaneInfo GetPane(const wxString& name);
//@}
/**
HideHint() hides any docking hint that may be visible.
*/
virtual void HideHint();
/**
This method is used to insert either a previously unmanaged pane window
into the frame manager, or to insert a currently managed pane somewhere
else. InsertPane() will push all panes, rows, or docks aside and
insert the window into the position specified by @a insert_location.
Because @a insert_location can specify either a pane, dock row, or dock
layer, the @a insert_level parameter is used to disambiguate this.
The parameter @a insert_level can take a value of wxAUI_INSERT_PANE,
wxAUI_INSERT_ROW or wxAUI_INSERT_DOCK.
*/
bool InsertPane(wxWindow* window,
const wxAuiPaneInfo& insert_location,
int insert_level = wxAUI_INSERT_PANE);
/**
LoadPaneInfo() is similar to to LoadPerspective, with the exception that it
only loads information about a single pane. It is used in combination with
SavePaneInfo().
*/
void LoadPaneInfo(wxString pane_part, wxAuiPaneInfo& pane);
/**
Loads a saved perspective. If update is @true, wxAuiManager::Update()
is automatically invoked, thus realizing the saved perspective on screen.
*/
bool LoadPerspective(const wxString& perspective,
bool update = true);
/**
SavePaneInfo() is similar to SavePerspective, with the exception that it only
saves information about a single pane. It is used in combination with
LoadPaneInfo().
*/
wxString SavePaneInfo(wxAuiPaneInfo& pane);
/**
Saves the entire user interface layout into an encoded wxString, which
can then be stored by the application (probably using wxConfig).
When a perspective is restored using LoadPerspective(), the entire user
interface will return to the state it was when the perspective was saved.
*/
wxString SavePerspective();
/**
Instructs wxAuiManager to use art provider specified by parameter
@a art_provider for all drawing calls.
This allows plugable look-and-feel features. The previous art provider object,
if any, will be deleted by wxAuiManager.
@see wxAuiDockArt.
*/
void SetArtProvider(wxAuiDockArt* art_provider);
/**
When a user creates a new dock by dragging a window into a docked position,
often times the large size of the window will create a dock that is unwieldly
large. wxAuiManager by default limits the size of any new dock to 1/3 of the
window size. For horizontal docks, this would be 1/3 of the window height.
For vertical docks, 1/3 of the width.
Calling this function will adjust this constraint value. The numbers must be
between 0.0 and 1.0. For instance, calling SetDockSizeContraint with
0.5, 0.5 will cause new docks to be limited to half of the size of the
entire managed window.
*/
void SetDockSizeConstraint(double widthpct, double heightpct);
/**
This method is used to specify wxAuiManager's settings flags. @a flags
specifies options which allow the frame management behavior to be modified.
*/
void SetFlags(unsigned int flags);
/**
Called to specify the frame or window which is to be managed by wxAuiManager.
Frame management is not restricted to just frames. Child windows or custom
controls are also allowed.
*/
void SetManagedWindow(wxWindow* managed_wnd);
/**
This function is used by controls to explicitly show a hint window at the
specified rectangle. It is rarely called, and is mostly used by controls
implementing custom pane drag/drop behaviour.
The specified rectangle should be in screen coordinates.
*/
virtual void ShowHint(const wxRect& rect);
/**
Uninitializes the framework and should be called before a managed frame or
window is destroyed. UnInit() is usually called in the managed wxFrame's
destructor. It is necessary to call this function before the managed frame
or window is destroyed, otherwise the manager cannot remove its custom event
handlers from a window.
*/
void UnInit();
/**
This method is called after any number of changes are
made to any of the managed panes. Update() must be invoked after
AddPane() or InsertPane() are called in order to "realize" or "commit"
the changes. In addition, any number of changes may be made to
wxAuiPaneInfo structures (retrieved with wxAuiManager::GetPane), but to
realize the changes, Update() must be called. This construction allows
pane flicker to be avoided by updating the whole layout at one time.
*/
void Update();
protected:
/**
ProcessDockResult() is a protected member of the wxAUI layout manager.
It can be overridden by derived classes to provide custom docking calculations.
*/
virtual bool ProcessDockResult(wxAuiPaneInfo& target,
const wxAuiPaneInfo& new_pos);
};
/**
@class wxAuiPaneInfo
@headerfile aui.h wx/aui/aui.h
wxAuiPaneInfo is part of the wxAUI class framework.
See also @ref overview_aui.
wxAuiPaneInfo specifies all the parameters for a pane.
These parameters specify where the pane is on the screen, whether it is docked
or floating, or hidden.
In addition, these parameters specify the pane's docked position, floating
position, preferred size, minimum size, caption text among many other parameters.
@library{wxbase}
@category{aui}
@see wxAuiManager, wxAuiDockArt
*/
class wxAuiPaneInfo
{
public:
wxAuiPaneInfo();
/**
Copy constructor.
*/
wxAuiPaneInfo(const wxAuiPaneInfo& c);
//@{
/**
BestSize() sets the ideal size for the pane. The docking manager will attempt
to use this size as much as possible when docking or floating the pane.
*/
wxAuiPaneInfo BestSize(const wxSize& size);
wxAuiPaneInfo BestSize(int x, int y);
//@}
/**
Bottom() sets the pane dock position to the bottom side of the frame. This is
the same thing as calling Direction(wxAUI_DOCK_BOTTOM).
*/
wxAuiPaneInfo& Bottom();
/**
BottomDockable() indicates whether a pane can be docked at the bottom of the
frame.
*/
wxAuiPaneInfo& BottomDockable(bool b = true);
/**
Caption() sets the caption of the pane.
*/
wxAuiPaneInfo& Caption(const wxString& c);
/**
CaptionVisible indicates that a pane caption should be visible. If @false, no
pane caption is drawn.
*/
wxAuiPaneInfo& CaptionVisible(bool visible = true);
//@{
/**
Center() sets the pane dock position to the left side of the frame.
The centre pane is the space in the middle after all border panes (left, top,
right, bottom) are subtracted from the layout.
This is the same thing as calling Direction(wxAUI_DOCK_CENTRE).
*/
wxAuiPaneInfo Centre();
wxAuiPaneInfo Center();
//@}
//@{
/**
CentrePane() specifies that the pane should adopt the default center pane
settings. Centre panes usually do not have caption bars.
This function provides an easy way of preparing a pane to be displayed in
the center dock position.
*/
wxAuiPaneInfo CentrePane();
wxAuiPaneInfo CenterPane();
//@}
/**
CloseButton() indicates that a close button should be drawn for the pane.
*/
wxAuiPaneInfo& CloseButton(bool visible = true);
/**
DefaultPane() specifies that the pane should adopt the default pane settings.
*/
wxAuiPaneInfo& DefaultPane();
/**
DestroyOnClose() indicates whether a pane should be detroyed when it is closed.
Normally a pane is simply hidden when the close button is clicked.
Setting DestroyOnClose to @true will cause the window to be destroyed when
the user clicks the pane's close button.
*/
wxAuiPaneInfo& DestroyOnClose(bool b = true);
/**
Direction() determines the direction of the docked pane. It is functionally the
same as calling Left(), Right(), Top() or Bottom(), except that docking direction
may be specified programmatically via the parameter.
*/
wxAuiPaneInfo& Direction(int direction);
/**
Dock() indicates that a pane should be docked. It is the opposite of Float().
*/
wxAuiPaneInfo& Dock();
/**
DockFixed() causes the containing dock to have no resize sash. This is useful
for creating panes that span the entire width or height of a dock, but should
not be resizable in the other direction.
*/
wxAuiPaneInfo& DockFixed(bool b = true);
/**
Dockable() specifies whether a frame can be docked or not. It is the same as
specifying TopDockable(b).BottomDockable(b).LeftDockable(b).RightDockable(b).
*/
wxAuiPaneInfo& Dockable(bool b = true);
/**
Fixed() forces a pane to be fixed size so that it cannot be resized. After
calling Fixed(), IsFixed() will return @true.
*/
wxAuiPaneInfo& Fixed();
/**
Float() indicates that a pane should be floated. It is the opposite of Dock().
*/
wxAuiPaneInfo& Float();
/**
Floatable() sets whether the user will be able to undock a pane and turn it
into a floating window.
*/
wxAuiPaneInfo& Floatable(bool b = true);
//@{
/**
FloatingPosition() sets the position of the floating pane.
*/
wxAuiPaneInfo FloatingPosition(const wxPoint& pos);
wxAuiPaneInfo FloatingPosition(int x, int y);
//@}
//@{
/**
FloatingSize() sets the size of the floating pane.
*/
wxAuiPaneInfo FloatingSize(const wxSize& size);
wxAuiPaneInfo FloatingSize(int x, int y);
//@}
/**
Gripper() indicates that a gripper should be drawn for the pane.
*/
wxAuiPaneInfo& Gripper(bool visible = true);
/**
GripperTop() indicates that a gripper should be drawn at the top of the pane.
*/
wxAuiPaneInfo& GripperTop(bool attop = true);
/**
HasBorder() returns @true if the pane displays a border.
*/
bool HasBorder() const;
/**
HasCaption() returns @true if the pane displays a caption.
*/
bool HasCaption() const;
/**
HasCloseButton() returns @true if the pane displays a button to close the pane.
*/
bool HasCloseButton() const;
/**
HasFlag() returns @true if the the property specified by flag is active for the
pane.
*/
bool HasFlag(unsigned int flag) const;
/**
HasGripper() returns @true if the pane displays a gripper.
*/
bool HasGripper() const;
/**
HasGripper() returns @true if the pane displays a gripper at the top.
*/
bool HasGripperTop() const;
/**
HasMaximizeButton() returns @true if the pane displays a button to maximize the
pane.
*/
bool HasMaximizeButton() const;
/**
HasMinimizeButton() returns @true if the pane displays a button to minimize the
pane.
*/
bool HasMinimizeButton() const;
/**
HasPinButton() returns @true if the pane displays a button to float the pane.
*/
bool HasPinButton() const;
/**
Hide() indicates that a pane should be hidden.
*/
wxAuiPaneInfo& Hide();
/**
IsBottomDockable() returns @true if the pane can be docked at the bottom of the
managed frame.
*/
bool IsBottomDockable() const;
/**
IsDocked() returns @true if the pane is docked.
*/
bool IsDocked() const;
/**
IsFixed() returns @true if the pane cannot be resized.
*/
bool IsFixed() const;
/**
IsFloatable() returns @true if the pane can be undocked and displayed as a
floating window.
*/
bool IsFloatable() const;
/**
IsFloating() returns @true if the pane is floating.
*/
bool IsFloating() const;
/**
IsLeftDockable() returns @true if the pane can be docked on the left of the
managed frame.
*/
bool IsLeftDockable() const;
/**
IsMoveable() returns @true if the docked frame can be undocked or moved to
another dock position.
*/
bool IsMovable() const;
/**
IsOk() returns @true if the wxAuiPaneInfo structure is valid. A pane structure
is valid if it has an associated window.
*/
bool IsOk() const;
/**
IsResizable() returns @true if the pane can be resized.
*/
bool IsResizable() const;
/**
IsRightDockable() returns @true if the pane can be docked on the right of the
managed frame.
*/
bool IsRightDockable() const;
/**
IsShown() returns @true if the pane is currently shown.
*/
bool IsShown() const;
/**
IsToolbar() returns @true if the pane contains a toolbar.
*/
bool IsToolbar() const;
/**
IsTopDockable() returns @true if the pane can be docked at the top of the
managed frame.
*/
bool IsTopDockable() const;
/**
Layer() determines the layer of the docked pane. The dock layer is similar to
an onion, the inner-most layer being layer 0. Each shell moving in the outward
direction has a higher layer number. This allows for more complex docking layout
formation.
*/
wxAuiPaneInfo& Layer(int layer);
/**
Left() sets the pane dock position to the left side of the frame. This is the
same thing as calling Direction(wxAUI_DOCK_LEFT).
*/
wxAuiPaneInfo& Left();
/**
LeftDockable() indicates whether a pane can be docked on the left of the frame.
*/
wxAuiPaneInfo& LeftDockable(bool b = true);
//@{
/**
MaxSize() sets the maximum size of the pane.
*/
wxAuiPaneInfo MaxSize(const wxSize& size);
wxAuiPaneInfo MaxSize(int x, int y);
//@}
/**
MaximizeButton() indicates that a maximize button should be drawn for the pane.
*/
wxAuiPaneInfo& MaximizeButton(bool visible = true);
//@{
/**
MinSize() sets the minimum size of the pane. Please note that this is only
partially supported as of this writing.
*/
wxAuiPaneInfo MinSize(const wxSize& size);
wxAuiPaneInfo MinSize(int x, int y);
//@}
/**
MinimizeButton() indicates that a minimize button should be drawn for the pane.
*/
wxAuiPaneInfo& MinimizeButton(bool visible = true);
/**
Movable indicates whether a frame can be moved.
*/
wxAuiPaneInfo& Movable(bool b = true);
/**
Name() sets the name of the pane so it can be referenced in lookup functions.
If a name is not specified by the user, a random name is assigned to the pane
when it is added to the manager.
*/
wxAuiPaneInfo& Name(const wxString& n);
/**
PaneBorder indicates that a border should be drawn for the pane.
*/
wxAuiPaneInfo& PaneBorder(bool visible = true);
/**
PinButton() indicates that a pin button should be drawn for the pane.
*/
wxAuiPaneInfo& PinButton(bool visible = true);
/**
Position() determines the position of the docked pane.
*/
wxAuiPaneInfo& Position(int pos);
/**
Resizable() allows a pane to be resized if the parameter is @true, and forces it
to be a fixed size if the parameter is @false. This is simply an antonym for Fixed().
*/
wxAuiPaneInfo& Resizable(bool resizable = true);
/**
Right() sets the pane dock position to the right side of the frame.
*/
wxAuiPaneInfo& Right();
/**
RightDockable() indicates whether a pane can be docked on the right of the
frame.
*/
wxAuiPaneInfo& RightDockable(bool b = true);
/**
Row() determines the row of the docked pane.
*/
wxAuiPaneInfo& Row(int row);
/**
Write the safe parts of a newly loaded PaneInfo structure "source" into "this"
used on loading perspectives etc.
*/
void SafeSet(wxAuiPaneInfo source);
/**
SetFlag() turns the property given by flag on or off with the option_state
parameter.
*/
wxAuiPaneInfo& SetFlag(unsigned int flag, bool option_state);
/**
Show() indicates that a pane should be shown.
*/
wxAuiPaneInfo& Show(bool show = true);
/**
ToolbarPane() specifies that the pane should adopt the default toolbar pane
settings.
*/
wxAuiPaneInfo& ToolbarPane();
/**
Top() sets the pane dock position to the top of the frame.
*/
wxAuiPaneInfo& Top();
/**
TopDockable() indicates whether a pane can be docked at the top of the frame.
*/
wxAuiPaneInfo& TopDockable(bool b = true);
/**
Window() assigns the window pointer that the wxAuiPaneInfo should use.
This normally does not need to be specified, as the window pointer is
automatically assigned to the wxAuiPaneInfo structure as soon as it is added
to the manager.
*/
wxAuiPaneInfo& Window(wxWindow* w);
/**
Makes a copy of the wxAuiPaneInfo object.
*/
wxAuiPaneInfo& operator=(const wxAuiPaneInfo& c);
};

166
interface/wx/base64.h Normal file
View File

@@ -0,0 +1,166 @@
/////////////////////////////////////////////////////////////////////////////
// Name: base64.h
// Purpose: interface of global functions
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
// ============================================================================
// Global functions/macros
// ============================================================================
/** @ingroup group_funcmacro_misc */
//@{
/**
This function encodes the given data using base64.
To allocate the buffer of the correct size, use wxBase64EncodedSize() or
call this function with @a dst set to @NULL -- it will then return the
necessary buffer size.
This raw encoding function overload writes the output string into the
provided buffer; the other overloads return it as a wxString.
@param dst
The output buffer, may be @NULL to retrieve the needed buffer size.
@param dstLen
The output buffer size, ignored if dst is @NULL.
@param src
The input buffer, must not be @NULL.
@param srcLen
The length of the input data.
@return @c wxCONV_FAILED if the output buffer is too small.
@header{wx/base64.h}
*/
size_t wxBase64Encode(char* dst, size_t dstLen,
const void* src,
size_t srcLen);
/**
This function encodes the given data using base64 and returns the output as
a wxString.
There is no error return.
To allocate the buffer of the correct size, use wxBase64EncodedSize() or
call this function with @a dst set to @NULL -- it will then return the
necessary buffer size.
@param src
The input buffer, must not be @NULL.
@param srcLen
The length of the input data.
@header{wx/base64.h}
*/
wxString wxBase64Encode(const void* src, size_t srcLen);
/**
This function encodes the given data using base64 and returns the output as
a wxString.
There is no error return.
@header{wx/base64.h}
*/
wxString wxBase64Encode(const wxMemoryBuffer& buf);
/**
Returns the size of the buffer necessary to contain the data encoded in a
base64 string of length @e srcLen. This can be useful for allocating a
buffer to be passed to wxBase64Decode().
@header{wx/base64.h}
*/
size_t wxBase64DecodedSize(size_t srcLen);
/**
Returns the length of the string with base64 representation of a buffer of
specified size @e len. This can be useful for allocating the buffer passed
to wxBase64Encode().
@header{wx/base64.h}
*/
size_t wxBase64EncodedSize(size_t len);
/**
This function decodes a Base64-encoded string.
This overload is a raw decoding function and decodes the data into the
provided buffer @a dst of the given size @e dstLen. An error is returned if
the buffer is not large enough -- that is not at least
wxBase64DecodedSize(srcLen) bytes.
This overload returns the number of bytes written to the buffer or the
necessary buffer size if @a dst was @NULL or @c wxCONV_FAILED on error,
e.g. if the output buffer is too small or invalid characters were
encountered in the input string.
@param dst
Pointer to output buffer, may be @NULL to just compute the necessary
buffer size.
@param dstLen
The size of the output buffer, ignored if dst is @NULL.
@param src
The input string, must not be @NULL. For the version using wxString,
the input string should contain only ASCII characters.
@param srcLen
The length of the input string or special value wxNO_LEN if the string
is @NULL-terminated and the length should be computed by this function
itself.
@param mode
This parameter specifies the function behaviour when invalid characters
are encountered in input. By default, any such character stops the
decoding with error. If the mode is wxBase64DecodeMode_SkipWS, then the
white space characters are silently skipped instead. And if it is
wxBase64DecodeMode_Relaxed, then all invalid characters are skipped.
@param posErr
If this pointer is non-@NULL and an error occurs during decoding, it is
filled with the index of the invalid character.
@header{wx/base64.h}
*/
size_t wxBase64Decode(void* dst, size_t dstLen,
const char* src,
size_t srcLen = wxNO_LEN,
wxBase64DecodeMode mode = wxBase64DecodeMode_Strict,
size_t posErr = NULL);
/**
See the wxBase64Decode(void*,size_t,const char*,size_t,wxBase64DecodeMode,size_t)
overload for more info about the parameters of this function.
This overload allocates memory internally and returns it as wxMemoryBuffer
and is recommended for normal use.
This overload returns a buffer with the base64 decoded binary equivalent
of the input string. In neither case is the buffer @NULL-terminated.
@header{wx/base64.h}
*/
wxMemoryBuffer wxBase64Decode(const char* src,
size_t srcLen = wxNO_LEN,
wxBase64DecodeMode mode = wxBase64DecodeMode_Strict,
size_t posErr = NULL);
/**
See the wxBase64Decode(void*,size_t,const char*,size_t,wxBase64DecodeMode,size_t)
overload for more info about the parameters of this function.
This overload takes as input a wxString and returns the internally-allocated
memory as a wxMemoryBuffer, containing the base64 decoded data.
@header{wx/base64.h}
*/
wxMemoryBuffer wxBase64Decode(const wxString& src,
wxBase64DecodeMode mode = wxBase64DecodeMode_Strict,
size_t posErr = NULL);
//@}

687
interface/wx/bitmap.h Normal file
View File

@@ -0,0 +1,687 @@
/////////////////////////////////////////////////////////////////////////////
// Name: bitmap.h
// Purpose: interface of wxBitmap* classes
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
In wxBitmap and wxBitmapHandler context this value means: "use the screen depth".
*/
#define wxBITMAP_SCREEN_DEPTH (-1)
/**
@class wxBitmapHandler
@wxheader{bitmap.h}
This is the base class for implementing bitmap file loading/saving, and
bitmap creation from data.
It is used within wxBitmap and is not normally seen by the application.
If you wish to extend the capabilities of wxBitmap, derive a class from
wxBitmapHandler and add the handler using wxBitmap::AddHandler() in your
application initialisation.
@library{wxcore}
@category{misc}
@see @ref overview_bitmap, wxBitmap, wxIcon, wxCursor
*/
class wxBitmapHandler : public wxObject
{
public:
/**
Default constructor.
In your own default constructor, initialise the members m_name,
m_extension and m_type.
*/
wxBitmapHandler();
/**
Destroys the wxBitmapHandler object.
*/
virtual ~wxBitmapHandler();
/**
Creates a bitmap from the given data, which can be of arbitrary type.
The wxBitmap object @a bitmap is manipulated by this function.
@param bitmap
The wxBitmap object.
@param width
The width of the bitmap in pixels.
@param height
The height of the bitmap in pixels.
@param depth
The depth of the bitmap in pixels.
If this is ::wxBITMAP_SCREEN_DEPTH, the screen depth is used.
@param data
Data whose type depends on the value of type.
@param type
A bitmap type identifier - see ::wxBitmapType for a list
of possible values.
@return @true if the call succeeded, @false otherwise (the default).
*/
virtual bool Create(wxBitmap* bitmap, const void* data, wxBitmapType type,
int width, int height, int depth = 1);
/**
Gets the file extension associated with this handler.
*/
const wxString& GetExtension() const;
/**
Gets the name of this handler.
*/
const wxString& GetName() const;
/**
Gets the bitmap type associated with this handler.
*/
wxBitmapType GetType() const;
/**
Loads a bitmap from a file or resource, putting the resulting data into
@a bitmap.
@param bitmap
The bitmap object which is to be affected by this operation.
@param name
Either a filename or a Windows resource name.
The meaning of name is determined by the type parameter.
@param type
See ::wxBitmapType for values this can take.
@param desiredWidth
The desired width for the loaded bitmap.
@param desiredHeight
The desired height for the loaded bitmap.
@return @true if the operation succeeded, @false otherwise.
@see wxBitmap::LoadFile, wxBitmap::SaveFile, SaveFile()
*/
virtual bool LoadFile(wxBitmap* bitmap, const wxString& name, wxBitmapType type,
int desiredWidth, int desiredHeight);
/**
Saves a bitmap in the named file.
@param bitmap
The bitmap object which is to be affected by this operation.
@param name
A filename. The meaning of name is determined by the type parameter.
@param type
See ::wxBitmapType for values this can take.
@param palette
An optional palette used for saving the bitmap.
@return @true if the operation succeeded, @false otherwise.
@see wxBitmap::LoadFile, wxBitmap::SaveFile, LoadFile()
*/
virtual bool SaveFile(const wxBitmap* bitmap, const wxString& name, wxBitmapType type,
const wxPalette* palette = NULL) const;
/**
Sets the handler extension.
@param extension
Handler extension.
*/
void SetExtension(const wxString& extension);
/**
Sets the handler name.
@param name
Handler name.
*/
void SetName(const wxString& name);
/**
Sets the handler type.
@param type
Handler type.
*/
void SetType(wxBitmapType type);
};
/**
@class wxBitmap
@wxheader{bitmap.h}
This class encapsulates the concept of a platform-dependent bitmap,
either monochrome or colour or colour with alpha channel support.
If you need direct access the bitmap data instead going through
drawing to it using wxMemoryDC you need to use the wxPixelData
class (either wxNativePixelData for RGB bitmaps or wxAlphaPixelData
for bitmaps with an additionaly alpha channel).
@note
Many wxBitmap functions take a @e type parameter, which is a value of the
::wxBitmapType enumeration.
The validity of those values depends however on the platform where your program
is running and from the wxWidgets configuration.
If all possible wxWidgets settings are used, the Windows platform supports BMP file,
BMP resource, XPM data, and XPM.
Under wxGTK, the available formats are BMP file, XPM data, XPM file, and PNG file.
Under wxMotif, the available formats are XBM data, XBM file, XPM data, XPM file.
In addition, wxBitmap can load and save all formats that wxImage; see wxImage for
more info. Of course, you must have wxImage handlers loaded.
@library{wxcore}
@category{gdi}
@stdobjects
::wxNullBitmap
@see @ref overview_bitmap, @ref overview_bitmap_supportedformats,
wxDC::Blit, wxIcon, wxCursor, wxMemoryDC, wxImage, wxPixelData
*/
class wxBitmap : public wxGDIObject
{
public:
/**
Default constructor.
Constructs a bitmap object with no data; an assignment or another member
function such as Create() or LoadFile() must be called subsequently.
*/
wxBitmap();
/**
Copy constructor, uses @ref overview_refcount "reference counting".
To make a real copy, you can use:
@code
wxBitmap newBitmap = oldBitmap.GetSubBitmap(
wxRect(0, 0, oldBitmap.GetWidth(), oldBitmap.GetHeight()));
@endcode
*/
wxBitmap(const wxBitmap& bitmap);
/*
Creates a bitmap from the given @a data which is interpreted in
platform-dependent manner.
@param data
Specifies the bitmap data in a platform-dependent format.
@param type
May be one of the ::wxBitmapType values and indicates which type of
bitmap does @a data contains. See the note in the class
detailed description.
@param width
Specifies the width of the bitmap.
@param height
Specifies the height of the bitmap.
@param depth
Specifies the depth of the bitmap.
If this is omitted, the display depth of the screen is used.
wxBitmap(const void* data, int type, int width, int height, int depth = -1);
NOTE: this ctor is not implemented by all ports, is somewhat useless
without further description of the "data" supported formats and
uses 'int type' instead of wxBitmapType, so don't document it.
*/
/**
Creates a bitmap from the given array @a bits.
You should only use this function for monochrome bitmaps (depth 1) in
portable programs: in this case the bits parameter should contain an XBM image.
For other bit depths, the behaviour is platform dependent: under Windows,
the data is passed without any changes to the underlying CreateBitmap() API.
Under other platforms, only monochrome bitmaps may be created using this
constructor and wxImage should be used for creating colour bitmaps from
static data.
@param bits
Specifies an array of pixel values.
@param width
Specifies the width of the bitmap.
@param height
Specifies the height of the bitmap.
@param depth
Specifies the depth of the bitmap.
If this is omitted, then a value of 1 (monochrome bitmap) is used.
*/
wxBitmap(const char bits[], int width, int height, int depth = 1);
/**
Creates a new bitmap. A depth of ::wxBITMAP_SCREEN_DEPTH indicates the
depth of the current screen or visual.
Some platforms only support 1 for monochrome and ::wxBITMAP_SCREEN_DEPTH for
the current colour setting.
A depth of 32 including an alpha channel is supported under MSW, Mac and GTK+.
*/
wxBitmap(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH);
/**
Creates a bitmap from XPM data.
*/
wxBitmap(const char* const* bits);
/**
Loads a bitmap from a file or resource.
@param name
This can refer to a resource name or a filename under MS Windows and X.
Its meaning is determined by the @a type parameter.
@param type
May be one of the ::wxBitmapType values and indicates which type of
bitmap should be loaded. See the note in the class detailed description.
@see LoadFile()
*/
wxBitmap(const wxString& name, wxBitmapType type = wxBITMAP_TYPE_XPM);
/**
Creates this bitmap object from the given image.
This has to be done to actually display an image as you cannot draw an
image directly on a window.
The resulting bitmap will use the provided colour depth (or that of the
current system if depth is ::wxBITMAP_SCREEN_DEPTH) which entails that a
colour reduction may take place.
When in 8-bit mode (PseudoColour mode), the GTK port will use a color cube
created on program start-up to look up colors. This ensures a very fast conversion,
but the image quality won't be perfect (and could be better for photo images using
more sophisticated dithering algorithms).
On Windows, if there is a palette present (set with SetPalette), it will be
used when creating the wxBitmap (most useful in 8-bit display mode).
On other platforms, the palette is currently ignored.
@param img
Platform-independent wxImage object.
@param depth
Specifies the depth of the bitmap.
If this is omitted, the display depth of the screen is used.
*/
wxBitmap(const wxImage& img, int depth = wxBITMAP_SCREEN_DEPTH);
/**
Destructor.
See @ref overview_refcount_destruct for more info.
If the application omits to delete the bitmap explicitly, the bitmap will be
destroyed automatically by wxWidgets when the application exits.
@warning
Do not delete a bitmap that is selected into a memory device context.
*/
virtual ~wxBitmap();
/**
Adds a handler to the end of the static list of format handlers.
@param handler
A new bitmap format handler object. There is usually only one instance
of a given handler class in an application session.
@see wxBitmapHandler
*/
static void AddHandler(wxBitmapHandler* handler);
/**
Deletes all bitmap handlers.
This function is called by wxWidgets on exit.
*/
static void CleanUpHandlers();
/**
Creates an image from a platform-dependent bitmap. This preserves
mask information so that bitmaps and images can be converted back
and forth without loss in that respect.
*/
virtual wxImage ConvertToImage() const;
/**
Creates the bitmap from an icon.
*/
virtual bool CopyFromIcon(const wxIcon& icon);
/**
Creates a fresh bitmap.
If the final argument is omitted, the display depth of the screen is used.
This overload works on all platforms.
*/
virtual bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH);
/*
Creates a bitmap from the given data, which can be of arbitrary type.
@param data
Data whose type depends on the value of type.
@param type
A bitmap type identifier; see ::wxBitmapType for the list of values.
See the note in the class detailed description for more info.
@param width
The width of the bitmap in pixels.
@param height
The height of the bitmap in pixels.
@param depth
The depth of the bitmap in pixels. If this is -1, the screen depth is used.
@return @true if the call succeeded, @false otherwise.
This overload depends on the @a type of data.
virtual bool Create(const void* data, int type, int width,
int height, int depth = -1);
NOTE: leave this undoc for the same reason of the relative ctor.
*/
/**
Finds the handler with the given @a name.
@return A pointer to the handler if found, @NULL otherwise.
*/
static wxBitmapHandler* FindHandler(const wxString& name);
/**
Finds the handler associated with the given @a extension and @a type.
@param extension
The file extension, such as "bmp" (without the dot).
@param bitmapType
The bitmap type managed by the handler, see ::wxBitmapType.
@return A pointer to the handler if found, @NULL otherwise.
*/
static wxBitmapHandler* FindHandler(const wxString& extension,
wxBitmapType bitmapType);
/**
Finds the handler associated with the given bitmap type.
@param bitmapType
The bitmap type managed by the handler, see ::wxBitmapType.
@return A pointer to the handler if found, @NULL otherwise.
@see wxBitmapHandler
*/
static wxBitmapHandler* FindHandler(wxBitmapType bitmapType);
/**
Gets the colour depth of the bitmap.
A value of 1 indicates a monochrome bitmap.
*/
virtual int GetDepth() const;
/**
Returns the static list of bitmap format handlers.
@see wxBitmapHandler
*/
static wxList GetHandlers();
/**
Gets the height of the bitmap in pixels.
*/
virtual int GetHeight() const;
/**
Gets the associated mask (if any) which may have been loaded from a file
or set for the bitmap.
@see SetMask(), wxMask
*/
virtual wxMask* GetMask() const;
/**
Gets the associated palette (if any) which may have been loaded from a file
or set for the bitmap.
@see wxPalette
*/
virtual wxPalette* GetPalette() const;
/**
Returns a sub bitmap of the current one as long as the rect belongs entirely to
the bitmap. This function preserves bit depth and mask information.
*/
virtual wxBitmap GetSubBitmap(const wxRect& rect) const;
/**
Gets the width of the bitmap in pixels.
@see GetHeight()
*/
virtual int GetWidth() const;
/**
Adds the standard bitmap format handlers, which, depending on wxWidgets
configuration, can be handlers for Windows bitmap, Windows bitmap resource,
and XPM.
This function is called by wxWidgets on startup.
@see wxBitmapHandler
*/
static void InitStandardHandlers();
/**
Adds a handler at the start of the static list of format handlers.
@param handler
A new bitmap format handler object. There is usually only one instance
of a given handler class in an application session.
@see wxBitmapHandler
*/
static void InsertHandler(wxBitmapHandler* handler);
/**
Returns @true if bitmap data is present.
*/
bool IsOk() const;
/**
Loads a bitmap from a file or resource.
@param name
Either a filename or a Windows resource name.
The meaning of name is determined by the @a type parameter.
@param type
One of the ::wxBitmapType values; see the note in the class
detailed description.
@return @true if the operation succeeded, @false otherwise.
@remarks A palette may be associated with the bitmap if one exists
(especially for colour Windows bitmaps), and if the
code supports it. You can check if one has been created
by using the GetPalette() member.
@see SaveFile()
*/
virtual bool LoadFile(const wxString& name, wxBitmapType type);
/**
Finds the handler with the given name, and removes it.
The handler is not deleted.
@param name
The handler name.
@return @true if the handler was found and removed, @false otherwise.
@see wxBitmapHandler
*/
static bool RemoveHandler(const wxString& name);
/**
Saves a bitmap in the named file.
@param name
A filename. The meaning of name is determined by the type parameter.
@param type
One of the ::wxBitmapType values; see the note in the class
detailed description.
@param palette
An optional palette used for saving the bitmap.
@return @true if the operation succeeded, @false otherwise.
@remarks Depending on how wxWidgets has been configured, not all formats
may be available.
@see LoadFile()
*/
virtual bool SaveFile(const wxString& name, wxBitmapType type,
const wxPalette* palette = NULL) const;
/**
Sets the depth member (does not affect the bitmap data).
@todo since these functions do not affect the bitmap data,
why they exist??
@param depth
Bitmap depth.
*/
virtual void SetDepth(int depth);
/**
Sets the height member (does not affect the bitmap data).
@param height
Bitmap height in pixels.
*/
virtual void SetHeight(int height);
/**
Sets the mask for this bitmap.
@remarks The bitmap object owns the mask once this has been called.
@see GetMask(), wxMask
*/
virtual void SetMask(wxMask* mask);
/**
Sets the associated palette. (Not implemented under GTK+).
@param palette
The palette to set.
@see wxPalette
*/
virtual void SetPalette(const wxPalette& palette);
/**
Sets the width member (does not affect the bitmap data).
@param width
Bitmap width in pixels.
*/
virtual void SetWidth(int width);
};
/**
An empty wxBitmap object.
*/
wxBitmap wxNullBitmap;
/**
@class wxMask
@wxheader{bitmap.h}
This class encapsulates a monochrome mask bitmap, where the masked area is
black and the unmasked area is white.
When associated with a bitmap and drawn in a device context, the unmasked
area of the bitmap will be drawn, and the masked area will not be drawn.
@library{wxcore}
@category{gdi}
@see wxBitmap, wxDC::Blit, wxMemoryDC
*/
class wxMask : public wxObject
{
public:
/**
Default constructor.
*/
wxMask();
/**
Constructs a mask from a bitmap and a palette index that indicates the
background.
Not yet implemented for GTK.
@param bitmap
A valid bitmap.
@param index
Index into a palette, specifying the transparency colour.
*/
wxMask(const wxBitmap& bitmap, int index);
/**
Constructs a mask from a monochrome bitmap.
@beginWxPythonOnly
This is the default constructor for wxMask in wxPython.
@endWxPythonOnly
*/
wxMask(const wxBitmap& bitmap);
/**
Constructs a mask from a bitmap and a colour that indicates the background.
@beginWxPythonOnly
wxPython has an alternate wxMask constructor matching this form called wxMaskColour.
@endWxPythonOnly
*/
wxMask(const wxBitmap& bitmap, const wxColour& colour);
/**
Destroys the wxMask object and the underlying bitmap data.
*/
virtual ~wxMask();
/**
Constructs a mask from a bitmap and a palette index that indicates the
background.
Not yet implemented for GTK.
@param bitmap
A valid bitmap.
@param index
Index into a palette, specifying the transparency colour.
*/
bool Create(const wxBitmap& bitmap, int index);
/**
Constructs a mask from a monochrome bitmap.
*/
bool Create(const wxBitmap& bitmap);
/**
Constructs a mask from a bitmap and a colour that indicates the background.
*/
bool Create(const wxBitmap& bitmap, const wxColour& colour);
};

239
interface/wx/bmpbuttn.h Normal file
View File

@@ -0,0 +1,239 @@
/////////////////////////////////////////////////////////////////////////////
// Name: bmpbuttn.h
// Purpose: interface of wxBitmapButton
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxBitmapButton
@wxheader{bmpbuttn.h}
A bitmap button is a control that contains a bitmap.
It may be placed on a wxDialog or a wxPanel, or indeed almost any other window.
@remarks
A bitmap button can be supplied with a single bitmap, and wxWidgets will draw
all button states using this bitmap. If the application needs more control,
additional bitmaps for the selected state, unpressed focused state, and greyed-out
state may be supplied.
@section wxbitmapbutton_states Button states
This class supports bitmaps for several different states:
@li @b normal: this is the bitmap shown in the default state, it must be always
valid while all the other bitmaps are optional and don't have to be set.
@li @b disabled: bitmap shown when the button is disabled.
@li @b selected: bitmap shown when the button is pushed (e.g. while the user
keeps the mouse button pressed on it)
@li @b focus: bitmap shown when the button has keyboard focus but is not pressed.
@li @b hover: bitmap shown when the mouse is over the button (but it is not pressed).
Notice that if hover bitmap is not specified but the current platform UI uses
hover images for the buttons (such as Windows XP or GTK+), then the focus bitmap
is used for hover state as well. This makes it possible to set focus bitmap only
to get reasonably good behaviour on all platforms.
@beginStyleTable
@style{wxBU_AUTODRAW}
If this is specified, the button will be drawn automatically using
the label bitmap only, providing a 3D-look border. If this style is
not specified, the button will be drawn without borders and using
all provided bitmaps. Has effect only under MS Windows.
@style{wxBU_LEFT}
Left-justifies the bitmap label. Has effect only under MS Windows.
@style{wxBU_TOP}
Aligns the bitmap label to the top of the button.
Has effect only under MS Windows.
@style{wxBU_RIGHT}
Right-justifies the bitmap label. Has effect only under MS Windows.
@style{wxBU_BOTTOM}
Aligns the bitmap label to the bottom of the button.
Has effect only under MS Windows.
@endStyleTable
Note that the wxBU_EXACTFIT style supported by wxButton is not used by this
class as bitmap buttons don't have any minimal standard size by default.
@beginEventTable{wxCommandEvent}
@event{EVT_BUTTON(id, func)}
Process a wxEVT_COMMAND_BUTTON_CLICKED event, when the button is clicked.
@endEventTable
@library{wxcore}
@category{ctrl}
<!-- @appearance{bitmapbutton.png} -->
@see wxButton
*/
class wxBitmapButton : public wxButton
{
public:
/**
Default ctor.
*/
wxBitmapButton();
/**
Constructor, creating and showing a button.
@param parent
Parent window. Must not be @NULL.
@param id
Button identifier. The value wxID_ANY indicates a default value.
@param bitmap
Bitmap to be displayed.
@param pos
Button position.
@param size
Button size. If wxDefaultSize is specified then the button is sized
appropriately for the bitmap.
@param style
Window style. See wxBitmapButton.
@param validator
Window validator.
@param name
Window name.
@remarks The bitmap parameter is normally the only bitmap you need to provide,
and wxWidgets will draw the button correctly in its different states.
If you want more control, call any of the functions SetBitmapSelected(),
SetBitmapFocus(), SetBitmapDisabled().
@see Create(), wxValidator
*/
wxBitmapButton(wxWindow* parent, wxWindowID id,
const wxBitmap& bitmap,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxBU_AUTODRAW,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr);
/**
Destructor, destroying the button.
*/
virtual ~wxBitmapButton();
/**
Button creation function for two-step creation.
For more details, see wxBitmapButton().
*/
bool Create(wxWindow* parent, wxWindowID id,
const wxBitmap& bitmap,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxBU_AUTODRAW,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr);
//@{
/**
Returns the bitmap for the disabled state, which may be invalid.
@return A reference to the disabled state bitmap.
@see SetBitmapDisabled()
*/
const wxBitmap& GetBitmapDisabled() const;
wxBitmap& GetBitmapDisabled();
//@}
//@{
/**
Returns the bitmap for the focused state, which may be invalid.
@return A reference to the focused state bitmap.
@see SetBitmapFocus()
*/
const wxBitmap& GetBitmapFocus() const;
wxBitmap& GetBitmapFocus();
//@}
//@{
/**
Returns the bitmap used when the mouse is over the button, which may be invalid.
@see SetBitmapHover()
*/
const wxBitmap& GetBitmapHover();
wxBitmap& GetBitmapHover();
//@}
//@{
/**
Returns the label bitmap (the one passed to the constructor), always valid.
@return A reference to the button's label bitmap.
@see SetBitmapLabel()
*/
const wxBitmap& GetBitmapLabel();
wxBitmap& GetBitmapLabel();
//@}
/**
Returns the bitmap for the selected state.
@return A reference to the selected state bitmap.
@see SetBitmapSelected()
*/
const wxBitmap& GetBitmapSelected() const;
/**
Sets the bitmap for the disabled button appearance.
@param bitmap
The bitmap to set.
@see GetBitmapDisabled(), SetBitmapLabel(),
SetBitmapSelected(), SetBitmapFocus()
*/
virtual void SetBitmapDisabled(const wxBitmap& bitmap);
/**
Sets the bitmap for the button appearance when it has the keyboard focus.
@param bitmap
The bitmap to set.
@see GetBitmapFocus(), SetBitmapLabel(),
SetBitmapSelected(), SetBitmapDisabled()
*/
virtual void SetBitmapFocus(const wxBitmap& bitmap);
/**
Sets the bitmap to be shown when the mouse is over the button.
@since 2.7.0
The hover bitmap is currently only supported in wxMSW.
@see GetBitmapHover()
*/
virtual void SetBitmapHover(const wxBitmap& bitmap);
/**
Sets the bitmap label for the button.
@param bitmap
The bitmap label to set.
@remarks This is the bitmap used for the unselected state, and for all
other states if no other bitmaps are provided.
@see GetBitmapLabel()
*/
virtual void SetBitmapLabel(const wxBitmap& bitmap);
/**
Sets the bitmap for the selected (depressed) button appearance.
@param bitmap
The bitmap to set.
*/
virtual void SetBitmapSelected(const wxBitmap& bitmap);
};

203
interface/wx/bmpcbox.h Normal file
View File

@@ -0,0 +1,203 @@
/////////////////////////////////////////////////////////////////////////////
// Name: bmpcbox.h
// Purpose: interface of wxBitmapComboBox
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxBitmapComboBox
@wxheader{bmpcbox.h}
A combobox that displays bitmap in front of the list items.
It currently only allows using bitmaps of one size, and resizes itself
so that a bitmap can be shown next to the text field.
@remarks
While wxBitmapComboBox contains the wxComboBox API, but it might not actually
be derived from that class. In fact, if the platform does not have a native
implementation, wxBitmapComboBox will inherit from wxOwnerDrawnComboBox.
You can determine if the implementation is generic by checking whether
@c wxGENERIC_BITMAPCOMBOBOX is defined. Currently wxBitmapComboBox is
implemented natively for MSW and GTK+.
@beginStyleTable
@style{wxCB_READONLY}
Creates a combobox without a text editor. On some platforms the
control may appear very different when this style is used.
@style{wxCB_SORT}
Sorts the entries in the list alphabetically.
@style{wxTE_PROCESS_ENTER}
The control will generate the event wxEVT_COMMAND_TEXT_ENTER
(otherwise pressing Enter key is either processed internally by the
control or used for navigation between dialog controls).
Windows only.
@endStyleTable
@todo create wxCB_PROCESS_ENTER rather than reusing wxTE_PROCESS_ENTER!
@beginEventTable{wxCommandEvent}
@event{EVT_COMBOBOX(id, func)}
Process a wxEVT_COMMAND_COMBOBOX_SELECTED event, when an item on
the list is selected.
@event{EVT_TEXT(id, func)}
Process a wxEVT_COMMAND_TEXT_UPDATED event, when the combobox text changes.
@event{EVT_TEXT_ENTER(id, func)}
Process a wxEVT_COMMAND_TEXT_ENTER event, when RETURN is pressed in
the combobox.
@endEventTable
@library{wxadv}
@category{ctrl}
<!-- @appearance{bitmapcombobox.png} -->
@see wxComboBox, wxChoice, wxOwnerDrawnComboBox, wxCommandEvent
*/
class wxBitmapComboBox : public wxComboBox
{
public:
/**
Default ctor.
*/
wxBitmapComboBox();
/**
Constructor, creating and showing a combobox.
@param parent
Parent window. Must not be @NULL.
@param id
Window identifier. The value wxID_ANY indicates a default value.
@param value
Initial selection string. An empty string indicates no selection.
@param n
Number of strings with which to initialise the control.
@param choices
An array of strings with which to initialise the control.
@see Create(), wxValidator
*/
wxBitmapComboBox(wxWindow* parent, wxWindowID id,
const wxString& value = "",
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 = "comboBox");
/**
Constructor, creating and showing a combobox.
@param parent
Parent window. Must not be @NULL.
@param id
Window identifier. The value wxID_ANY indicates a default value.
@param value
Initial selection string. An empty string indicates no selection.
@param choices
An wxArrayString with which to initialise the control.
@see Create(), wxValidator
*/
wxBitmapComboBox(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 = "comboBox");
/**
Destructor, destroying the combobox.
*/
virtual ~wxBitmapComboBox();
/**
Adds the item to the end of the combo box.
*/
int Append(const wxString& item,
const wxBitmap& bitmap = wxNullBitmap);
/**
Adds the item to the end of the combo box, associating the given
untyped, client data pointer @a clientData with the item.
*/
int Append(const wxString& item, const wxBitmap& bitmap,
void* clientData);
/**
Adds the item to the end of the combo box, associating the given typed
client data pointer @a clientData with the item.
*/
int Append(const wxString& item, const wxBitmap& bitmap,
wxClientData* clientData);
/**
Creates the combobox for two-step construction.
*/
bool Create(wxWindow* parent, wxWindowID id,
const wxString& value = "",
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n, const wxString choices[],
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = "comboBox");
/**
Creates the combobox for two-step construction.
*/
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 = "comboBox");
/**
Returns size of bitmaps used in the list.
*/
virtual wxSize GetBitmapSize() const;
/**
Returns the bitmap of the item with the given index.
*/
virtual wxBitmap GetItemBitmap(unsigned int n) const;
/**
Inserts the item into the list before @a pos.
Not valid for @c wxCB_SORT style, use Append() instead.
*/
int Insert(const wxString& item, const wxBitmap& bitmap,
unsigned int pos);
/**
Inserts the item into the list before pos, associating the given
untyped, client data pointer with the item.
Not valid for @c wxCB_SORT style, use Append() instead.
*/
int Insert(const wxString& item, const wxBitmap& bitmap,
unsigned int pos,
void* clientData);
/**
Inserts the item into the list before pos, associating the given typed
client data pointer with the item.
Not valid for @c wxCB_SORT style, use Append() instead.
*/
int Insert(const wxString& item, const wxBitmap& bitmap,
unsigned int pos,
wxClientData* clientData);
/**
Sets the bitmap for the given item.
*/
virtual void SetItemBitmap(unsigned int n, const wxBitmap& bitmap);
};

25
interface/wx/bookctrl.h Normal file
View File

@@ -0,0 +1,25 @@
/////////////////////////////////////////////////////////////////////////////
// Name: bookctrl.h
// Purpose: interface of wxBookCtrlBase
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxBookCtrlBase
@wxheader{bookctrl.h}
@todo Document this class.
@library{wxcore}
@category{miscwnd}
@see @ref overview_bookctrl
*/
class wxBookCtrlBase : public wxControl
{
public:
};

308
interface/wx/brush.h Normal file
View File

@@ -0,0 +1,308 @@
/////////////////////////////////////////////////////////////////////////////
// Name: brush.h
// Purpose: interface of wxBrush
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
The possible brush styles.
*/
enum wxBrushStyle
{
wxBRUSHSTYLE_INVALID = -1,
wxBRUSHSTYLE_SOLID = wxSOLID,
/**< Solid. */
wxBRUSHSTYLE_TRANSPARENT = wxTRANSPARENT,
/**< Transparent (no fill). */
wxBRUSHSTYLE_STIPPLE_MASK_OPAQUE = wxSTIPPLE_MASK_OPAQUE,
/**< @todo WHAT's THIS?? */
wxBRUSHSTYLE_STIPPLE_MASK = wxSTIPPLE_MASK,
/**< @todo WHAT's THIS?? */
wxBRUSHSTYLE_STIPPLE = wxSTIPPLE,
/**< Uses a bitmap as a stipple. */
wxBRUSHSTYLE_BDIAGONAL_HATCH = wxBDIAGONAL_HATCH,
/**< Backward diagonal hatch. */
wxBRUSHSTYLE_CROSSDIAG_HATCH = wxCROSSDIAG_HATCH,
/**< Cross-diagonal hatch. */
wxBRUSHSTYLE_FDIAGONAL_HATCH = wxFDIAGONAL_HATCH,
/**< Forward diagonal hatch. */
wxBRUSHSTYLE_CROSS_HATCH = wxCROSS_HATCH,
/**< Cross hatch. */
wxBRUSHSTYLE_HORIZONTAL_HATCH = wxHORIZONTAL_HATCH,
/**< Horizontal hatch. */
wxBRUSHSTYLE_VERTICAL_HATCH = wxVERTICAL_HATCH,
/**< Vertical hatch. */
wxBRUSHSTYLE_FIRST_HATCH = wxFIRST_HATCH,
wxBRUSHSTYLE_LAST_HATCH = wxLAST_HATCH,
};
/**
@class wxBrush
@wxheader{brush.h}
A brush is a drawing tool for filling in areas. It is used for painting
the background of rectangles, ellipses, etc. It has a colour and a style.
On a monochrome display, wxWidgets shows all brushes as white unless the
colour is really black.
Do not initialize objects on the stack before the program commences, since
other required structures may not have been set up yet. Instead, define
global pointers to objects and create them in wxApp::OnInit or when required.
An application may wish to create brushes with different characteristics
dynamically, and there is the consequent danger that a large number of
duplicate brushes will be created. Therefore an application may wish to
get a pointer to a brush by using the global list of brushes ::wxTheBrushList,
and calling the member function wxBrushList::FindOrCreateBrush().
This class uses reference counting and copy-on-write internally so that
assignments between two instances of this class are very cheap.
You can therefore use actual objects instead of pointers without efficiency problems.
If an instance of this class is changed it will create its own data internally
so that other instances, which previously shared the data using the reference
counting, are not affected.
@library{wxcore}
@category{gdi}
@stdobjects
::wxNullBrush, ::wxBLUE_BRUSH, ::wxGREEN_BRUSH, ::wxWHITE_BRUSH,
::wxBLACK_BRUSH, ::wxGREY_BRUSH, ::wxMEDIUM_GREY_BRUSH, ::wxLIGHT_GREY_BRUSH,
::wxTRANSPARENT_BRUSH, ::wxCYAN_BRUSH, ::wxRED_BRUSH
@see wxBrushList, wxDC, wxDC::SetBrush
*/
class wxBrush : public wxGDIObject
{
public:
/**
Default constructor.
The brush will be uninitialised, and wxBrush:IsOk() will return @false.
*/
wxBrush();
/**
Constructs a brush from a colour object and @a style.
@param colour
Colour object.
@param style
One of the ::wxBrushStyle enumeration values.
*/
wxBrush(const wxColour& colour, wxBrushStyle style = wxBRUSHSTYLE_SOLID);
/**
Constructs a stippled brush using a bitmap.
The brush style will be set to wxBRUSHSTYLE_STIPPLE.
*/
wxBrush(const wxBitmap& stippleBitmap);
/**
Copy constructor, uses @ref overview_refcount "reference counting".
*/
wxBrush(const wxBrush& brush);
/**
Destructor.
See @ref overview_refcount_destruct for more info.
@remarks Although all remaining brushes are deleted when the application
exits, the application should try to clean up all brushes itself.
This is because wxWidgets cannot know if a pointer to the brush
object is stored in an application data structure, and there is
a risk of double deletion.
*/
virtual ~wxBrush();
/**
Returns a reference to the brush colour.
@see SetColour()
*/
virtual wxColour GetColour() const;
/**
Gets a pointer to the stipple bitmap. If the brush does not have a wxBRUSHSTYLE_STIPPLE
style, this bitmap may be non-@NULL but uninitialised (i.e. wxBitmap:IsOk() returns @false).
@see SetStipple()
*/
virtual wxBitmap* GetStipple() const;
/**
Returns the brush style, one of the ::wxBrushStyle values.
@see SetStyle(), SetColour(), SetStipple()
*/
virtual wxBrushStyle GetStyle() const;
/**
Returns @true if the style of the brush is any of hatched fills.
@see GetStyle()
*/
virtual bool IsHatch() const;
/**
Returns @true if the brush is initialised. It will return @false if the default
constructor has been used (for example, the brush is a member of a class, or
@NULL has been assigned to it).
*/
bool IsOk() const;
//@{
/**
Sets the brush colour using red, green and blue values.
@see GetColour()
*/
virtual void SetColour(wxColour& colour);
virtual void SetColour(unsigned char red, unsigned char green, unsigned char blue);
//@}
/**
Sets the stipple bitmap.
@param bitmap
The bitmap to use for stippling.
@remarks The style will be set to wxBRUSHSTYLE_STIPPLE, unless the bitmap
has a mask associated to it, in which case the style will be set
to wxBRUSHSTYLE_STIPPLE_MASK_OPAQUE.
@see wxBitmap
*/
virtual void SetStipple(const wxBitmap& bitmap);
/**
Sets the brush style.
@param style
One of the ::wxBrushStyle values.
@see GetStyle()
*/
virtual void SetStyle(wxBrushStyle style);
/**
Inequality operator.
See @ref overview_refcount_equality for more info.
*/
bool operator !=(const wxBrush& brush) const;
/**
Equality operator.
See @ref overview_refcount_equality for more info.
*/
bool operator ==(const wxBrush& brush) const;
};
/**
An empty brush.
*/
wxBrush wxNullBrush;
/**
Blue brush.
*/
wxBrush* wxBLUE_BRUSH;
/**
Green brush.
*/
wxBrush* wxGREEN_BRUSH;
/**
White brush.
*/
wxBrush* wxWHITE_BRUSH;
/**
Black brush.
*/
wxBrush* wxBLACK_BRUSH;
/**
Grey brush.
*/
wxBrush* wxGREY_BRUSH;
/**
Medium grey brush.
*/
wxBrush* wxMEDIUM_GREY_BRUSH;
/**
Light grey brush.
*/
wxBrush* wxLIGHT_GREY_BRUSH;
/**
Transparent brush.
*/
wxBrush* wxTRANSPARENT_BRUSH;
/**
Cyan brush.
*/
wxBrush* wxCYAN_BRUSH;
/**
Red brush.
*/
wxBrush* wxRED_BRUSH;
/**
@class wxBrushList
@wxheader{gdicmn.h}
A brush list is a list containing all brushes which have been created.
The application should not construct its own brush list: it should use the
object pointer ::wxTheBrushList.
@library{wxcore}
@category{gdi}
@see wxBrush
*/
class wxBrushList : public wxList
{
public:
/**
Finds a brush with the specified attributes and returns it, else creates a new
brush, adds it to the brush list, and returns it.
@param colour
Colour object.
@param style
Brush style. See ::wxBrushStyle for a list of styles.
*/
wxBrush* FindOrCreateBrush(const wxColour& colour,
wxBrushStyle style = wxBRUSHSTYLE_SOLID);
};
/**
The global wxBrushList instance.
*/
wxBrushList* wxTheBrushList;

117
interface/wx/buffer.h Normal file
View File

@@ -0,0 +1,117 @@
/////////////////////////////////////////////////////////////////////////////
// Name: buffer.h
// Purpose: interface of wxMemoryBuffer
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxMemoryBuffer
@wxheader{buffer.h}
A @b wxMemoryBuffer is a useful data structure for storing arbitrary sized
blocks of memory. wxMemoryBuffer guarantees deletion of the memory block when
the object is destroyed.
@library{wxbase}
@category{data}
*/
class wxMemoryBuffer
{
public:
/**
Copy constructor, refcounting is used for performance, but wxMemoryBuffer
is not a copy-on-write structure so changes made to one buffer effect all
copies made from it.
@see @ref overview_refcount
*/
wxMemoryBuffer(const wxMemoryBuffer& src);
/**
Create a new buffer.
@param size
size of the new buffer.
*/
wxMemoryBuffer(size_t size);
/**
Append a single byte to the buffer.
@param data
New byte to append to the buffer.
*/
void AppendByte(char data);
/**
Ensure that the buffer is big enough and return a pointer to the start
of the empty space in the buffer. This pointer can be used to directly
write data into the buffer, this new data will be appended to the
existing data.
@param sizeNeeded
Amount of extra space required in the buffer for
the append operation
*/
void* GetAppendBuf(size_t sizeNeeded);
/**
Returns the size of the buffer.
*/
size_t GetBufSize() const;
/**
Return a pointer to the data in the buffer.
*/
void* GetData() const;
/**
Returns the length of the valid data in the buffer.
*/
size_t GetDataLen() const;
/**
Ensure the buffer is big enough and return a pointer to the
buffer which can be used to directly write into the buffer
up to @a sizeNeeded bytes.
*/
void* GetWriteBuf(size_t sizeNeeded);
/**
Ensures the buffer has at least @a size bytes available.
*/
void SetBufSize(size_t size);
/**
Sets the length of the data stored in the buffer.
Mainly useful for truncating existing data.
@param size
New length of the valid data in the buffer. This is
distinct from the allocated size
*/
void SetDataLen(size_t size);
/**
Update the length after completing a direct append, which
you must have used GetAppendBuf() to initialise.
@param sizeUsed
This is the amount of new data that has been
appended.
*/
void UngetAppendBuf(size_t sizeUsed);
/**
Update the buffer after completing a direct write, which
you must have used GetWriteBuf() to initialise.
@param sizeUsed
The amount of data written in to buffer
by the direct write
*/
void UngetWriteBuf(size_t sizeUsed);
};

72
interface/wx/busyinfo.h Normal file
View File

@@ -0,0 +1,72 @@
/////////////////////////////////////////////////////////////////////////////
// Name: busyinfo.h
// Purpose: interface of wxBusyInfo
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxBusyInfo
@wxheader{busyinfo.h}
This class makes it easy to tell your user that the program is temporarily busy.
Just create a wxBusyInfo object on the stack, and within the current scope,
a message window will be shown.
For example:
@code
wxBusyInfo wait("Please wait, working...");
for (int i = 0; i < 100000; i++)
{
DoACalculation();
}
@endcode
It works by creating a window in the constructor, and deleting it
in the destructor.
You may also want to call wxTheApp-Yield() to refresh the window
periodically (in case it had been obscured by other windows, for
example) like this:
@code
wxWindowDisabler disableAll;
wxBusyInfo wait("Please wait, working...");
for (int i = 0; i < 100000; i++)
{
DoACalculation();
if ( !(i % 1000) )
wxTheApp-Yield();
}
@endcode
but take care to not cause undesirable reentrancies when doing it (see
wxApp::Yield for more details). The simplest way to do it is to use
wxWindowDisabler class as illustrated in the above example.
@library{wxcore}
@category{cmndlg}
*/
class wxBusyInfo
{
public:
/**
Constructs a busy info window as child of @a parent and displays @e msg in it.
@note If @a parent is not @NULL you must ensure that it is not
closed while the busy info is shown.
*/
wxBusyInfo(const wxString& msg, wxWindow* parent = NULL);
/**
Hides and closes the window containing the information text.
*/
virtual ~wxBusyInfo();
};

146
interface/wx/button.h Normal file
View File

@@ -0,0 +1,146 @@
/////////////////////////////////////////////////////////////////////////////
// Name: button.h
// Purpose: interface of wxButton
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxButton
@wxheader{button.h}
A button is a control that contains a text string, and is one of the most
common elements of a GUI.
It may be placed on a @ref wxDialog "dialog box" or on a @ref wxPanel panel,
or indeed on almost any other window.
@beginStyleTable
@style{wxBU_LEFT}
Left-justifies the label. Windows and GTK+ only.
@style{wxBU_TOP}
Aligns the label to the top of the button. Windows and GTK+ only.
@style{wxBU_RIGHT}
Right-justifies the bitmap label. Windows and GTK+ only.
@style{wxBU_BOTTOM}
Aligns the label to the bottom of the button. Windows and GTK+ only.
@style{wxBU_EXACTFIT}
Creates the button as small as possible instead of making it of the
standard size (which is the default behaviour ).
@style{wxBORDER_NONE}
Creates a flat button. Windows and GTK+ only.
@endStyleTable
@beginEventTable{wxCommandEvent}
@event{EVT_BUTTON(id, func)}
Process a wxEVT_COMMAND_BUTTON_CLICKED event, when the button is clicked.
@endEventTable
@library{wxcore}
@category{ctrl}
<!-- @appearance{button.png} -->
@see wxBitmapButton
*/
class wxButton : public wxControl
{
public:
/**
Default ctor.
*/
wxButton();
/**
Constructor, creating and showing a button.
The preferred way to create standard buttons is to use default value of
@a label. If no label is supplied and @a id is one of standard IDs from
@ref page_stockitems "this list", a standard label will be used.
In addition to that, the button will be decorated with stock icons under GTK+ 2.
@param parent
Parent window. Must not be @NULL.
@param id
Button identifier. A value of wxID_ANY indicates a default value.
@param label
Text to be displayed on the button.
@param pos
Button position.
@param size
Button size. If the default size is specified then the button is sized
appropriately for the text.
@param style
Window style. See wxButton class description.
@param validator
Window validator.
@param name
Window name.
@see Create(), wxValidator
*/
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);
/**
Destructor, destroying the button.
*/
virtual ~wxButton();
/**
Button creation function for two-step creation.
For more details, see wxButton().
*/
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);
/**
Returns the default size for the buttons. It is advised to make all the dialog
buttons of the same size and this function allows to retrieve the (platform and
current font dependent size) which should be the best suited for this.
*/
static wxSize GetDefaultSize();
/**
Returns the string label for the button.
@see SetLabel()
*/
wxString GetLabel() const;
/**
This sets the button to be the default item in its top-level window
(e.g. the panel or the dialog box containing it).
As normal, pressing return causes the default button to be depressed when
the return key is pressed.
See also wxWindow::SetFocus() which sets the keyboard focus for windows
and text panel items, and wxTopLevelWindow::SetDefaultItem().
@remarks Under Windows, only dialog box buttons respond to this function.
@return the old default item (possibly NULL)
*/
virtual wxWindow* SetDefault();
/**
Sets the string label for the button.
@param label
The label to set.
*/
void SetLabel(const wxString& label);
};

529
interface/wx/calctrl.h Normal file
View File

@@ -0,0 +1,529 @@
/////////////////////////////////////////////////////////////////////////////
// Name: calctrl.h
// Purpose: interface of wxCalendarCtrl
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxCalendarEvent
@wxheader{calctrl.h}
The wxCalendarEvent class is used together with wxCalendarCtrl.
@library{wxadv}
@category{events}
@see wxCalendarCtrl
*/
class wxCalendarEvent : public wxDateEvent
{
public:
/**
Returns the week day on which the user clicked in
@c EVT_CALENDAR_WEEKDAY_CLICKED handler. It doesn't make sense to call
this function in other handlers.
*/
wxDateTime::WeekDay GetWeekDay() const;
/**
Sets the week day carried by the event, normally only used by the
library internally.
*/
void SetWeekDay(wxDateTime::WeekDay day);
};
/**
Possible kinds of borders which may be used to decorate a date using
wxCalendarDateAttr.
*/
enum wxCalendarDateBorder
{
wxCAL_BORDER_NONE, ///< No Border (Default)
wxCAL_BORDER_SQUARE, ///< Rectangular Border
wxCAL_BORDER_ROUND ///< Round Border
};
/**
@class wxCalendarDateAttr
@wxheader{calctrl.h}
wxCalendarDateAttr is a custom attributes for a calendar date. The objects
of this class are used with wxCalendarCtrl.
@library{wxadv}
@category{misc}
@see wxCalendarCtrl
*/
class wxCalendarDateAttr
{
public:
/**
Default constructor.
*/
wxCalendarDateAttr();
/**
Constructor for specifying all wxCalendarDateAttr properties.
*/
wxCalendarDateAttr(const wxColour& colText,
const wxColour& colBack = wxNullColour,
const wxColour& colBorder = wxNullColour,
const wxFont& font = wxNullFont,
wxCalendarDateBorder border = wxCAL_BORDER_NONE);
/**
Constructor using default properties except the given border.
*/
wxCalendarDateAttr(wxCalendarDateBorder border,
const wxColour& colBorder = wxNullColour);
/**
Returns the background colour set for the calendar date.
*/
const wxColour GetBackgroundColour() const;
/**
Returns the border set for the calendar date.
*/
wxCalendarDateBorder GetBorder() const;
/**
Returns the border colour set for the calendar date.
*/
const wxColour GetBorderColour() const;
/**
Returns the font set for the calendar date.
*/
const wxFont GetFont() const;
/**
Returns the text colour set for the calendar date.
*/
const wxColour GetTextColour() const;
/**
Returns @true if a non-default text background colour is set.
*/
bool HasBackgroundColour() const;
/**
Returns @true if a non-default (i.e. any) border is set.
*/
bool HasBorder() const;
/**
Returns @true if a non-default border colour is set.
*/
bool HasBorderColour() const;
/**
Returns @true if a non-default font is set.
*/
bool HasFont() const;
/**
Returns @true if a non-default text foreground colour is set.
*/
bool HasTextColour() const;
/**
Returns @true if this calendar day is displayed as a holiday.
*/
bool IsHoliday() const;
/**
Sets the text background colour to use.
*/
void SetBackgroundColour(const wxColour& colBack);
/**
Sets the border to use.
*/
void SetBorder(wxCalendarDateBorder border);
/**
Sets the border colour to use.
*/
void SetBorderColour(const wxColour& col);
/**
Sets the font to use.
*/
void SetFont(const wxFont& font);
/**
If @a holiday is @true, this calendar day will be displayed as a
holiday.
*/
void SetHoliday(bool holiday);
/**
Sets the text (foreground) colour to use.
*/
void SetTextColour(const wxColour& colText);
/**
Used (internally) by the generic wxCalendarCtrl::Mark().
*/
static const wxCalendarDateAttr& GetMark();
/**
Set the attributes that will be used to Mark() days on the generic
wxCalendarCtrl.
*/
static void SetMark(wxCalendarDateAttr const& m);
};
/**
Possible return values from wxCalendarCtrl::HitTest().
*/
enum wxCalendarHitTestResult
{
wxCAL_HITTEST_NOWHERE, ///< Hit outside of anything.
wxCAL_HITTEST_HEADER, ///< Hit on the header (weekdays).
wxCAL_HITTEST_DAY ///< Hit on a day in the calendar.
};
/**
@class wxCalendarCtrl
@wxheader{calctrl.h}
The calendar control allows the user to pick a date. The user can move the
current selection using the keyboard and select the date (generating
@c EVT_CALENDAR event) by pressing @c @<Return@> or double clicking it.
Generic calendar has advanced possibilities for the customization of its
display, described below. If you want to use these possibilities on every
platform, use wxGenericCalendarCtrl instead of wxCalendarCtrl.
All global settings (such as colours and fonts used) can, of course, be
changed. But also, the display style for each day in the month can be set
independently using wxCalendarDateAttr class.
An item without custom attributes is drawn with the default colours and
font and without border, but setting custom attributes with SetAttr()
allows to modify its appearance. Just create a custom attribute object and
set it for the day you want to be displayed specially (note that the
control will take ownership of the pointer, i.e. it will delete it itself).
A day may be marked as being a holiday, even if it is not recognized as
one by wxDateTime using the wxCalendarDateAttr::SetHoliday() method.
As the attributes are specified for each day, they may change when the
month is changed, so you will often want to update them in
@c EVT_CALENDAR_PAGE_CHANGED event handler.
@beginStyleTable
@style{wxCAL_SUNDAY_FIRST}
Show Sunday as the first day in the week (not in wxGTK)
@style{wxCAL_MONDAY_FIRST}
Show Monday as the first day in the week (not in wxGTK)
@style{wxCAL_SHOW_HOLIDAYS}
Highlight holidays in the calendar (only generic)
@style{wxCAL_NO_YEAR_CHANGE}
Disable the year changing (deprecated, only generic)
@style{wxCAL_NO_MONTH_CHANGE}
Disable the month (and, implicitly, the year) changing
@style{wxCAL_SHOW_SURROUNDING_WEEKS}
Show the neighbouring weeks in the previous and next months
(only generic, always on for the native controls)
@style{wxCAL_SEQUENTIAL_MONTH_SELECTION}
Use alternative, more compact, style for the month and year
selection controls. (only generic)
@style{wxCAL_SHOW_WEEK_NUMBERS}
Show week numbers on the left side of the calendar. (not in generic)
@endStyleTable
@beginEventTable{wxCalendarEvent}
@event{EVT_CALENDAR(id, func)}
A day was double clicked in the calendar.
@event{EVT_CALENDAR_SEL_CHANGED(id, func)}
The selected date changed.
@event{EVT_CALENDAR_PAGE_CHANGED(id, func)}
The selected month (and/or year) changed.
@event{EVT_CALENDAR_WEEKDAY_CLICKED(id, func)}
User clicked on the week day header (only generic).
@endEventTable
@note Changing the selected date will trigger an EVT_CALENDAR_DAY, MONTH or
YEAR event as well as an EVT_CALENDAR_SEL_CHANGED event.
@library{wxadv}
@category{ctrl}
<!-- @appearance{calendarctrl.png} -->
@nativeimpl{wxgtk,wxmsw}
@see @ref page_samples_calendar, wxCalendarDateAttr, wxCalendarEvent,
wxDatePickerCtrl
*/
class wxCalendarCtrl : public wxControl
{
public:
/**
Default constructor.
*/
wxCalendarCtrl();
/**
Does the same as Create() method.
*/
wxCalendarCtrl(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);
/**
Destroys the control.
*/
~wxCalendarCtrl();
/**
Creates the control. See wxWindow::wxWindow() for the meaning of the
parameters and the control overview for the possible styles.
*/
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);
/**
This function should be used instead of changing @c wxCAL_SHOW_HOLIDAYS
style bit directly. It enables or disables the special highlighting of
the holidays.
*/
void EnableHolidayDisplay(bool display = true);
/**
This function should be used instead of changing
@c wxCAL_NO_MONTH_CHANGE style bit. It allows or disallows the user to
change the month interactively. Note that if the month can not be
changed, the year can not be changed neither.
@return @true if the value of this option really changed or @false if
it was already set to the requested value.
*/
bool EnableMonthChange(bool enable = true);
/**
@deprecated
This function should be used instead of changing
@c wxCAL_NO_YEAR_CHANGE style bit directly. It allows or disallows the
user to change the year interactively. Only in generic wxCalendarCtrl.
*/
void EnableYearChange(bool enable = true);
/**
Returns the attribute for the given date (should be in the range
1...31). The returned pointer may be @NULL. Only in generic
wxCalendarCtrl.
*/
wxCalendarDateAttr* GetAttr(size_t day) const;
/**
Gets the currently selected date.
*/
const wxDateTime GetDate() const;
/**
Gets the background colour of the header part of the calendar window.
This method is currently only implemented in generic wxCalendarCtrl and
always returns @c wxNullColour in the native versions.
@see SetHeaderColours()
*/
const wxColour GetHeaderColourBg() const;
/**
Gets the foreground colour of the header part of the calendar window.
This method is currently only implemented in generic wxCalendarCtrl and
always returns @c wxNullColour in the native versions.
@see SetHeaderColours()
*/
const wxColour GetHeaderColourFg() const;
/**
Gets the background highlight colour. Only in generic wxCalendarCtrl.
This method is currently only implemented in generic wxCalendarCtrl and
always returns @c wxNullColour in the native versions.
@see SetHighlightColours()
*/
const wxColour GetHighlightColourBg() const;
/**
Gets the foreground highlight colour. Only in generic wxCalendarCtrl.
This method is currently only implemented in generic wxCalendarCtrl and
always returns @c wxNullColour in the native versions.
@see SetHighlightColours()
*/
const wxColour GetHighlightColourFg() const;
/**
Return the background colour currently used for holiday highlighting.
Only useful with generic wxCalendarCtrl as native versions currently
don't support holidays display at all and always return
@c wxNullColour.
@see SetHolidayColours()
*/
const wxColour GetHolidayColourBg() const;
/**
Return the foreground colour currently used for holiday highlighting.
Only useful with generic wxCalendarCtrl as native versions currently
don't support holidays display at all and always return
@c wxNullColour.
@see SetHolidayColours()
*/
const wxColour GetHolidayColourFg() const;
/**
Returns one of wxCalendarHitTestResult constants and fills either
@a date or @a wd pointer with the corresponding value depending on the
hit test code.
Not implemented in wxGTK currently.
*/
wxCalendarHitTestResult HitTest(const wxPoint& pos,
wxDateTime* date = NULL,
wxDateTime::WeekDay* wd = NULL);
/**
Clears any attributes associated with the given day (in the range
1...31). Only in generic wxCalendarCtrl.
*/
void ResetAttr(size_t day);
/**
Associates the attribute with the specified date (in the range 1...31).
If the pointer is @NULL, the items attribute is cleared. Only in
generic wxCalendarCtrl.
*/
void SetAttr(size_t day, wxCalendarDateAttr* attr);
/**
Sets the current date.
The @a date parameter must be valid.
*/
void SetDate(const wxDateTime& date);
/**
Set the colours used for painting the weekdays at the top of the
control.
This method is currently only implemented in generic wxCalendarCtrl and
does nothing in the native versions.
*/
void SetHeaderColours(const wxColour& colFg,
const wxColour& colBg);
/**
Set the colours to be used for highlighting the currently selected
date.
This method is currently only implemented in generic wxCalendarCtrl and
does nothing in the native versions.
*/
void SetHighlightColours(const wxColour& colFg,
const wxColour& colBg);
/**
Marks the specified day as being a holiday in the current month.
This method is only implemented in the generic version of the control
and does nothing in the native ones.
*/
void SetHoliday(size_t day);
/**
Sets the colours to be used for the holidays highlighting.
This method is only implemented in the generic version of the control
and does nothing in the native ones. It should also only be called if
the window style includes @c wxCAL_SHOW_HOLIDAYS flag or
EnableHolidayDisplay() had been called.
*/
void SetHolidayColours(const wxColour& colFg,
const wxColour& colBg);
/**
Mark or unmark the day. This day of month will be marked in every
month. In generic wxCalendarCtrl,
*/
void Mark(size_t day, bool mark);
/**
@name Date Range Functions
The functions in this section are currently implemented in the generic
and MSW versions and do nothing in the native GTK implementation.
*/
//@{
/**
Restrict the dates shown by the control to the specified range.
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.
@see GetDateRange()
@param lowerdate
The low limit for the dates shown by the control or
@c wxDefaultDateTime.
@param highlighting
The high limit for the dates shown by the control or
@c wxDefaultDateTime.
@return
@true if either limit is valid, @false otherwise
*/
virtual bool SetDateRange(const wxDateTime& lowerdate = wxDefaultDateTime,
const wxDateTime& upperdate = wxDefaultDateTime);
/**
Returns the limits currently being used.
@see SetDateRange()
@param lowerdate
If non-@NULL, the value of the low limit for the dates shown by the
control is returned (which may be @c wxDefaultDateTime if no limit
is set).
@param upperdate
If non-@NULL, the value of the upper limit for the dates shown by
the control is returned (which may be @c wxDefaultDateTime if no
limit is set).
@return
@true if either limit is set, @false otherwise
*/
virtual bool GetDateRange(wxDateTime *lowerdate,
wxDateTime *upperdate) const;
//@}
};

132
interface/wx/caret.h Normal file
View File

@@ -0,0 +1,132 @@
/////////////////////////////////////////////////////////////////////////////
// Name: caret.h
// Purpose: interface of wxCaret
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxCaret
@wxheader{caret.h}
A caret is a blinking cursor showing the position where the typed text will
appear. Text controls usually have their own caret but wxCaret provides a
way to use a caret in other windows.
Currently, the caret appears as a rectangle of the given size. In the
future, it will be possible to specify a bitmap to be used for the caret
shape.
A caret is always associated with a window and the current caret can be
retrieved using wxWindow::GetCaret(). The same caret can't be reused in two
different windows.
@library{wxcore}
@category{misc}
*/
class wxCaret
{
public:
/**
Default constructor.
*/
wxCaret();
//@{
/**
Creates a caret with the given size (in pixels) and associates it with
the @a window.
*/
wxCaret(wxWindow* window, int width, int height);
wxCaret(wxWindowBase* window, const wxSize& size);
//@}
//@{
/**
Creates a caret with the given size (in pixels) and associates it with
the @a window (same as the equivalent constructors).
*/
bool Create(wxWindowBase* window, int width, int height);
bool Create(wxWindowBase* window, const wxSize& size);
//@}
/**
Returns the blink time which is measured in milliseconds and is the
time elapsed between 2 inversions of the caret (blink time of the caret
is the same for all carets, so this functions is static).
*/
static int GetBlinkTime();
//@{
/**
Get the caret position (in pixels).
*/
void GetPosition(int* x, int* y) const;
const wxPoint GetPosition() const;
//@}
//@{
/**
Get the caret size.
*/
void GetSize(int* width, int* height) const;
const wxSize GetSize() const;
//@}
/**
Get the window the caret is associated with.
*/
wxWindow* GetWindow() const;
/**
Hides the caret, same as Show(@false).
*/
void Hide();
/**
Returns @true if the caret was created successfully.
*/
bool IsOk() const;
/**
Returns @true if the caret is visible and @false if it is permanently
hidden (if it is is blinking and not shown currently but will be after
the next blink, this method still returns @true).
*/
bool IsVisible() const;
//@{
/**
Move the caret to given position (in logical coordinates).
*/
void Move(int x, int y);
void Move(const wxPoint& pt);
//@}
/**
Sets the blink time for all the carets.
@warning Under Windows, this function will change the blink time for
all carets permanently (until the next time it is called),
even for carets in other applications.
@see GetBlinkTime()
*/
static void SetBlinkTime(int milliseconds);
//@{
/**
Changes the size of the caret.
*/
void SetSize(int width, int height);
void SetSize(const wxSize& size);
//@}
/**
Shows or hides the caret. Notice that if the caret was hidden N times,
it must be shown N times as well to reappear on the screen.
*/
void Show(bool show = true);
};

59
interface/wx/chartype.h Normal file
View File

@@ -0,0 +1,59 @@
/////////////////////////////////////////////////////////////////////////////
// Name: chartype.h
// Purpose: interface of global functions
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/** @ingroup group_funcmacro_string */
//@{
/**
This macro can be used with character and string literals (in other words,
@c 'x' or @c "foo") to automatically convert them to Unicode in Unicode
builds of wxWidgets. This macro is simply returns the value passed to it
without changes in ASCII build. In fact, its definition is:
@code
#ifdef UNICODE
# define wxT(x) L ## x
#else // !Unicode
# define wxT(x) x
#endif
@endcode
@see @ref overview_unicode
@header{wx/chartype.h}
*/
#define wxT(string)
/**
wxS is macro which can be used with character and string literals to either
convert them to wide characters or strings in @c wchar_t-based Unicode
builds or keep them unchanged in UTF-8 builds. The use of this macro is
optional as the translation will always be done at run-time even if there
is a mismatch between the kind of the literal used and string or character
type used in the current build, but using it can be beneficial in
performance-sensitive code to do the conversion at compile-time instead.
@see wxT()
@header{wx/chartype.h}
*/
#define wxS(string)
/**
This macro is exactly the same as wxT() and is defined in wxWidgets simply
because it may be more intuitive for Windows programmers as the standard
Win32 headers also define it (as well as yet another name for the same
macro which is _TEXT()).
Don't confuse this macro with _()!
@header{wx/chartype.h}
*/
#define _T(string)
//@}

170
interface/wx/checkbox.h Normal file
View File

@@ -0,0 +1,170 @@
/////////////////////////////////////////////////////////////////////////////
// Name: checkbox.h
// Purpose: interface of wxCheckBox
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
The possible states of a 3-state wxCheckBox (Compatible with the 2-state
wxCheckBox).
*/
enum wxCheckBoxState
{
wxCHK_UNCHECKED,
wxCHK_CHECKED,
wxCHK_UNDETERMINED ///< 3-state checkbox only
};
/**
@class wxCheckBox
@wxheader{checkbox.h}
A checkbox is a labelled box which by default is either on (checkmark is
visible) or off (no checkmark). Optionally (when the wxCHK_3STATE style
flag is set) it can have a third state, called the mixed or undetermined
state. Often this is used as a "Does Not Apply" state.
@beginStyleTable
@style{wxCHK_2STATE}
Create a 2-state checkbox. This is the default.
@style{wxCHK_3STATE}
Create a 3-state checkbox. Not implemented in wxMGL, wxOS2 and
wxGTK built against GTK+ 1.2.
@style{wxCHK_ALLOW_3RD_STATE_FOR_USER}
By default a user can't set a 3-state checkbox to the third state.
It can only be done from code. Using this flags allows the user to
set the checkbox to the third state by clicking.
@style{wxALIGN_RIGHT}
Makes the text appear on the left of the checkbox.
@endStyleTable
@beginEventTable{wxCommandEvent}
@event{EVT_CHECKBOX(id, func)}
Process a wxEVT_COMMAND_CHECKBOX_CLICKED event, when the checkbox
is clicked.
@endEventTable
@library{wxcore}
@category{ctrl}
<!-- @appearance{checkbox.png} -->
@see wxRadioButton, wxCommandEvent
*/
class wxCheckBox : public wxControl
{
public:
/**
Default constructor.
@see Create(), wxValidator
*/
wxCheckBox();
/**
Constructor, creating and showing a checkbox.
@param parent
Parent window. Must not be @NULL.
@param id
Checkbox identifier. The value wxID_ANY indicates a default value.
@param label
Text to be displayed next to the checkbox.
@param pos
Checkbox position. If wxDefaultPosition is specified then a default
position is chosen.
@param size
Checkbox size. If wxDefaultSize is specified then a default size is
chosen.
@param style
Window style. See wxCheckBox.
@param validator
Window validator.
@param name
Window name.
@see Create(), wxValidator
*/
wxCheckBox(wxWindow* parent, wxWindowID id,
const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& val = wxDefaultValidator,
const wxString& name = "checkBox");
/**
Destructor, destroying the checkbox.
*/
~wxCheckBox();
/**
Creates the checkbox for two-step construction. See wxCheckBox()
for details.
*/
bool Create(wxWindow* parent, wxWindowID id,
const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& val = wxDefaultValidator,
const wxString& name = "checkBox");
/**
Gets the state of a 2-state checkbox.
@return Returns @true if it is checked, @false otherwise.
*/
bool GetValue() const;
/**
Gets the state of a 3-state checkbox. Asserts when the function is used
with a 2-state checkbox.
*/
wxCheckBoxState Get3StateValue() const;
/**
Returns whether or not the checkbox is a 3-state checkbox.
@return @true if this checkbox is a 3-state checkbox, @false if it's
a 2-state checkbox.
*/
bool Is3State() const;
/**
Returns whether or not the user can set the checkbox to the third
state.
@return @true if the user can set the third state of this checkbox,
@false if it can only be set programmatically or if it's a
2-state checkbox.
*/
bool Is3rdStateAllowedForUser() const;
/**
This is just a maybe more readable synonym for GetValue(): just as the
latter, it returns @true if the checkbox is checked and @false
otherwise.
*/
bool IsChecked() const;
/**
Sets the checkbox to the given state. This does not cause a
wxEVT_COMMAND_CHECKBOX_CLICKED event to get emitted.
@param state
If @true, the check is on, otherwise it is off.
*/
void SetValue(bool state);
/**
Sets the checkbox to the given state. This does not cause a
wxEVT_COMMAND_CHECKBOX_CLICKED event to get emitted.
Asserts when the checkbox is a 2-state checkbox and setting the state
to wxCHK_UNDETERMINED.
*/
void Set3StateValue(const wxCheckBoxState state);
};

109
interface/wx/checklst.h Normal file
View File

@@ -0,0 +1,109 @@
/////////////////////////////////////////////////////////////////////////////
// Name: checklst.h
// Purpose: interface of wxCheckListBox
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxCheckListBox
@wxheader{checklst.h}
A wxCheckListBox is like a wxListBox, but allows items to be checked or
unchecked.
When using this class under Windows wxWidgets must be compiled with
wxUSE_OWNER_DRAWN set to 1.
Only the new functions for this class are documented; see also wxListBox.
Please note that wxCheckListBox uses client data in its implementation,
and therefore this is not available to the application.
@beginEventTable{wxCommandEvent}
@event{EVT_CHECKLISTBOX(id, func)}
Process a wxEVT_COMMAND_CHECKLISTBOX_TOGGLED event, when an item in
the check list box is checked or unchecked.
@endEventTable
@library{wxcore}
@category{ctrl}
<!-- @appearance{checklistbox.png} -->
@see wxListBox, wxChoice, wxComboBox, wxListCtrl, wxCommandEvent
*/
class wxCheckListBox : public wxListBox
{
public:
/**
Default constructor.
*/
wxCheckListBox();
//@{
/**
Constructor, creating and showing a list box.
@param parent
Parent window. Must not be @NULL.
@param id
Window identifier. The value wxID_ANY indicates a default value.
@param pos
Window position.
@param size
Window size. If wxDefaultSize is specified then the window is sized
appropriately.
@param n
Number of strings with which to initialise the control.
@param choices
An array of strings with which to initialise the control.
@param style
Window style. See wxCheckListBox.
@param validator
Window validator.
@param name
Window name.
*/
wxCheckListBox(wxWindow* parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n,
const wxString choices[] = NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = "listBox");
wxCheckListBox(wxWindow* parent, wxWindowID id,
const wxPoint& pos,
const wxSize& size,
const wxArrayString& choices,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = "listBox");
//@}
/**
Destructor, destroying the list box.
*/
~wxCheckListBox();
/**
Checks the given item. Note that calling this method does not result in
a wxEVT_COMMAND_CHECKLISTBOX_TOGGLE event being emitted.
@param item
Index of item to check.
@param check
@true if the item is to be checked, @false otherwise.
*/
void Check(int item, bool check = true);
/**
Returns @true if the given item is checked, @false otherwise.
@param item
Index of item whose check status is to be returned.
*/
bool IsChecked(unsigned int item) const;
};

353
interface/wx/choicdlg.h Normal file
View File

@@ -0,0 +1,353 @@
/////////////////////////////////////////////////////////////////////////////
// Name: choicdlg.h
// Purpose: interface of wx[Multi|Single]ChoiceDialog
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxMultiChoiceDialog
@wxheader{choicdlg.h}
This class represents a dialog that shows a list of strings, and allows the
user to select one or more.
@library{wxbase}
@category{cmndlg}
@see @ref overview_cmndlg_multichoice, wxSingleChoiceDialog
*/
class wxMultiChoiceDialog : public wxDialog
{
public:
//@{
/**
Constructor taking an array of wxString choices.
@param parent
Parent window.
@param message
Message to show on the dialog.
@param caption
The dialog caption.
@param n
The number of choices.
@param choices
An array of strings, or a string list, containing the choices.
@param style
A dialog style (bitlist) containing flags chosen from standard
dialog style and the ones listed below. The default value is
equivalent to wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxOK |
wxCANCEL | wxCENTRE.
@param pos
Dialog position. Not Windows.
@beginStyleTable
@style{wxOK}
Show an OK button.
@style{wxCANCEL}
Show a Cancel button.
@style{wxCENTRE}
Centre the message. Not Windows.
@endStyleTable
@remarks Use ShowModal() to show the dialog.
@beginWxPythonOnly
For Python the two parameters @a n and @a choices are collapsed into a
multi parameter @a choices which is expected to be a Python list of
strings.
@endWxPythonOnly
*/
wxMultiChoiceDialog(wxWindow* parent, const wxString& message,
const wxString& caption,
int n, const wxString* choices,
long style = wxCHOICEDLG_STYLE,
const wxPoint& pos = wxDefaultPosition);
wxMultiChoiceDialog(wxWindow* parent,
const wxString& message,
const wxString& caption,
const wxArrayString& choices,
long style = wxCHOICEDLG_STYLE,
const wxPoint& pos = wxDefaultPosition);
//@}
/**
Returns array with indexes of selected items.
*/
wxArrayInt GetSelection() const;
/**
Sets selected items from the array of selected items' indexes.
*/
void SetSelections(const wxArrayInt& selections) const;
/**
Shows the dialog, returning either wxID_OK or wxID_CANCEL.
*/
int ShowModal();
};
/**
@class wxSingleChoiceDialog
@wxheader{choicdlg.h}
This class represents a dialog that shows a list of strings, and allows the
user to select one. Double-clicking on a list item is equivalent to
single-clicking and then pressing OK.
@library{wxbase}
@category{cmndlg}
@see @ref overview_cmndlg_singlechoice, wxMultiChoiceDialog
*/
class wxSingleChoiceDialog : public wxDialog
{
public:
//@{
/**
Constructor, taking an array of wxString choices and optional client
data.
@param parent
Parent window.
@param message
Message to show on the dialog.
@param caption
The dialog caption.
@param n
The number of choices.
@param choices
An array of strings, or a string list, containing the choices.
@param clientData
An array of client data to be associated with the items. See
GetSelectionClientData().
@param style
A dialog style (bitlist) containing flags chosen from standard
dialog styles and the ones listed below. The default value is
equivalent to wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxOK |
wxCANCEL | wxCENTRE.
@param pos
Dialog position. Not Windows.
@beginStyleTable
@style{wxOK}
Show an OK button.
@style{wxCANCEL}
Show a Cancel button.
@style{wxCENTRE}
Centre the message. Not Windows.
@endStyleTable
@remarks Use ShowModal() to show the dialog.
@beginWxPythonOnly
For Python the two parameters @a n and @a choices are collapsed into a
multi parameter @a choices which is expected to be a Python list of
strings.
@endWxPythonOnly
*/
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);
wxSingleChoiceDialog(wxWindow* parent,
const wxString& message,
const wxString& caption,
const wxArrayString& choices,
void** clientData = NULL,
long style = wxCHOICEDLG_STYLE,
const wxPoint& pos = wxDefaultPosition);
//@}
/**
Returns the index of selected item.
*/
int GetSelection() const;
/**
Returns the client data associated with the selection.
*/
char* GetSelectionClientData() const;
/**
Returns the selected string.
*/
wxString GetStringSelection() const;
/**
Sets the index of the initially selected item.
*/
void SetSelection(int selection) const;
/**
Shows the dialog, returning either wxID_OK or wxID_CANCEL.
*/
int ShowModal();
};
// ============================================================================
// Global functions/macros
// ============================================================================
/** @ingroup group_funcmacro_dialog */
//@{
/**
Same as wxGetSingleChoice() but returns the index representing the
selected string. If the user pressed cancel, -1 is returned.
@header{wx/choicdlg.h}
*/
int wxGetSingleChoiceIndex(const wxString& message,
const wxString& caption,
const wxArrayString& aChoices,
wxWindow* parent = NULL,
int x = -1,
int y = -1,
bool centre = true,
int width = 150,
int height = 200);
int wxGetSingleChoiceIndex(const wxString& message,
const wxString& caption,
int n,
const wxString& choices[],
wxWindow* parent = NULL,
int x = -1,
int y = -1,
bool centre = true,
int width = 150,
int height = 200);
//@}
/** @ingroup group_funcmacro_dialog */
//@{
/**
Pops up a dialog box containing a message, OK/Cancel buttons and a
single-selection listbox. The user may choose an item and press OK to
return a string or Cancel to return the empty string. Use
wxGetSingleChoiceIndex() if empty string is a valid choice and if you want
to be able to detect pressing Cancel reliably.
You may pass the list of strings to choose from either using @c choices
which is an array of @a n strings for the listbox or by using a single
@c aChoices parameter of type wxArrayString.
If @c centre is @true, the message text (which may include new line
characters) is centred; if @false, the message is left-justified.
@header{wx/choicdlg.h}
*/
wxString wxGetSingleChoice(const wxString& message,
const wxString& caption,
const wxArrayString& aChoices,
wxWindow* parent = NULL,
int x = -1,
int y = -1,
bool centre = true,
int width = 150,
int height = 200);
wxString wxGetSingleChoice(const wxString& message,
const wxString& caption,
int n,
const wxString& choices[],
wxWindow* parent = NULL,
int x = -1,
int y = -1,
bool centre = true,
int width = 150,
int height = 200);
//@}
/** @ingroup group_funcmacro_dialog */
//@{
/**
Same as wxGetSingleChoice but takes an array of client data pointers
corresponding to the strings, and returns one of these pointers or @NULL
if Cancel was pressed. The @c client_data array must have the same number
of elements as @c choices or @c aChoices!
@header{wx/choicdlg.h}
*/
wxString wxGetSingleChoiceData(const wxString& message,
const wxString& caption,
const wxArrayString& aChoices,
const wxString& client_data[],
wxWindow* parent = NULL,
int x = -1,
int y = -1,
bool centre = true,
int width = 150,
int height = 200);
wxString wxGetSingleChoiceData(const wxString& message,
const wxString& caption,
int n,
const wxString& choices[],
const wxString& client_data[],
wxWindow* parent = NULL,
int x = -1,
int y = -1,
bool centre = true,
int width = 150,
int height = 200);
//@}
/** @ingroup group_funcmacro_dialog */
//@{
/**
Pops up a dialog box containing a message, OK/Cancel buttons and a
multiple-selection listbox. The user may choose an arbitrary (including 0)
number of items in the listbox whose indices will be returned in
@c selections array. The initial contents of this array will be used to
select the items when the dialog is shown.
You may pass the list of strings to choose from either using @c choices
which is an array of @a n strings for the listbox or by using a single
@c aChoices parameter of type wxArrayString.
If @c centre is @true, the message text (which may include new line
characters) is centred; if @false, the message is left-justified.
@header{wx/choicdlg.h}
*/
size_t wxGetMultipleChoices(wxArrayInt& selections,
const wxString& message,
const wxString& caption,
const wxArrayString& aChoices,
wxWindow* parent = NULL,
int x = -1,
int y = -1,
bool centre = true,
int width = 150,
int height = 200);
size_t wxGetMultipleChoices(wxArrayInt& selections,
const wxString& message,
const wxString& caption,
int n,
const wxString& choices[],
wxWindow* parent = NULL,
int x = -1,
int y = -1,
bool centre = true,
int width = 150,
int height = 200);
//@}

150
interface/wx/choice.h Normal file
View File

@@ -0,0 +1,150 @@
/////////////////////////////////////////////////////////////////////////////
// Name: choice.h
// Purpose: interface of wxChoice
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxChoice
@wxheader{choice.h}
A choice item is used to select one of a list of strings. Unlike a
wxListBox, only the selection is visible until the user pulls down the
menu of choices.
@beginStyleTable
@style{wxCB_SORT}
Sorts the entries alphabetically.
@endStyleTable
@beginEventTable{wxCommandEvent}
@event{EVT_CHOICE(id, func)}
Process a wxEVT_COMMAND_CHOICE_SELECTED event, when an item on the
list is selected.
@endEventTable
@library{wxcore}
@category{ctrl}
<!-- @appearance{choice.png} -->
@see wxListBox, wxComboBox, wxCommandEvent
*/
class wxChoice : public wxControlWithItems
{
public:
/**
Default constructor.
@see Create(), wxValidator
*/
wxChoice();
//@{
/**
Constructor, creating and showing a choice.
@param parent
Parent window. Must not be @NULL.
@param id
Window identifier. The value wxID_ANY indicates a default value.
@param pos
Window position.
@param size
Window size. If wxDefaultSize is specified then the choice is sized
appropriately.
@param n
Number of strings with which to initialise the choice control.
@param choices
An array of strings with which to initialise the choice control.
@param style
Window style. See wxChoice.
@param validator
Window validator.
@param name
Window name.
@see Create(), wxValidator
@beginWxPythonOnly
The wxChoice constructor in wxPython reduces the @a n and @a choices
arguments to a single argument, which is a list of strings.
@endWxPythonOnly
*/
wxChoice(wxWindow* parent, wxWindowID id,
const wxPoint& pos,
const wxSize& size, int n,
const wxString choices[],
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = "choice");
wxChoice(wxWindow* parent, wxWindowID id,
const wxPoint& pos,
const wxSize& size,
const wxArrayString& choices,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = "choice");
//@}
/**
Destructor, destroying the choice item.
*/
~wxChoice();
//@{
/**
Creates the choice for two-step construction. See wxChoice().
*/
bool Create(wxWindow* parent, wxWindowID id, const wxPoint& pos,
const wxSize& size, int n,
const wxString choices[],
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = "choice");
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 = "choice");
//@}
/**
Gets the number of columns in this choice item.
@remarks This is implemented for GTK and Motif only and always
returns 1 for the other platforms.
*/
int GetColumns() const;
/**
Unlike wxControlWithItems::GetSelection() which only returns the
accepted selection value, i.e. the selection in the control once the
user closes the dropdown list, this function returns the current
selection. That is, while the dropdown list is shown, it returns the
currently selected item in it. When it is not shown, its result is the
same as for the other function.
@since 2.6.2.
In older versions, wxControlWithItems::GetSelection() itself
behaved like this.
*/
int GetCurrentSelection() const;
/**
Sets the number of columns in this choice item.
@param n
Number of columns.
@remarks This is implemented for GTK and Motif only and doesnt do
anything under other platforms.
*/
void SetColumns(int n = 1);
};

78
interface/wx/choicebk.h Normal file
View File

@@ -0,0 +1,78 @@
/////////////////////////////////////////////////////////////////////////////
// Name: choicebk.h
// Purpose: interface of wxChoicebook
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxChoicebook
@wxheader{choicebk.h}
wxChoicebook is a class similar to wxNotebook, but uses a wxChoice control
to show the labels instead of the tabs.
There is no documentation for this class yet but its usage is identical to
wxNotebook (except for the features clearly related to tabs only), so
please refer to that class documentation for now. You can also use the
@ref page_samples_notebook to see wxChoicebook in action.
wxChoicebook allows the use of wxBookCtrlBase::GetControlSizer(), allowing
a program to add other controls next to the choice control. This is
particularly useful when screen space is restricted, as it often is when
wxChoicebook is being employed.
@beginStyleTable
@style{wxCHB_DEFAULT}
Choose the default location for the labels depending on the current
platform (left everywhere except Mac where it is top).
@style{wxCHB_TOP}
Place labels above the page area.
@style{wxCHB_LEFT}
Place labels on the left side.
@style{wxCHB_RIGHT}
Place labels on the right side.
@style{wxCHB_BOTTOM}
Place labels below the page area.
@endStyleTable
@beginEventTable{wxChoicebookEvent}
@event{EVT_CHOICEBOOK_PAGE_CHANGED(id, func)}
The page selection was changed. Processes a
wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED event.
@event{EVT_CHOICEBOOK_PAGE_CHANGING(id, func)}
The page selection is about to be changed. Processes a
wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING event. This event can be
vetoed (using wxNotifyEvent::Veto()).
@endEventTable
@library{wxcore}
@category{miscwnd}
@see @ref overview_bookctrl, wxNotebook, @ref page_samples_notebook
@todo Write up wxBookCtrlBase documentation, where most of this class'
functionality comes from.
*/
class wxChoicebook : public wxBookCtrlBase
{
public:
//@{
/**
Constructs a choicebook control.
*/
wxChoicebook();
wxChoicebook(wxWindow* parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxEmptyStr);
//@}
/**
Returns the wxChoice associated with the control.
*/
wxChoice * GetChoiceCtrl() const;
};

179
interface/wx/clipbrd.h Normal file
View File

@@ -0,0 +1,179 @@
/////////////////////////////////////////////////////////////////////////////
// Name: clipbrd.h
// Purpose: interface of wxClipboard
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
The backwards compatible access macro that returns the global clipboard
object pointer.
*/
#define wxTheClipboard
/**
@class wxClipboard
@wxheader{clipbrd.h}
A class for manipulating the clipboard.
To use the clipboard, you call member functions of the global
::wxTheClipboard object.
See the @ref overview_dataobject for further information.
Call wxClipboard::Open() to get ownership of the clipboard. If this
operation returns @true, you now own the clipboard. Call
wxClipboard::SetData() to put data on the clipboard, or
wxClipboard::GetData() to retrieve data from the clipboard. Call
wxClipboard::Close() to close the clipboard and relinquish ownership. You
should keep the clipboard open only momentarily.
For example:
@code
// Write some text to the clipboard
if (wxTheClipboard->Open())
{
// This data objects are held by the clipboard,
// so do not delete them in the app.
wxTheClipboard->SetData( new wxTextDataObject("Some text") );
wxTheClipboard->Close();
}
// Read some text
if (wxTheClipboard->Open())
{
if (wxTheClipboard->IsSupported( wxDF_TEXT ))
{
wxTextDataObject data;
wxTheClipboard->GetData( data );
wxMessageBox( data.GetText() );
}
wxTheClipboard->Close();
}
@endcode
@library{wxcore}
@category{dnd}
@see @ref overview_dnd, @ref overview_dataobject, wxDataObject
*/
class wxClipboard : public wxObject
{
public:
/**
Default constructor.
*/
wxClipboard();
/**
Destructor.
*/
~wxClipboard();
/**
Call this function to add the data object to the clipboard. You may
call this function repeatedly after having cleared the clipboard using
Clear().
After this function has been called, the clipboard owns the data, so do
not delete the data explicitly.
@see SetData()
*/
bool AddData(wxDataObject* data);
/**
Clears the global clipboard object and the system's clipboard if
possible.
*/
void Clear();
/**
Call this function to close the clipboard, having opened it with
Open().
*/
void Close();
/**
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.
@return @false if the operation is unsuccessful for any reason.
*/
bool Flush();
/**
Call this function to fill @a data with data on the clipboard, if
available in the required format. Returns @true on success.
*/
bool GetData(wxDataObject& data);
/**
Returns @true if the clipboard has been opened.
*/
bool IsOpened() const;
/**
Returns @true if there is data which matches the data format of the
given data object currently @b available on the clipboard.
@todo The name of this function is misleading. This should be renamed
to something that more accurately indicates what it does.
*/
bool IsSupported(const wxDataFormat& format);
/**
Returns @true if we are using the primary selection, @false if
clipboard one.
@see UsePrimarySelection()
*/
bool IsUsingPrimarySelection() const;
/**
Call this function to open the clipboard before calling SetData() and
GetData().
Call Close() when you have finished with the clipboard. You should keep
the clipboard open for only a very short time.
@return @true on success. This should be tested (as in the sample
shown above).
*/
bool Open();
/**
Call this function to set the data object to the clipboard. This
function will clear all previous contents in the clipboard, so calling
it several times does not make any sense.
After this function has been called, the clipboard owns the data, so do
not delete the data explicitly.
@see AddData()
*/
bool SetData(wxDataObject* data);
/**
On platforms supporting it (all X11-based ports), wxClipboard uses the
CLIPBOARD X11 selection by default. When this function is called with
@true, all subsequent clipboard operations will use PRIMARY selection
until this function is called again with @false.
On the other platforms, there is no PRIMARY selection and so all
clipboard operations will fail. This allows to implement the standard
X11 handling of the clipboard which consists in copying data to the
CLIPBOARD selection only when the user explicitly requests it (i.e. by
selecting the "Copy" menu command) but putting the currently selected
text into the PRIMARY selection automatically, without overwriting the
normal clipboard contents with the currently selected text on the other
platforms.
*/
void UsePrimarySelection(bool primary = true);
};

141
interface/wx/clntdata.h Normal file
View File

@@ -0,0 +1,141 @@
/////////////////////////////////////////////////////////////////////////////
// Name: clntdata.h
// Purpose: interface of wxClientData[Container] and wxStringClientData
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxClientDataContainer
@wxheader{clntdata.h}
This class is a mixin that provides storage and management of "client
data." This data can either be of type void - in which case the data
@e container does not take care of freeing the data again or it is of
type wxClientData or its derivatives. In that case the container will free
the memory itself later. Note that you @e must not assign both void data
and data derived from the wxClientData class to a container.
@note This functionality is currently duplicated in wxEvtHandler in order
to avoid having more than one vtable in that class hierarchy.
@library{wxbase}
@category{containers}
@see wxEvtHandler, wxClientData
*/
class wxClientDataContainer
{
public:
/**
Default constructor.
*/
wxClientDataContainer();
/**
Destructor.
*/
~wxClientDataContainer();
/**
Get the untyped client data.
*/
void* GetClientData() const;
/**
Get a pointer to the client data object.
*/
wxClientData* GetClientObject() const;
/**
Set the untyped client data.
*/
void SetClientData(void* data);
/**
Set the client data object. Any previous object will be deleted.
*/
void SetClientObject(wxClientData* data);
};
/**
@class wxClientData
@wxheader{clntdata.h}
All classes deriving from wxEvtHandler (such as all controls and wxApp) can
hold arbitrary data which is here referred to as "client data". This is
useful e.g. for scripting languages which need to handle shadow objects for
most of wxWidgets' classes and which store a handle to such a shadow class
as client data in that class. This data can either be of type void - in
which case the data @e container does not take care of freeing the data
again or it is of type wxClientData or its derivatives. In that case the
container (e.g. a control) will free the memory itself later. Note that you
@e must not assign both void data and data derived from the wxClientData
class to a container.
Some controls can hold various items and these controls can additionally
hold client data for each item. This is the case for wxChoice, wxComboBox
and wxListBox. wxTreeCtrl has a specialized class wxTreeItemData for each
item in the tree.
If you want to add client data to your own classes, you may use the mix-in
class wxClientDataContainer.
@library{wxbase}
@category{containers}
@see wxEvtHandler, wxTreeItemData, wxStringClientData,
wxClientDataContainer
*/
class wxClientData
{
public:
/**
Constructor.
*/
wxClientData();
/**
Virtual destructor.
*/
~wxClientData();
};
/**
@class wxStringClientData
@wxheader{clntdata.h}
Predefined client data class for holding a string.
@library{wxbase}
@category{containers}
*/
class wxStringClientData : public wxClientData
{
public:
/**
Default constructor.
*/
wxStringClientData();
/**
Create client data with string.
*/
wxStringClientData(const wxString& data);
/**
Get string client data.
*/
const wxString GetData() const;
/**
Set string client data.
*/
void SetData(const wxString& data);
};

143
interface/wx/clrpicker.h Normal file
View File

@@ -0,0 +1,143 @@
/////////////////////////////////////////////////////////////////////////////
// Name: clrpicker.h
// Purpose: interface of wxColourPickerCtrl
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxColourPickerCtrl
@wxheader{clrpicker.h}
This control allows the user to select a colour. The generic implementation
is a button which brings up a wxColourDialog when clicked. Native
implementation may differ but this is usually a (small) widget which give
access to the colour-chooser dialog. It is only available if
@c wxUSE_COLOURPICKERCTRL is set to 1 (the default).
@beginStyleTable
@style{wxCLRP_DEFAULT_STYLE}
The default style: 0.
@style{wxCLRP_USE_TEXTCTRL}
Creates a text control to the left of the picker button which is
completely managed by the wxColourPickerCtrl and which can be used
by the user to specify a colour (see SetColour). The text control
is automatically synchronized with button's value. Use functions
defined in wxPickerBase to modify the text control.
@style{wxCLRP_SHOW_LABEL}
Shows the colour in HTML form (AABBCC) as colour button label
(instead of no label at all).
@endStyleTable
@beginEventTable{wxColourPickerEvent}
@event{EVT_COLOURPICKER_CHANGED(id, func)}
The user changed the colour selected in the control either using the
button or using text control (see @c wxCLRP_USE_TEXTCTRL; note that
in this case the event is fired only if the users input is valid,
i.e. recognizable).
@endEventTable
@library{wxcore}
@category{pickers}
<!-- @appearance{colourpickerctrl.png} -->
@see wxColourDialog, wxColourPickerEvent
*/
class wxColourPickerCtrl : public wxPickerBase
{
public:
/**
Initializes the object and calls Create() with all the parameters.
*/
wxColourPickerCtrl(wxWindow* parent, wxWindowID id,
const wxColour& colour = wxBLACK,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxCLRP_DEFAULT_STYLE,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = "colourpickerctrl");
/**
Creates a colour picker with the given arguments.
@param parent
Parent window, must not be non-@NULL.
@param id
The identifier for the control.
@param colour
The initial colour shown in the control.
@param pos
Initial position.
@param size
Initial size.
@param style
The window style, see wxCRLP_* flags.
@param validator
Validator which can be used for additional date checks.
@param name
Control name.
@return @true if the control was successfully created or @false if
creation failed.
*/
bool Create(wxWindow* parent, wxWindowID id,
const wxColour& colour = wxBLACK,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxCLRP_DEFAULT_STYLE,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = "colourpickerctrl");
/**
Returns the currently selected colour.
*/
wxColour GetColour() const;
//@{
/**
Sets the currently selected colour. See wxColour::Set().
*/
void SetColour(const wxColour& col);
void SetColour(const wxString& colname);
//@}
};
/**
@class wxColourPickerEvent
@wxheader{clrpicker.h}
This event class is used for the events generated by wxColourPickerCtrl.
@beginEventTable{wxColourPickerEvent}
@event{EVT_COLOURPICKER_CHANGED(id, func)}
Generated whenever the selected colour changes.
@endEventTable
@library{wxcore}
@category{events}
@see wxColourPickerCtrl
*/
class wxColourPickerEvent : public wxCommandEvent
{
public:
/**
The constructor is not normally used by the user code.
*/
wxColourPickerEvent(wxObject* generator, int id,
const wxColour& colour);
/**
Retrieve the colour the user has just selected.
*/
wxColour GetColour() const;
/**
Set the colour associated with the event.
*/
void SetColour(const wxColour& pos);
};

450
interface/wx/cmdline.h Normal file
View File

@@ -0,0 +1,450 @@
/////////////////////////////////////////////////////////////////////////////
// Name: cmdline.h
// Purpose: interface of wxCmdLineParser
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
wxCmdLineEntryDesc::flags field is a combination of these bit masks.
Notice that by default (i.e. if flags are just 0), options are optional
(sic) and each call to wxCmdLineEntryDesc::AddParam() allows one more
parameter - this may be changed by giving non-default flags to it, i.e. use
wxCMD_LINE_OPTION_MANDATORY to require that the option is given and
wxCMD_LINE_PARAM_OPTIONAL to make a parameter optional. Also,
wxCMD_LINE_PARAM_MULTIPLE may be specified if the programs accepts a
variable number of parameters - but it only can be given for the last
parameter in the command line description. If you use this flag, you will
probably need to use wxCmdLineEntryDesc::GetParamCount() to retrieve the
number of parameters effectively specified after calling
wxCmdLineEntryDesc::Parse().
wxCMD_LINE_NEEDS_SEPARATOR can be specified to require a separator (either
a colon, an equal sign or white space) between the option name and its
value. By default, no separator is required.
*/
enum
{
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 a separator before the value.
};
/**
The possible values of wxCmdLineEntryDesc::type which specifies the type of
the value accepted by an option.
*/
enum wxCmdLineParamType
{
wxCMD_LINE_VAL_STRING,
wxCMD_LINE_VAL_NUMBER,
wxCMD_LINE_VAL_DATE,
wxCMD_LINE_VAL_DOUBLE,
wxCMD_LINE_VAL_NONE
};
/**
The type of a command line entity used for wxCmdLineEntryDesc::kind.
*/
enum wxCmdLineEntryType
{
wxCMD_LINE_SWITCH,
wxCMD_LINE_OPTION,
wxCMD_LINE_PARAM,
wxCMD_LINE_USAGE_TEXT,
wxCMD_LINE_NONE ///< Use this to terminate the list.
};
/**
The structure wxCmdLineEntryDesc is used to describe the one command line
switch, option or parameter. An array of such structures should be passed
to wxCmdLineParser::SetDesc(). Also, the meanings of parameters of the
wxCmdLineParser::AddXXX() functions are the same as of the corresponding
fields in this structure.
The field @c shortName is the usual, short, name of the switch or the
option. @c longName is the corresponding long name or empty if the option
has no long name. Both of these fields are unused for the parameters. Both
the short and long option names can contain only letters, digits and the
underscores.
@c description is used by the wxCmdLineEntryDesc::Usage() method to
construct a help message explaining the syntax of the program.
*/
struct wxCmdLineEntryDesc
{
wxCmdLineEntryType kind;
const char *shortName;
const char *longName;
const char *description;
wxCmdLineParamType type;
int flags;
};
/**
@class wxCmdLineParser
@wxheader{cmdline.h}
wxCmdLineParser is a class for parsing the command line.
It has the following features:
- distinguishes options, switches and parameters
- allows option grouping
- allows both short and long options
- automatically generates the usage message from the command line description
- checks types of the options values (number, date, ...).
To use it you should follow these steps:
-# @ref cmdlineparser_construction "Construct" an object of this class
giving it the command line to parse and optionally its description or
use the @c AddXXX() functions later.
-# Call Parse().
-# Use Found() to retrieve the results.
In the documentation below the following terminology is used:
- @b switch: This is a boolean option which can be given or not, but which
doesn't have any value. We use the word switch to distinguish
such boolean options from more generic options like those
described below. For example, @c "-v" might be a switch
meaning "enable verbose mode".
- @b option: Option for us here is something which comes with a value 0
unlike a switch. For example, @c -o: @c filename might be an
option for specifying the name of the output file.
- @b parameter: This is a required program argument.
- @b text: This is a text which can be shown in usage information.
@section cmdlineparser_construction Construction
Before Parse() can be called, the command line parser object must have the
command line to parse and also the rules saying which switches, options and
parameters are valid - this is called command line description in what
follows.
You have complete freedom of choice as to when specify the required
information, the only restriction is that it must be done before calling
Parse().
To specify the command line to parse you may use either one of constructors
accepting it (wxCmdLineParser(int, char**) or
wxCmdLineParser(const wxString&) usually) or, if you use the default
constructor, you can do it later by calling SetCmdLine().
The same holds for command line description: it can be specified either in
the constructor (with or without the command line itself) or constructed
later using either SetDesc() or combination of AddSwitch(), AddOption(),
AddParam() and AddUsageText() methods.
Using constructors or SetDesc() uses a (usually const static) table
containing the command line description. If you want to decide which
options to accept during the run-time, using one of the AddXXX() functions
above might be preferable.
@section cmdlineparser_customization Customization
wxCmdLineParser has several global options which may be changed by the
application. All of the functions described in this section should be
called before Parse().
First global option is the support for long (also known as GNU-style)
options. The long options are the ones which start with two dashes and look
like "--verbose", i.e. they generally are complete words and not some
abbreviations of them. As long options are used by more and more
applications, they are enabled by default, but may be disabled with
DisableLongOptions().
Another global option is the set of characters which may be used to start
an option (otherwise, the word on the command line is assumed to be a
parameter). Under Unix, @c "-" is always used, but Windows has at least two
common choices for this: @c "-" and @c "/". Some programs also use "+". The
default is to use what suits most the current platform, but may be changed
with SetSwitchChars() method.
Finally, SetLogo() can be used to show some application-specific text
before the explanation given by Usage() function.
@section cmdlineparser_parsing Parsing the Command Line
After the command line description was constructed and the desired options
were set, you can finally call Parse() method. It returns 0 if the command
line was correct and was parsed, -1 if the help option was specified (this
is a separate case as, normally, the program will terminate after this) or
a positive number if there was an error during the command line parsing.
In the latter case, the appropriate error message and usage information are
logged by wxCmdLineParser itself using the standard wxWidgets logging
functions.
@section cmdlineparser_results Getting Results
After calling Parse() (and if it returned 0), you may access the results of
parsing using one of overloaded Found() methods.
For a simple switch, you will simply call Found to determine if the switch
was given or not, for an option or a parameter, you will call a version of
Found() which also returns the associated value in the provided variable.
All Found() functions return true if the switch or option were found in the
command line or false if they were not specified.
@library{wxbase}
@category{appmanagement}
@see wxApp::argc, wxApp::argv, @ref page_samples_console "Console Sample"
*/
class wxCmdLineParser
{
public:
/**
Default constructor, you must use SetCmdLine() later.
*/
wxCmdLineParser();
//@{
/**
Constructor which specifies the command line to parse. This is the
traditional (Unix) command line format. The parameters @a argc and
@a argv have the same meaning as the typical @c main() function.
The second overloaded constructor is only available in Unicode build.
The first one is available in both ANSI and Unicode modes because under
some platforms the command line arguments are passed as ASCII strings
even to Unicode programs.
*/
wxCmdLineParser(int argc, char** argv);
wxCmdLineParser(int argc, wchar_t** argv);
//@}
/**
Constructor which specify the command line to parse in Windows format.
The parameter cmdline has the same meaning as the corresponding
parameter of @c WinMain().
*/
wxCmdLineParser(const wxString& cmdline);
/**
Specifies the @ref SetDesc() "command line description" but not the
command line. You must use SetCmdLine() later.
*/
wxCmdLineParser(const wxCmdLineEntryDesc* desc);
/**
Specifies both the command line (in Unix format) and the
@ref SetDesc() "command line description".
*/
wxCmdLineParser(const wxCmdLineEntryDesc* desc, int argc, char** argv);
/**
Specifies both the command line (in Windows format) and the
@ref SetDesc() "command line description".
*/
wxCmdLineParser(const wxCmdLineEntryDesc* desc,
const wxString& cmdline);
/**
Frees resources allocated by the object.
@note This destructor is not virtual, don't use this class
polymorphically.
*/
~wxCmdLineParser();
/**
Add an option @a name with an optional long name @a lng (no long name
if it is empty, which is default) taking a value of the given type
(string by default) to the command line description.
*/
void AddOption(const wxString& name,
const wxString& lng = wxEmptyString,
const wxString& desc = wxEmptyString,
wxCmdLineParamType type = wxCMD_LINE_VAL_STRING,
int flags = 0);
/**
Add a parameter of the given @a type to the command line description.
*/
void AddParam(const wxString& desc = wxEmptyString,
wxCmdLineParamType type = wxCMD_LINE_VAL_STRING,
int flags = 0);
/**
Add a switch @a name with an optional long name @a lng (no long name if
it is empty, which is default), description @a desc and flags @a flags
to the command line description.
*/
void AddSwitch(const wxString& name,
const wxString& lng = wxEmptyString,
const wxString& desc = wxEmptyString,
int flags = 0);
/**
Add a string @a text to the command line description shown by Usage().
@since 2.9.0
*/
void AddUsageText(const wxString& text);
/**
Returns @true if long options are enabled, otherwise @false.
@see EnableLongOptions()
*/
bool AreLongOptionsEnabled() const;
/**
Breaks down the string containing the full command line in words. The
words are separated by whitespace. The quotes can be used in the input
string to quote the white space and the back slashes can be used to
quote the quotes.
*/
static wxArrayString ConvertStringToArgs(const wxChar cmdline);
/**
Identical to EnableLongOptions(@false).
*/
void DisableLongOptions();
/**
Enable or disable support for the long options.
As long options are not (yet) POSIX-compliant, this option allows to
disable them.
@see @ref cmdlineparser_customization and AreLongOptionsEnabled()
*/
void EnableLongOptions(bool enable = true);
/**
Returns @true if the given switch was found, @false otherwise.
*/
bool Found(const wxString& name) const;
/**
Returns true if an option taking a string value was found and stores
the value in the provided pointer (which should not be @NULL).
*/
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 (which should not be @NULL).
*/
bool Found(const wxString& name, long* value) const;
/**
Returns @true if an option taking a float value was found and stores
the value in the provided pointer (which should not be @NULL).
*/
bool Found(const wxString& name, double* value) const;
/**
Returns @true if an option taking a date value was found and stores the
value in the provided pointer (which should not be @NULL).
*/
bool Found(const wxString& name, wxDateTime* value) const;
/**
Returns the value of Nth parameter (as string only).
*/
wxString GetParam(size_t n = 0) const;
/**
Returns the number of parameters found. This function makes sense
mostly if you had used @c wxCMD_LINE_PARAM_MULTIPLE flag.
*/
size_t GetParamCount() const;
/**
Parse the command line, return 0 if ok, -1 if @c "-h" or @c "--help"
option was encountered and the help message was given or a positive
value if a syntax error occurred.
@param giveUsage
If @true (default), the usage message is given if a syntax error
was encountered while parsing the command line or if help was
requested. If @false, only error messages about possible syntax
errors are given, use Usage to show the usage message from the
caller if needed.
*/
int Parse(bool giveUsage = true);
//@{
/**
Set the command line to parse after using one of the constructors which
don't do it.
*/
void SetCmdLine(int argc, char** argv);
void SetCmdLine(int argc, wchar_t** argv);
void SetCmdLine(const wxString& cmdline);
//@}
/**
Constructs the command line description.
Take the command line description from the wxCMD_LINE_NONE terminated
table.
Example of usage:
@code
static const wxCmdLineEntryDesc cmdLineDesc[] =
{
{ wxCMD_LINE_SWITCH, "v", "verbose", "be verbose" },
{ wxCMD_LINE_SWITCH, "q", "quiet", "be quiet" },
{ wxCMD_LINE_OPTION, "o", "output", "output file" },
{ wxCMD_LINE_OPTION, "i", "input", "input dir" },
{ wxCMD_LINE_OPTION, "s", "size", "output block size", wxCMD_LINE_VAL_NUMBER },
{ wxCMD_LINE_OPTION, "d", "date", "output file date", wxCMD_LINE_VAL_DATE },
{ wxCMD_LINE_PARAM, NULL, NULL, "input file", wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_MULTIPLE },
{ wxCMD_LINE_NONE }
};
wxCmdLineParser parser;
parser.SetDesc(cmdLineDesc);
@endcode
*/
void SetDesc(const wxCmdLineEntryDesc* desc);
/**
The @a logo is some extra text which will be shown by Usage() method.
*/
void SetLogo(const wxString& logo);
/**
@a switchChars contains all characters with which an option or switch
may start. Default is @c "-" for Unix, @c "-/" for Windows.
*/
void SetSwitchChars(const wxString& switchChars);
/**
Give the standard usage message describing all program options. It will
use the options and parameters descriptions specified earlier, so the
resulting message will not be helpful to the user unless the
descriptions were indeed specified.
@see SetLogo()
*/
void Usage() const;
/**
Return the string containing the program usage description.
Call Usage() to directly show this string to the user.
*/
wxString GetUsageString() const;
};

242
interface/wx/cmdproc.h Normal file
View File

@@ -0,0 +1,242 @@
/////////////////////////////////////////////////////////////////////////////
// Name: cmdproc.h
// Purpose: interface of wxCommandProcessor and wxCommand
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxCommand
@wxheader{cmdproc.h}
wxCommand is a base class for modelling an application command, which is an
action usually performed by selecting a menu item, pressing a toolbar
button or any other means provided by the application to change the data or
view.
@library{wxcore}
@category{docview}
@see @ref overview_docview_wxcommand
*/
class wxCommand : public wxObject
{
public:
/**
Constructor. wxCommand is an abstract class, so you will need to derive
a new class and call this constructor from your own constructor.
@param canUndo
Tells the command processor whether this command is undo-able. You
can achieve the same functionality by overriding the CanUndo()
member function (if for example the criteria for undoability is
context-dependent).
@param name
Must be supplied for the command processor to display the command
name in the application's edit menu.
*/
wxCommand(bool canUndo = false, const wxString& name = NULL);
/**
Destructor.
*/
~wxCommand();
/**
Returns @true if the command can be undone, @false otherwise.
*/
bool CanUndo();
/**
Override this member function to execute the appropriate action when
called.
@return @true to indicate that the action has taken place, @false
otherwise. Returning @false will indicate to the command
processor that the action is not undoable and should not be
added to the command history.
*/
bool Do();
/**
Returns the command name.
*/
wxString GetName();
/**
Override this member function to un-execute a previous Do.
How you implement this command is totally application dependent, but
typical strategies include:
- Perform an inverse operation on the last modified piece of data in
the document. When redone, a copy of data stored in command is pasted
back or some operation reapplied. This relies on the fact that you
know the ordering of Undos; the user can never Undo at an arbitrary
position in the command history.
- Restore the entire document state (perhaps using document
transactioning). Potentially very inefficient, but possibly easier to
code if the user interface and data are complex, and an "inverse
execute" operation is hard to write. The docview sample uses the
first method, to remove or restore segments in the drawing.
@return @true to indicate that the action has taken place, @false
otherwise. Returning @false will indicate to the command
processor that the action is not redoable and no change should
be made to the command history.
*/
bool Undo();
};
/**
@class wxCommandProcessor
@wxheader{cmdproc.h}
wxCommandProcessor is a class that maintains a history of wxCommands, with
undo/redo functionality built-in. Derive a new class from this if you want
different behaviour.
@library{wxcore}
@category{docview}
@see @ref overview_docview_wxcommandproc, wxCommand
*/
class wxCommandProcessor : public wxObject
{
public:
/**
Constructor.
@param maxCommands
May be set to a positive integer to limit the number of commands
stored to it, otherwise (and by default) the list of commands can
grow arbitrarily.
*/
wxCommandProcessor(int maxCommands = -1);
/**
Destructor.
*/
~wxCommandProcessor();
/**
Returns @true if the currently-active command can be undone, @false
otherwise.
*/
virtual bool CanUndo();
/**
Deletes all commands in the list and sets the current command pointer
to @NULL.
*/
virtual void ClearCommands();
/**
Returns the list of commands.
*/
wxList& GetCommands() const;
/**
Returns the edit menu associated with the command processor.
*/
wxMenu* GetEditMenu() const;
/**
Returns the maximum number of commands that the command processor
stores.
*/
int GetMaxCommands() const;
/**
Returns the string that will be appended to the Redo menu item.
*/
const wxString& GetRedoAccelerator() const;
/**
Returns the string that will be shown for the redo menu item.
*/
wxString GetRedoMenuLabel() const;
/**
Returns the string that will be appended to the Undo menu item.
*/
const wxString& GetUndoAccelerator() const;
/**
Returns the string that will be shown for the undo menu item.
*/
wxString GetUndoMenuLabel() const;
/**
Initializes the command processor, setting the current command to the
last in the list (if any), and updating the edit menu (if one has been
specified).
*/
virtual void Initialize();
/**
Returns a boolean value that indicates if changes have been made since
the last save operation. This only works if MarkAsSaved() is called
whenever the project is saved.
*/
virtual bool IsDirty();
/**
You must call this method whenever the project is saved if you plan to
use IsDirty().
*/
virtual void MarkAsSaved();
/**
Executes (redoes) the current command (the command that has just been
undone if any).
*/
virtual bool Redo();
/**
Tells the command processor to update the Undo and Redo items on this
menu as appropriate. Set this to @NULL if the menu is about to be
destroyed and command operations may still be performed, or the command
processor may try to access an invalid pointer.
*/
void SetEditMenu(wxMenu* menu);
/**
Sets the menu labels according to the currently set menu and the
current command state.
*/
void SetMenuStrings();
/**
Sets the string that will be appended to the Redo menu item.
*/
void SetRedoAccelerator(const wxString& accel);
/**
Sets the string that will be appended to the Undo menu item.
*/
void SetUndoAccelerator(const wxString& accel);
/**
Submits a new command to the command processor. The command processor
calls wxCommand::Do() to execute the command; if it succeeds, the
command is stored in the history list, and the associated edit menu (if
any) updated appropriately. If it fails, the command is deleted
immediately. Once Submit() has been called, the passed command should
not be deleted directly by the application.
@param storeIt
Indicates whether the successful command should be stored in the
history list.
*/
virtual bool Submit(wxCommand* command, bool storeIt = true);
/**
Undoes the last command executed.
*/
virtual bool Undo();
};

846
interface/wx/cmndata.h Normal file
View File

@@ -0,0 +1,846 @@
/////////////////////////////////////////////////////////////////////////////
// Name: cmndata.h
// Purpose: interface of common wx*Data classes (font, colour, print)
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxFontData
@wxheader{cmndata.h}
This class holds a variety of information related to font dialogs.
@library{wxcore}
@category{cmndlg}
@see @ref overview_cmndlg_font, wxFont, wxFontDialog
*/
class wxFontData : public wxObject
{
public:
/**
Constructor. Initializes @e fontColour to black, @e showHelp to @false,
@e allowSymbols to @true, @e enableEffects to @true, @e minSize to 0
and @e maxSize to 0.
*/
wxFontData();
/**
Enables or disables "effects" under Windows or generic only. This
refers to the controls for manipulating colour, strikeout and underline
properties.
The default value is @true.
*/
void EnableEffects(bool enable);
/**
Under Windows, returns a flag determining whether symbol fonts can be
selected. Has no effect on other platforms.
The default value is @true.
*/
bool GetAllowSymbols();
/**
Gets the font chosen by the user if the user pressed OK
(wxFontDialog::ShowModal() returned wxID_OK).
*/
wxFont GetChosenFont();
/**
Gets the colour associated with the font dialog.
The default value is black.
*/
wxColour& GetColour();
/**
Determines whether "effects" are enabled under Windows. This refers to
the controls for manipulating colour, strikeout and underline
properties.
The default value is @true.
*/
bool GetEnableEffects();
/**
Gets the font that will be initially used by the font dialog. This
should have previously been set by the application.
*/
wxFont GetInitialFont();
/**
Returns @true if the Help button will be shown (Windows only).
The default value is @false.
*/
bool GetShowHelp();
/**
Under Windows, determines whether symbol fonts can be selected. Has no
effect on other platforms.
The default value is @true.
*/
void SetAllowSymbols(bool allowSymbols);
/**
Sets the font that will be returned to the user (for internal use
only).
*/
void SetChosenFont(const wxFont& font);
/**
Sets the colour that will be used for the font foreground colour.
The default colour is black.
*/
void SetColour(const wxColour& colour);
/**
Sets the font that will be initially used by the font dialog.
*/
void SetInitialFont(const wxFont& font);
/**
Sets the valid range for the font point size (Windows only).
The default is 0, 0 (unrestricted range).
*/
void SetRange(int min, int max);
/**
Determines whether the Help button will be displayed in the font dialog
(Windows only).
The default value is @false.
*/
void SetShowHelp(bool showHelp);
/**
Assignment operator for the font data.
*/
void operator =(const wxFontData& data);
};
/**
@class wxPageSetupDialogData
@wxheader{cmndata.h}
This class holds a variety of information related to wxPageSetupDialog.
It contains a wxPrintData member which is used to hold basic printer
configuration data (as opposed to the user-interface configuration settings
stored by wxPageSetupDialogData).
@library{wxcore}
@category{printing}
@see @ref overview_printing, wxPageSetupDialog
*/
class wxPageSetupDialogData : public wxObject
{
public:
/**
Default constructor.
*/
wxPageSetupDialogData();
/**
Copy constructor.
*/
wxPageSetupDialogData(wxPageSetupDialogData& data);
/**
Construct an object from a print data object.
*/
wxPageSetupDialogData(wxPrintData& printData);
/**
Destructor.
*/
~wxPageSetupDialogData();
/**
Enables or disables the "Help" button (Windows only).
*/
void EnableHelp(bool flag);
/**
Enables or disables the margin controls (Windows only).
*/
void EnableMargins(bool flag);
/**
Enables or disables the orientation control (Windows only).
*/
void EnableOrientation(bool flag);
/**
Enables or disables the paper size control (Windows only).
*/
void EnablePaper(bool flag);
/**
Enables or disables the "Printer" button, which invokes a printer setup
dialog.
*/
void EnablePrinter(bool flag);
/**
Returns @true if the dialog will simply return default printer
information (such as orientation) instead of showing a dialog (Windows
only).
*/
bool GetDefaultInfo() const;
/**
Returns @true if the page setup dialog will take its minimum margin
values from the currently selected printer properties (Windows only).
*/
bool GetDefaultMinMargins() const;
/**
Returns @true if the printer setup button is enabled.
*/
bool GetEnableHelp() const;
/**
Returns @true if the margin controls are enabled (Windows only).
*/
bool GetEnableMargins() const;
/**
Returns @true if the orientation control is enabled (Windows only).
*/
bool GetEnableOrientation() const;
/**
Returns @true if the paper size control is enabled (Windows only).
*/
bool GetEnablePaper() const;
/**
Returns @true if the printer setup button is enabled.
*/
bool GetEnablePrinter() const;
/**
Returns the right (x) and bottom (y) margins in millimetres.
*/
wxPoint GetMarginBottomRight() const;
/**
Returns the left (x) and top (y) margins in millimetres.
*/
wxPoint GetMarginTopLeft() const;
/**
Returns the right (x) and bottom (y) minimum margins the user can enter
(Windows only). Units are in millimetres.
*/
wxPoint GetMinMarginBottomRight() const;
/**
Returns the left (x) and top (y) minimum margins the user can enter
(Windows only). Units are in millimetres.
*/
wxPoint GetMinMarginTopLeft() const;
/**
Returns the paper id (stored in the internal wxPrintData object).
@see wxPrintData::SetPaperId()
*/
wxPaperSize GetPaperId() const;
/**
Returns the paper size in millimetres.
*/
wxSize GetPaperSize() const;
/**
Returns a reference to the print data associated with this object.
*/
wxPrintData GetPrintData();
/**
Returns @true if the print data associated with the dialog data is
valid. This can return @false on Windows if the current printer is not
set, for example. On all other platforms, it returns @true.
*/
bool IsOk() const;
/**
Pass @true if the dialog will simply return default printer information
(such as orientation) instead of showing a dialog (Windows only).
*/
void SetDefaultInfo(bool flag);
/**
Pass @true if the page setup dialog will take its minimum margin values
from the currently selected printer properties (Windows only). Units
are in millimetres.
*/
void SetDefaultMinMargins(bool flag);
/**
Sets the right (x) and bottom (y) margins in millimetres.
*/
void SetMarginBottomRight(const wxPoint& pt);
/**
Sets the left (x) and top (y) margins in millimetres.
*/
void SetMarginTopLeft(const wxPoint& pt);
/**
Sets the right (x) and bottom (y) minimum margins the user can enter
(Windows only). Units are in millimetres.
*/
void SetMinMarginBottomRight(const wxPoint& pt);
/**
Sets the left (x) and top (y) minimum margins the user can enter
(Windows only). Units are in millimetres.
*/
void SetMinMarginTopLeft(const wxPoint& pt);
/**
Sets the paper size id. Calling this function overrides the explicit
paper dimensions passed in SetPaperSize().
@see wxPrintData::SetPaperId()
*/
void SetPaperId(wxPaperSize& id);
/**
Sets the paper size in millimetres. If a corresponding paper id is
found, it will be set in the internal wxPrintData object, otherwise the
paper size overrides the paper id.
*/
void SetPaperSize(const wxSize& size);
/**
Sets the print data associated with this object.
*/
void SetPrintData(const wxPrintData& printData);
/**
Assigns print data to this object.
*/
void operator =(const wxPrintData& data);
/**
Assigns page setup data to this object.
*/
void operator =(const wxPageSetupDialogData& data);
};
/**
@class wxColourData
@wxheader{cmndata.h}
This class holds a variety of information related to colour dialogs.
@library{wxcore}
@category{cmndlg}
@see wxColour, wxColourDialog, @ref overview_cmndlg_colour
*/
class wxColourData : public wxObject
{
public:
/**
Constructor. Initializes the custom colours to @c wxNullColour, the
@e data colour setting to black, and the @e choose full setting to
@true.
*/
wxColourData();
/**
Destructor.
*/
~wxColourData();
/**
Under Windows, determines whether the Windows colour dialog will
display the full dialog with custom colour selection controls. Under
PalmOS, determines whether colour dialog will display full rgb colour
picker or only available palette indexer. Has no meaning under other
platforms.
The default value is @true.
*/
bool GetChooseFull() const;
/**
Gets the current colour associated with the colour dialog.
The default colour is black.
*/
wxColour& GetColour() const;
/**
Returns custom colours associated with the colour dialog.
@param i
An integer between 0 and 15, being any of the 15 custom colours
that the user has saved. The default custom colours are invalid
colours.
*/
wxColour& GetCustomColour(int i) const;
/**
Under Windows, tells the Windows colour dialog to display the full
dialog with custom colour selection controls. Under other platforms,
has no effect.
The default value is @true.
*/
void SetChooseFull(const bool flag);
/**
Sets the default colour for the colour dialog.
The default colour is black.
*/
void SetColour(const wxColour& colour);
/**
Sets custom colours for the colour dialog.
@param i
An integer between 0 and 15 for whatever custom colour you want to
set. The default custom colours are invalid colours.
*/
void SetCustomColour(int i, const wxColour& colour);
/**
Assignment operator for the colour data.
*/
void operator =(const wxColourData& data);
};
/**
Enumeration of various printer bin sources.
@see wxPrintData::SetBin()
*/
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,
};
/**
@class wxPrintData
@wxheader{cmndata.h}
This class holds a variety of information related to printers and printer
device contexts. This class is used to create a wxPrinterDC and a
wxPostScriptDC. It is also used as a data member of wxPrintDialogData and
wxPageSetupDialogData, as part of the mechanism for transferring data
between the print dialogs and the application.
@remarks
The following functions are specific to PostScript printing and have not
yet been documented:
@code
const wxString& GetPrinterCommand() const ;
const wxString& GetPrinterOptions() const ;
const wxString& GetPreviewCommand() const ;
const wxString& GetFilename() const ;
const wxString& GetFontMetricPath() const ;
double GetPrinterScaleX() const ;
double GetPrinterScaleY() const ;
long GetPrinterTranslateX() const ;
long GetPrinterTranslateY() const ;
// wxPRINT_MODE_PREVIEW, wxPRINT_MODE_FILE, wxPRINT_MODE_PRINTER
wxPrintMode GetPrintMode() const ;
void SetPrinterCommand(const wxString& command) ;
void SetPrinterOptions(const wxString& options) ;
void SetPreviewCommand(const wxString& command) ;
void SetFilename(const wxString& filename) ;
void SetFontMetricPath(const wxString& path) ;
void SetPrinterScaleX(double x) ;
void SetPrinterScaleY(double y) ;
void SetPrinterScaling(double x, double y) ;
void SetPrinterTranslateX(long x) ;
void SetPrinterTranslateY(long y) ;
void SetPrinterTranslation(long x, long y) ;
void SetPrintMode(wxPrintMode printMode) ;
@endcode
@library{wxcore}
@category{printing}
@see @ref overview_printing, wxPrintDialog, wxPageSetupDialog,
wxPrintDialogData, wxPageSetupDialogData, @ref overview_cmndlg_print,
wxPrinterDC, wxPostScriptDC
*/
class wxPrintData : public wxObject
{
public:
/**
Default constructor.
*/
wxPrintData();
/**
Copy constructor.
*/
wxPrintData(const wxPrintData& data);
/**
Destructor.
*/
~wxPrintData();
/**
Returns the current bin (papersource). By default, the system is left
to select the bin (@c wxPRINTBIN_DEFAULT is returned).
See SetBin() for the full list of bin values.
*/
wxPrintBin GetBin() const;
/**
Returns @true if collation is on.
*/
bool GetCollate() const;
/**
Returns @true if colour printing is on.
*/
bool GetColour() const;
/**
Returns the duplex mode. One of wxDUPLEX_SIMPLEX, wxDUPLEX_HORIZONTAL,
wxDUPLEX_VERTICAL.
*/
wxDuplexMode GetDuplex() const;
/**
Returns the number of copies requested by the user.
*/
int GetNoCopies() const;
/**
Gets the orientation. This can be wxLANDSCAPE or wxPORTRAIT.
*/
int GetOrientation() const;
/**
Returns the paper size id.
@see SetPaperId()
*/
wxPaperSize GetPaperId() const;
/**
Returns the printer name. If the printer name is the empty string, it
indicates that the default printer should be used.
*/
const wxString GetPrinterName() const;
/**
Returns the current print quality. This can be a positive integer,
denoting the number of dots per inch, or one of the following
identifiers:
- wxPRINT_QUALITY_HIGH
- wxPRINT_QUALITY_MEDIUM
- wxPRINT_QUALITY_LOW
- wxPRINT_QUALITY_DRAFT
On input you should pass one of these identifiers, but on return you
may get back a positive integer indicating the current resolution
setting.
*/
wxPrintQuality GetQuality() const;
/**
Returns @true if the print data is valid for using in print dialogs.
This can return @false on Windows if the current printer is not set,
for example. On all other platforms, it returns @true.
*/
bool IsOk() const;
/**
Sets the current bin.
*/
void SetBin(wxPrintBin flag);
/**
Sets collation to on or off.
*/
void SetCollate(bool flag);
/**
Sets colour printing on or off.
*/
void SetColour(bool flag);
/**
Returns the duplex mode. One of wxDUPLEX_SIMPLEX, wxDUPLEX_HORIZONTAL,
wxDUPLEX_VERTICAL.
*/
void SetDuplex(wxDuplexMode mode);
/**
Sets the default number of copies to be printed out.
*/
void SetNoCopies(int n);
/**
Sets the orientation. This can be wxLANDSCAPE or wxPORTRAIT.
*/
void SetOrientation(int orientation);
/**
Sets the paper id. This indicates the type of paper to be used. For a
mapping between paper id, paper size and string name, see
wxPrintPaperDatabase in @c "paper.h" (not yet documented).
*/
void SetPaperId(wxPaperSize paperId);
/**
Sets the printer name. This can be the empty string to indicate that
the default printer should be used.
*/
void SetPrinterName(const wxString& printerName);
/**
Sets the desired print quality. This can be a positive integer,
denoting the number of dots per inch, or one of the following
identifiers:
- wxPRINT_QUALITY_HIGH
- wxPRINT_QUALITY_MEDIUM
- wxPRINT_QUALITY_LOW
- wxPRINT_QUALITY_DRAFT
On input you should pass one of these identifiers, but on return you
may get back a positive integer indicating the current resolution
setting.
*/
void SetQuality(wxPrintQuality quality);
/**
Assigns print data to this object.
*/
void operator =(const wxPrintData& data);
};
/**
@class wxPrintDialogData
@wxheader{cmndata.h}
This class holds information related to the visual characteristics of
wxPrintDialog. It contains a wxPrintData object with underlying printing
settings.
@library{wxcore}
@category{printing}
@see @ref overview_printing, wxPrintDialog, @ref overview_cmndlg_print
*/
class wxPrintDialogData : public wxObject
{
public:
/**
Default constructor.
*/
wxPrintDialogData();
/**
Copy constructor.
*/
wxPrintDialogData(wxPrintDialogData& dialogData);
/**
Construct an object from a print dialog data object.
*/
wxPrintDialogData(wxPrintData& printData);
/**
Destructor.
*/
~wxPrintDialogData();
/**
Enables or disables the "Help" button.
*/
void EnableHelp(bool flag);
/**
Enables or disables the "Page numbers" controls.
*/
void EnablePageNumbers(bool flag);
/**
Enables or disables the "Print to file" checkbox.
*/
void EnablePrintToFile(bool flag);
/**
Enables or disables the "Selection" radio button.
*/
void EnableSelection(bool flag);
/**
Returns @true if the user requested that all pages be printed.
*/
bool GetAllPages() const;
/**
Returns @true if the user requested that the document(s) be collated.
*/
bool GetCollate() const;
/**
Returns the @e from page number, as entered by the user.
*/
int GetFromPage() const;
/**
Returns the @e maximum page number.
*/
int GetMaxPage() const;
/**
Returns the @e minimum page number.
*/
int GetMinPage() const;
/**
Returns the number of copies requested by the user.
*/
int GetNoCopies() const;
/**
Returns a reference to the internal wxPrintData object.
*/
wxPrintData& GetPrintData();
/**
Returns @true if the user has selected printing to a file.
*/
bool GetPrintToFile() const;
/**
Returns @true if the user requested that the selection be printed
(where "selection" is a concept specific to the application).
*/
bool GetSelection() const;
/**
Returns the @e "print to" page number, as entered by the user.
*/
int GetToPage() const;
/**
Returns @true if the print data is valid for using in print dialogs.
This can return @false on Windows if the current printer is not set,
for example. On all other platforms, it returns @true.
*/
bool IsOk() const;
/**
Sets the "Collate" checkbox to @true or @false.
*/
void SetCollate(bool flag);
/**
Sets the @e from page number.
*/
void SetFromPage(int page);
/**
Sets the @e maximum page number.
*/
void SetMaxPage(int page);
/**
Sets the @e minimum page number.
*/
void SetMinPage(int page);
/**
Sets the default number of copies the user has requested to be printed
out.
*/
void SetNoCopies(int n);
/**
Sets the internal wxPrintData.
*/
void SetPrintData(const wxPrintData& printData);
/**
Sets the "Print to file" checkbox to @true or @false.
*/
void SetPrintToFile(bool flag);
/**
Selects the "Selection" radio button. The effect of printing the
selection depends on how the application implements this command, if at
all.
*/
void SetSelection(bool flag);
/**
@deprecated This function has been deprecated since version 2.5.4.
Determines whether the dialog to be shown will be the Print dialog
(pass @false) or Print Setup dialog (pass @true).
*/
void SetSetupDialog(bool flag);
/**
Sets the @e "print to" page number.
*/
void SetToPage(int page);
/**
Assigns print data to this object.
*/
void operator =(const wxPrintData& data);
/**
Assigns another print dialog data object to this object.
*/
void operator =(const wxPrintDialogData& data);
};

176
interface/wx/collpane.h Normal file
View File

@@ -0,0 +1,176 @@
/////////////////////////////////////////////////////////////////////////////
// Name: collpane.h
// Purpose: interface of wxCollapsiblePane
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxCollapsiblePaneEvent
@wxheader{collpane.h}
This event class is used for the events generated by wxCollapsiblePane.
@beginEventTable{wxCollapsiblePaneEvent}
@event{EVT_COLLAPSIBLEPANE_CHANGED(id, func)}
The user expanded or collapsed the collapsible pane.
@endEventTable
@library{wxcore}
@category{events}
@see wxCollapsiblePane
*/
class wxCollapsiblePaneEvent : public wxCommandEvent
{
public:
/**
The constructor is not normally used by the user code.
*/
wxCollapsiblePaneEvent(wxObject* generator, int id, bool collapsed);
/**
Returns @true if the pane has been collapsed.
*/
bool GetCollapsed() const;
/**
Sets this as a collapsed pane event (if @a collapsed is @true) or as an
expanded pane event (if @a collapsed is @false).
*/
void SetCollapsed(bool collapsed);
};
/**
@class wxCollapsiblePane
@wxheader{collpane.h}
A collapsible pane is a container with an embedded button-like control
which can be used by the user to collapse or expand the pane's contents.
Once constructed you should use the GetPane() function to access the pane
and add your controls inside it (i.e. use the returned pointer from
GetPane() as parent for the controls which must go in the pane, @b not the
wxCollapsiblePane itself!).
Note that because of its nature of control which can dynamically (and
drastically) change its size at run-time under user-input, when putting
wxCollapsiblePane inside a wxSizer you should be careful to add it with a
proportion value of zero; this is because otherwise all other windows with
non-null proportion values will automatically resize each time the user
expands or collapse the pane window usually resulting in a weird,
flickering effect.
Usage sample:
@code
wxCollapsiblePane *collpane = new wxCollapsiblePane(this, wxID_ANY, wxT("Details:"));
// add the pane with a zero proportion value to the 'sz' sizer which contains it
sz->Add(collpane, 0, wxGROW|wxALL, 5);
// now add a test label in the collapsible pane using a sizer to layout it:
wxWindow *win = collpane->GetPane();
wxSizer *paneSz = new wxBoxSizer(wxVERTICAL);
paneSz->Add(new wxStaticText(win, wxID_ANY, wxT("test!")), 1, wxGROW|wxALL, 2);
win->SetSizer(paneSz);
paneSz->SetSizeHints(win);
@endcode
It is only available if @c wxUSE_COLLPANE is set to 1 (the default).
@beginStyleTable
@style{wxCP_DEFAULT_STYLE}
The default style: 0.
@endStyleTable
@beginEventTable{wxCollapsiblePaneEvent}
@event{EVT_COLLAPSIBLEPANE_CHANGED(id, func)}
The user expanded or collapsed the collapsible pane.
@endEventTable
@library{wxcore}
@category{ctrl}
<!-- @appearance{collapsiblepane.png} -->
@see wxPanel, wxCollapsiblePaneEvent
*/
class wxCollapsiblePane : public wxControl
{
public:
/**
Default constructor.
*/
wxCollapsiblePane();
/**
Initializes the object and calls Create() with all the parameters.
*/
wxCollapsiblePane(wxWindow* parent, wxWindowID id,
const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxCP_DEFAULT_STYLE,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = "collapsiblePane");
/**
@param parent
Parent window, must not be non-@NULL.
@param id
The identifier for the control.
@param label
The initial label shown in the button which allows the user to
expand or collapse the pane window.
@param pos
Initial position.
@param size
Initial size.
@param style
The window style, see wxCP_* flags.
@param validator
Validator which can be used for additional date checks.
@param name
Control name.
@return @true if the control was successfully created or @false if
creation failed.
*/
bool Create(wxWindow* parent, wxWindowID id,
const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxCP_DEFAULT_STYLE,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = "collapsiblePane");
/**
Collapses or expands the pane window.
*/
void Collapse(bool collapse = true);
/**
Same as calling Collapse(@false).
*/
void Expand();
/**
Returns a pointer to the pane window. Add controls to the returned
wxWindow to make them collapsible.
*/
wxWindow* GetPane() const;
/**
Returns @true if the pane window is currently hidden.
*/
bool IsCollapsed() const;
/**
Returns @true if the pane window is currently shown.
*/
bool IsExpanded() const;
};

93
interface/wx/colordlg.h Normal file
View File

@@ -0,0 +1,93 @@
/////////////////////////////////////////////////////////////////////////////
// Name: colordlg.h
// Purpose: interface of wxColourDialog
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxColourDialog
@wxheader{colordlg.h}
This class represents the colour chooser dialog.
@library{wxcore}
@category{cmndlg}
@see @ref overview_cmndlg_colour, wxColour, wxColourData,
wxGetColourFromUser()
*/
class wxColourDialog : public wxDialog
{
public:
/**
Constructor. Pass a parent window, and optionally a pointer to a block
of colour data, which will be copied to the colour dialog's colour
data.
Custom colours from colour data object will be be used in the dialog's
colour palette. Invalid entries in custom colours list will be ignored
on some platforms(GTK) or replaced with white colour on platforms where
custom colours palette has fixed size (MSW).
@see wxColourData
*/
wxColourDialog(wxWindow* parent, wxColourData* data = NULL);
/**
Destructor.
*/
~wxColourDialog();
/**
Same as wxColourDialog().
*/
bool Create(wxWindow* parent, wxColourData* data = NULL);
/**
Returns the colour data associated with the colour dialog.
*/
wxColourData GetColourData();
/**
Shows the dialog, returning wxID_OK if the user pressed OK, and
wxID_CANCEL otherwise.
*/
int ShowModal();
};
// ============================================================================
// Global functions/macros
// ============================================================================
/** @ingroup group_funcmacro_dialog */
//@{
/**
Shows the colour selection dialog and returns the colour selected by user
or invalid colour (use wxColour::IsOk() to test whether a colour is valid)
if the dialog was cancelled.
@param parent
The parent window for the colour selection dialog.
@param colInit
If given, this will be the colour initially selected in the dialog.
@param caption
If given, this will be used for the dialog caption.
@param data
Optional object storing additional colour dialog settings, such as
custom colours. If none is provided the same settings as the last time
are used.
@header{wx/colordlg.h}
*/
wxColour wxGetColourFromUser(wxWindow* parent,
const wxColour& colInit,
const wxString& caption = wxEmptyString,
wxColourData* data = NULL);
//@}

213
interface/wx/colour.h Normal file
View File

@@ -0,0 +1,213 @@
/////////////////////////////////////////////////////////////////////////////
// Name: colour.h
// Purpose: interface of wxColour
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxColour
@wxheader{colour.h}
A colour is an object representing a combination of Red, Green, and Blue
(RGB) intensity values, and is used to determine drawing colours. See the
entry for wxColourDatabase for how a pointer to a predefined, named colour
may be returned instead of creating a new colour.
Valid RGB values are in the range 0 to 255.
You can retrieve the current system colour settings with wxSystemSettings.
@library{wxcore}
@category{gdi}
@stdobjects
- ::wxNullColour - An empty, invalid colour.
- ::wxBLACK
- ::wxBLUE
- ::wxCYAN
- ::wxGREEN
- ::wxLIGHT_GREY
- ::wxRED
- ::wxWHITE
@see wxColourDatabase, wxPen, wxBrush, wxColourDialog, wxSystemSettings
*/
class wxColour : public wxObject
{
public:
/**
Default constructor.
*/
wxColour();
/**
@param red
The red value.
@param green
The green value.
@param blue
The blue value.
@param alpha
The alpha value. Alpha values range from 0 (wxALPHA_TRANSPARENT) to
255 (wxALPHA_OPAQUE).
*/
wxColour(unsigned char red, unsigned char green, unsigned char blue,
unsigned char alpha = wxALPHA_OPAQUE);
/**
@param colourName
The colour name.
*/
wxColour(const wxString& colourName);
/**
Copy constructor.
*/
wxColour(const wxColour& colour);
/**
Returns the alpha value, on platforms where alpha is not yet supported, this
always returns wxALPHA_OPAQUE.
*/
unsigned char Alpha() const;
/**
Returns the blue intensity.
*/
unsigned char Blue() const;
/**
Converts this colour to a wxString using the given flags.
The supported flags are wxC2S_NAME, to obtain the colour name (e.g.
wxColour(255,0,0) == "red"), wxC2S_CSS_SYNTAX, to obtain the colour in
the "rgb(r,g,b)" or "rgba(r,g,b,a)" syntax (e.g.
wxColour(255,0,0,85) == "rgba(255,0,0,0.333)"), and wxC2S_HTML_SYNTAX,
to obtain the colour as "#" followed by 6 hexadecimal digits (e.g.
wxColour(255,0,0) == "#FF0000").
This function never fails and always returns a non-empty string but
asserts if the colour has alpha channel (i.e. is non opaque) but
wxC2S_CSS_SYNTAX (which is the only one supporting alpha) is not
specified in flags.
@since 2.7.0
*/
wxString GetAsString(long flags);
/**
Returns a pixel value which is platform-dependent. On Windows, a COLORREF is
returned.
On X, an allocated pixel value is returned.
-1 is returned if the pixel is invalid (on X, unallocated).
*/
long GetPixel() const;
/**
Returns the green intensity.
*/
unsigned char Green() const;
/**
Returns @true if the colour object is valid (the colour has been initialised
with RGB values).
*/
bool IsOk() const;
/**
Returns the red intensity.
*/
unsigned char Red() const;
//@{
/**
Sets the RGB intensity values using the given values (first overload),
extracting them from the packed long (second overload), using the given
string (third overloard).
When using third form, Set() accepts: colour names (those listed in
wxTheColourDatabase()), the CSS-like @c "rgb(r,g,b)" or
@c "rgba(r,g,b,a)" syntax (case insensitive) and the HTML-like syntax
(i.e. @c "#" followed by 6 hexadecimal digits for red, green, blue
components).
Returns @true if the conversion was successful, @false otherwise.
@since 2.7.0
*/
void Set(unsigned char red, unsigned char green,
unsigned char blue,
unsigned char alpha = wxALPHA_OPAQUE);
void Set(unsigned long RGB);
bool Set(const wxString& str);
//@}
/**
Tests the inequality of two colours by comparing individual red, green, blue
colours and alpha values.
*/
bool operator !=(const wxColour& colour);
//@{
/**
Assignment operator, using a colour name to be found in the colour database.
@see wxColourDatabase
*/
wxColour operator =(const wxColour& colour);
wxColour operator =(const wxString& colourName);
//@}
/**
Tests the equality of two colours by comparing individual red, green, blue
colours and alpha values.
*/
bool operator ==(const wxColour& colour);
};
/** @name Predefined colors. */
//@{
wxColour wxNullColour;
wxColour* wxBLACK;
wxColour* wxBLUE;
wxColour* wxCYAN;
wxColour* wxGREEN;
wxColour* wxLIGHT_GREY;
wxColour* wxRED;
wxColour* wxWHITE;
//@}
// ============================================================================
// Global functions/macros
// ============================================================================
/** @ingroup group_funcmacro_misc */
//@{
/**
Converts string to a wxColour best represented by the given string. Returns
@true on success.
@see wxToString(const wxColour&)
@header{wx/colour.h}
*/
bool wxFromString(const wxString& string, wxColour* colour);
/**
Converts the given wxColour into a string.
@see wxFromString(const wxString&, wxColour*)
@header{wx/colour.h}
*/
wxString wxToString(const wxColour& colour);
//@}

755
interface/wx/combo.h Normal file
View File

@@ -0,0 +1,755 @@
/////////////////////////////////////////////////////////////////////////////
// Name: combo.h
// Purpose: interface of wxComboCtrl and wxComboPopup
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxComboPopup
@wxheader{combo.h}
In order to use a custom popup with wxComboCtrl, an interface class must be
derived from wxComboPopup.
For more information on how to use it, see @ref comboctrl_custompopup.
@library{wxcore}
@category{ctrl}
@see wxComboCtrl
*/
class wxComboPopup
{
public:
/**
Default constructor. It is recommended that internal variables are
prepared in Init() instead (because m_combo is not valid in
constructor).
*/
wxComboPopup();
/**
The derived class must implement this to create the popup control.
@return @true if the call succeeded, @false otherwise.
*/
virtual bool Create(wxWindow* parent);
/**
Utility function that hides the popup.
*/
void Dismiss();
/**
The derived class may implement this to return adjusted size for the
popup control, according to the variables given.
@param minWidth
Preferred minimum width.
@param prefHeight
Preferred height. May be -1 to indicate no preference.
@param maxWidth
Max height for window, as limited by screen size.
@remarks This function is called each time popup is about to be shown.
*/
virtual wxSize GetAdjustedSize(int minWidth, int prefHeight, int maxHeight);
/**
The derived class must implement this to return pointer to the
associated control created in Create().
*/
virtual wxWindow* GetControl();
/**
The derived class must implement this to return string representation
of the value.
*/
virtual wxString GetStringValue() const;
/**
The derived class must implement this to initialize its internal
variables. This method is called immediately after construction
finishes. m_combo member variable has been initialized before the call.
*/
virtual void Init();
/**
Utility method that returns @true if Create has been called.
Useful in conjunction with LazyCreate().
*/
bool IsCreated() const;
/**
The derived class may implement this to return @true if it wants to
delay call to Create() until the popup is shown for the first time. It
is more efficient, but on the other hand it is often more convenient to
have the control created immediately.
@remarks Base implementation returns @false.
*/
virtual bool LazyCreate();
/**
The derived class may implement this to do something when the parent
wxComboCtrl gets double-clicked.
*/
virtual void OnComboDoubleClick();
/**
The derived class may implement this to receive key events from the
parent wxComboCtrl.
Events not handled should be skipped, as usual.
*/
virtual void OnComboKeyEvent(wxKeyEvent& event);
/**
The derived class may implement this to do special processing when
popup is hidden.
*/
virtual void OnDismiss();
/**
The derived class may implement this to do special processing when
popup is shown.
*/
virtual void OnPopup();
/**
The derived class may implement this to paint the parent wxComboCtrl.
Default implementation draws value as string.
*/
virtual void PaintComboControl(wxDC& dc, const wxRect& rect);
/**
The derived class must implement this to receive string value changes
from wxComboCtrl.
*/
virtual void SetStringValue(const wxString& value);
/**
Parent wxComboCtrl. This is parameter has been prepared before Init()
is called.
*/
wxComboCtrl m_combo;
};
/**
Features enabled for wxComboCtrl.
@see wxComboCtrl::GetFeatures()
*/
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, ///< wxComboCtrl::SetTextIndent() can be used.
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.
All = MovableButton | BitmapButton | ButtonSpacing |
TextIndent | PaintControl | PaintWritable |
Borderless ///< All features.
};
};
/**
@class wxComboCtrl
@wxheader{combo.h}
A combo control is a generic combobox that allows totally custom popup. In
addition it has other customization features. For instance, position and
size of the dropdown button can be changed.
@section comboctrl_custompopup Setting Custom Popup for wxComboCtrl
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
SetStringValue("initial text value") and wxControl doesn't have such
method. So we also need a wxComboPopup which is an 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 a wxWidgets control and from it,
so instead it is just a mix-in.
Here's a minimal sample of wxListView popup:
@code
#include <wx/combo.h>
#include <wx/listctrl.h>
class wxListViewComboPopup : public wxListView, public wxComboPopup
{
public:
// Initialize member variables
virtual void Init()
{
m_value = -1;
}
// Create popup control
virtual bool Create(wxWindow* parent)
{
return wxListView::Create(parent,1,wxPoint(0,0),wxDefaultSize);
}
// Return pointer to the created control
virtual wxWindow *GetControl() { return this; }
// Translate string into a list selection
virtual void SetStringValue(const wxString& s)
{
int n = wxListView::FindItem(-1,s);
if ( n >= 0 && n < wxListView::GetItemCount() )
wxListView::Select(n);
}
// Get list selection as a string
virtual wxString GetStringValue() const
{
if ( m_value >= 0 )
return wxListView::GetItemText(m_value);
return wxEmptyString;
}
// Do mouse hot-tracking (which is typical in list popups)
void OnMouseMove(wxMouseEvent& event)
{
// TODO: Move selection to cursor
}
// On mouse left up, set the value and close the popup
void OnMouseClick(wxMouseEvent& WXUNUSED(event))
{
m_value = wxListView::GetFirstSelected();
// TODO: Send event as well
Dismiss();
}
protected:
int m_value; // current item index
private:
DECLARE_EVENT_TABLE()
};
BEGIN_EVENT_TABLE(wxListViewComboPopup, wxListView)
EVT_MOTION(wxListViewComboPopup::OnMouseMove)
EVT_LEFT_UP(wxListViewComboPopup::OnMouseClick)
END_EVENT_TABLE()
@endcode
Here's how you would create and populate it in a dialog constructor:
@code
wxComboCtrl* comboCtrl = new wxComboCtrl(this, wxID_ANY, wxEmptyString);
wxListViewComboPopup* popupCtrl = new wxListViewComboPopup();
comboCtrl->SetPopupControl(popupCtrl);
// Populate using wxListView methods
popupCtrl->InsertItem(popupCtrl->GetItemCount(), "First Item");
popupCtrl->InsertItem(popupCtrl->GetItemCount(), "Second Item");
popupCtrl->InsertItem(popupCtrl->GetItemCount(), "Third Item");
@endcode
@beginStyleTable
@style{wxCB_READONLY}
Text will not be editable.
@style{wxCB_SORT}
Sorts the entries in the list alphabetically.
@style{wxTE_PROCESS_ENTER}
The control will generate the event wxEVT_COMMAND_TEXT_ENTER
(otherwise pressing Enter key is either processed internally by the
control or used for navigation between dialog controls). Windows
only.
@style{wxCC_SPECIAL_DCLICK}
Double-clicking triggers a call to popup's OnComboDoubleClick.
Actual behaviour is defined by a derived class. For instance,
wxOwnerDrawnComboBox will cycle an item. This style only applies if
wxCB_READONLY is used as well.
@style{wxCC_STD_BUTTON}
Drop button will behave more like a standard push button.
@endStyleTable
@beginEventTable{wxCommandEvent}
@event{EVT_TEXT(id, func)}
Process a wxEVT_COMMAND_TEXT_UPDATED event, when the text changes.
@event{EVT_TEXT_ENTER(id, func)}
Process a wxEVT_COMMAND_TEXT_ENTER event, when RETURN is pressed in
the combo control.
@endEventTable
@library{wxbase}
@category{ctrl}
<!-- @appearance{comboctrl.png} -->
@see wxComboBox, wxChoice, wxOwnerDrawnComboBox, wxComboPopup,
wxCommandEvent
*/
class wxComboCtrl : public wxControl
{
public:
/**
Default constructor.
*/
wxComboCtrl();
/**
Constructor, creating and showing a combo control.
@param parent
Parent window. Must not be @NULL.
@param id
Window identifier. The value wxID_ANY indicates a default value.
@param value
Initial selection string. An empty string indicates no selection.
@param pos
Window position.
@param size
Window size. If wxDefaultSize is specified then the window is sized
appropriately.
@param style
Window style. See wxComboCtrl.
@param validator
Window validator.
@param name
Window name.
@see Create(), wxValidator
*/
wxComboCtrl(wxWindow* parent, wxWindowID id,
const wxString& value = "",
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = "comboCtrl");
/**
Destructor, destroying the combo control.
*/
virtual ~wxComboCtrl();
/**
This member function is not normally called in application code.
Instead, it can be implemented in a derived class to create a custom
popup animation.
The parameters are the same as those for DoShowPopup().
@return @true if animation finishes before the function returns,
@false otherwise. In the latter case you need to manually call
DoShowPopup() after the animation ends.
*/
virtual bool AnimateShow(const wxRect& rect, int flags);
/**
Copies the selected text to the clipboard.
*/
virtual void Copy();
/**
Creates the combo control for two-step construction. Derived classes
should call or replace this function. See wxComboCtrl() for further
details.
*/
bool Create(wxWindow* parent, wxWindowID id,
const wxString& value = "",
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = "comboCtrl");
/**
Copies the selected text to the clipboard and removes the selection.
*/
virtual void Cut();
/**
This member function is not normally called in application code.
Instead, it can be implemented in a derived class to return default
wxComboPopup, incase @a popup is @NULL.
@note If you have implemented OnButtonClick() to do something else than
show the popup, then DoSetPopupControl() must always set @a popup
to @NULL.
*/
void DoSetPopupControl(wxComboPopup* popup);
/**
This member function is not normally called in application code.
Instead, it must be called in a derived class to make sure popup is
properly shown after a popup animation has finished (but only if
AnimateShow() did not finish the animation within its function scope).
@param rect
Position to show the popup window at, in screen coordinates.
@param flags
Combination of any of the following:
@beginTable
@row2col{wxComboCtrl::ShowAbove,
Popup is shown above the control instead of below.}
@row2col{wxComboCtrl::CanDeferShow,
Showing the popup can be deferred to happen sometime after
ShowPopup() has finished. In this case, AnimateShow() must
return false.}
@endTable
*/
virtual void DoShowPopup(const wxRect& rect, int flags);
/**
Enables or disables popup animation, if any, depending on the value of
the argument.
*/
void EnablePopupAnimation(bool enable = true);
/**
Returns disabled button bitmap that has been set with
SetButtonBitmaps().
@return A reference to the disabled state bitmap.
*/
const wxBitmap GetBitmapDisabled() const;
/**
Returns button mouse hover bitmap that has been set with
SetButtonBitmaps().
@return A reference to the mouse hover state bitmap.
*/
const wxBitmap GetBitmapHover() const;
/**
Returns default button bitmap that has been set with
SetButtonBitmaps().
@return A reference to the normal state bitmap.
*/
const wxBitmap GetBitmapNormal() const;
/**
Returns depressed button bitmap that has been set with
SetButtonBitmaps().
@return A reference to the depressed state bitmap.
*/
const wxBitmap GetBitmapPressed() const;
/**
Returns current size of the dropdown button.
*/
wxSize GetButtonSize();
/**
Returns custom painted area in control.
@see SetCustomPaintWidth().
*/
int GetCustomPaintWidth() const;
/**
Returns features supported by wxComboCtrl. If needed feature is
missing, you need to instead use wxGenericComboCtrl, which however may
lack a native look and feel (but otherwise sports identical API).
@return Value returned is a combination of the flags defined in
wxComboCtrlFeatures.
*/
static int GetFeatures();
/**
Returns the insertion point for the combo control's text field.
@note Under Windows, this function always returns 0 if the combo
control doesn't have the focus.
*/
virtual long GetInsertionPoint() const;
/**
Returns the last position in the combo control text field.
*/
virtual long GetLastPosition() const;
/**
Returns current popup interface that has been set with
SetPopupControl().
*/
wxComboPopup* GetPopupControl();
/**
Returns popup window containing the popup control.
*/
wxWindow* GetPopupWindow() const;
/**
Get the text control which is part of the combo control.
*/
wxTextCtrl* GetTextCtrl() const;
/**
Returns actual indentation in pixels.
*/
wxCoord GetTextIndent() const;
/**
Returns area covered by the text field (includes everything except
borders and the dropdown button).
*/
const wxRect GetTextRect() const;
/**
Returns text representation of the current value. For writable combo
control it always returns the value in the text field.
*/
virtual wxString GetValue() const;
/**
Dismisses the popup window.
*/
virtual void HidePopup();
/**
Returns @true if the popup is currently shown
*/
bool IsPopupShown() const;
/**
Returns @true if the popup window is in the given state. Possible
values are:
@beginTable
@row2col{wxComboCtrl::Hidden, Popup window is hidden.}
@row2col{wxComboCtrl::Animating, Popup window is being shown, but the
popup animation has not yet finished.}
@row2col{wxComboCtrl::Visible, Popup window is fully visible.}
@endTable
*/
bool IsPopupWindowState(int state) const;
/**
Implement in a derived class to define what happens on dropdown button
click. Default action is to show the popup.
@note If you implement this to do something else than show the popup,
you must then also implement DoSetPopupControl() to always return
@NULL.
*/
virtual void OnButtonClick();
/**
Pastes text from the clipboard to the text field.
*/
virtual void Paste();
/**
Removes the text between the two positions in the combo control text
field.
@param from
The first position.
@param to
The last position.
*/
virtual void Remove(long from, long to);
/**
Replaces the text between two positions with the given text, in the
combo control text field.
@param from
The first position.
@param to
The second position.
@param text
The text to insert.
*/
virtual void Replace(long from, long to, const wxString& value);
/**
Sets custom dropdown button graphics.
@param bmpNormal
Default button image.
@param pushButtonBg
If @true, blank push button background is painted below the image.
@param bmpPressed
Depressed button image.
@param bmpHover
Button image when mouse hovers above it. This should be ignored on
platforms and themes that do not generally draw different kind of
button on mouse hover.
@param bmpDisabled
Disabled button image.
*/
void SetButtonBitmaps(const wxBitmap& bmpNormal,
bool pushButtonBg = false,
const wxBitmap& bmpPressed = wxNullBitmap,
const wxBitmap& bmpHover = wxNullBitmap,
const wxBitmap& bmpDisabled = wxNullBitmap);
/**
Sets size and position of dropdown button.
@param width
Button width. Value = 0 specifies default.
@param height
Button height. Value = 0 specifies default.
@param side
Indicates which side the button will be placed. Value can be wxLEFT
or wxRIGHT.
@param spacingX
Horizontal spacing around the button. Default is 0.
*/
void SetButtonPosition(int width = -1, int height = -1,
int side = wxRIGHT, int spacingX = 0);
/**
Set width, in pixels, of custom painted area in control without
@c wxCB_READONLY style. In read-only wxOwnerDrawnComboBox, this is used
to indicate area that is not covered by the focus rectangle.
*/
void SetCustomPaintWidth(int width);
/**
Sets the insertion point in the text field.
@param pos
The new insertion point.
*/
virtual void SetInsertionPoint(long pos);
/**
Sets the insertion point at the end of the combo control text field.
*/
virtual void SetInsertionPointEnd();
/**
Set side of the control to which the popup will align itself. Valid
values are @c wxLEFT, @c wxRIGHT and 0. The default value 0 means that
the most appropriate side is used (which, currently, is always
@c wxLEFT).
*/
void SetPopupAnchor(int anchorSide);
/**
Set popup interface class derived from wxComboPopup. This method should
be called as soon as possible after the control has been created,
unless OnButtonClick() has been overridden.
*/
void SetPopupControl(wxComboPopup* popup);
/**
Extends popup size horizontally, relative to the edges of the combo
control.
@param extLeft
How many pixel to extend beyond the left edge of the control.
Default is 0.
@param extRight
How many pixel to extend beyond the right edge of the control.
Default is 0.
@remarks Popup minimum width may override arguments. It is up to the
popup to fully take this into account.
*/
void SetPopupExtents(int extLeft, int extRight);
/**
Sets preferred maximum height of the popup.
@remarks Value -1 indicates the default.
*/
void SetPopupMaxHeight(int height);
/**
Sets minimum width of the popup. If wider than combo control, it will
extend to the left.
@remarks Value -1 indicates the default. Also, popup implementation may
choose to ignore this.
*/
void SetPopupMinWidth(int width);
/**
Selects the text between the two positions, in the combo control text
field.
@param from
The first position.
@param to
The second position.
*/
virtual void SetSelection(long from, long to);
/**
Sets the text for the text field without affecting the popup. Thus,
unlike SetValue(), it works equally well with combo control using
@c wxCB_READONLY style.
*/
void SetText(const wxString& value);
/**
This will set the space in pixels between left edge of the control and
the text, regardless whether control is read-only or not. Value -1 can
be given to indicate platform default.
*/
void SetTextIndent(int indent);
/**
Sets the text for the combo control text field.
@note For a combo control with @c wxCB_READONLY style the string must
be accepted by the popup (for instance, exist in the dropdown
list), otherwise the call to SetValue() is ignored.
*/
virtual void SetValue(const wxString& value);
/**
Same as SetValue(), but also sends wxCommandEvent of type
wxEVT_COMMAND_TEXT_UPDATED if @a withEvent is @true.
*/
void SetValueWithEvent(const wxString& value, bool withEvent = true);
/**
Show the popup.
*/
virtual void ShowPopup();
/**
Undoes the last edit in the text field. Windows only.
*/
virtual void Undo();
/**
Enable or disable usage of an alternative popup window, which
guarantees ability to focus the popup control, and allows common native
controls to function normally. This alternative popup window is usually
a wxDialog, and as such, when it is shown, its parent top-level window
will appear as if the focus has been lost from it.
*/
void UseAltPopupWindow(bool enable = true);
};

302
interface/wx/combobox.h Normal file
View File

@@ -0,0 +1,302 @@
/////////////////////////////////////////////////////////////////////////////
// Name: combobox.h
// Purpose: interface of wxComboBox
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxComboBox
@wxheader{combobox.h}
A combobox is like a combination of an edit control and a listbox. It can
be displayed as static list with editable or read-only text field; or a
drop-down list with text field; or a drop-down list without a text field.
A combobox permits a single selection only. Combobox items are numbered
from zero.
If you need a customized combobox, have a look at wxComboCtrl,
wxOwnerDrawnComboBox, wxComboPopup and the ready-to-use wxBitmapComboBox.
@beginStyleTable
@style{wxCB_SIMPLE}
Creates a combobox with a permanently displayed list. Windows only.
@style{wxCB_DROPDOWN}
Creates a combobox with a drop-down list.
@style{wxCB_READONLY}
Same as wxCB_DROPDOWN but only the strings specified as the combobox
choices can be selected, it is impossible to select (even from a
program) a string which is not in the choices list.
@style{wxCB_SORT}
Sorts the entries in the list alphabetically.
@style{wxTE_PROCESS_ENTER}
The control will generate the event wxEVT_COMMAND_TEXT_ENTER
(otherwise pressing Enter key is either processed internally by the
control or used for navigation between dialog controls). Windows
only.
@endStyleTable
@beginEventTable{wxCommandEvent}
@event{EVT_COMBOBOX(id, func)}
Process a wxEVT_COMMAND_COMBOBOX_SELECTED event, when an item on
the list is selected. Note that calling GetValue() returns the new
value of selection.
@event{EVT_TEXT(id, func)}
Process a wxEVT_COMMAND_TEXT_UPDATED event, when the combobox text
changes.
@event{EVT_TEXT_ENTER(id, func)}
Process a wxEVT_COMMAND_TEXT_ENTER event, when RETURN is pressed in
the combobox (notice that the combobox must have been created with
wxTE_PROCESS_ENTER style to receive this event).
@endEventTable
@library{wxcore}
@category{ctrl}
<!-- @appearance{combobox.png} -->
@see wxListBox, wxTextCtrl, wxChoice, wxCommandEvent
*/
class wxComboBox : public wxControl, public wxItemContainer
{
public:
/**
Default constructor.
*/
wxComboBox();
//@{
/**
Constructor, creating and showing a combobox.
@param parent
Parent window. Must not be @NULL.
@param id
Window identifier. The value wxID_ANY indicates a default value.
@param value
Initial selection string. An empty string indicates no selection.
@param pos
Window position.
@param size
Window size. If wxDefaultSize is specified then the window is sized
appropriately.
@param n
Number of strings with which to initialise the control.
@param choices
An array of strings with which to initialise the control.
@param style
Window style. See wxComboBox.
@param validator
Window validator.
@param name
Window name.
@beginWxPythonOnly
The wxComboBox constructor in wxPython reduces the @a n and @a choices
arguments are to a single argument, which is a list of strings.
@endWxPythonOnly
@see Create(), wxValidator
*/
wxComboBox(wxWindow* parent, wxWindowID id,
const wxString& value = "",
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 = "comboBox");
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 = "comboBox");
//@}
/**
Destructor, destroying the combobox.
*/
~wxComboBox();
//@{
/**
Creates the combobox for two-step construction. Derived classes should
call or replace this function. See wxComboBox() for further details.
*/
bool Create(wxWindow* parent, wxWindowID id,
const wxString& value = "",
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n, const wxString choices[],
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = "comboBox");
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 = "comboBox");
//@}
/**
Returns @true if the combobox is editable and there is a text selection
to copy to the clipboard. Only available on Windows.
*/
bool CanCopy() const;
/**
Returns @true if the combobox is editable and there is a text selection
to copy to the clipboard. Only available on Windows.
*/
bool CanCut() const;
/**
Returns @true if the combobox is editable and there is text on the
clipboard that can be pasted into the text field. Only available on
Windows.
*/
bool CanPaste() const;
/**
Returns @true if the combobox is editable and the last undo can be
redone. Only available on Windows.
*/
bool CanRedo() const;
/**
Returns @true if the combobox is editable and the last edit can be
undone. Only available on Windows.
*/
bool CanUndo() const;
/**
Copies the selected text to the clipboard.
*/
void Copy();
/**
Copies the selected text to the clipboard and removes the selection.
*/
void Cut();
/**
This function does the same things as wxChoice::GetCurrentSelection()
and returns the item currently selected in the dropdown list if it's
open or the same thing as wxControlWithItems::GetSelection() otherwise.
*/
int GetCurrentSelection() const;
/**
Returns the insertion point for the combobox's text field.
@note Under wxMSW, this function always returns 0 if the combobox
doesn't have the focus.
*/
long GetInsertionPoint() const;
/**
Returns the last position in the combobox text field.
*/
virtual wxTextPos GetLastPosition() const;
/**
This is the same as wxTextCtrl::GetSelection() for the text control
which is part of the combobox. Notice that this is a different method
from wxControlWithItems::GetSelection().
Currently this method is only implemented in wxMSW and wxGTK.
*/
void GetSelection(long* from, long* to) const;
/**
Returns the current value in the combobox text field.
*/
wxString GetValue() const;
/**
Pastes text from the clipboard to the text field.
*/
void Paste();
/**
Redoes the last undo in the text field. Windows only.
*/
void Redo();
/**
Removes the text between the two positions in the combobox text field.
@param from
The first position.
@param to
The last position.
*/
void Remove(long from, long to);
/**
Replaces the text between two positions with the given text, in the
combobox text field.
@param from
The first position.
@param to
The second position.
@param text
The text to insert.
*/
void Replace(long from, long to, const wxString& text);
/**
Sets the insertion point in the combobox text field.
@param pos
The new insertion point.
*/
void SetInsertionPoint(long pos);
/**
Sets the insertion point at the end of the combobox text field.
*/
void SetInsertionPointEnd();
/**
Selects the text between the two positions, in the combobox text field.
@param from
The first position.
@param to
The second position.
@beginWxPythonOnly
This method is called SetMark() in wxPython, "SetSelection" is kept for
wxControlWithItems::SetSelection().
@endWxPythonOnly
*/
void SetSelection(long from, long to);
/**
Sets the text for the combobox text field.
@note For a combobox with @c wxCB_READONLY style the string must be in
the combobox choices list, otherwise the call to SetValue() is
ignored.
@param text
The text to set.
*/
void SetValue(const wxString& text);
/**
Undoes the last edit in the text field. Windows only.
*/
void Undo();
};

780
interface/wx/config.h Normal file
View File

@@ -0,0 +1,780 @@
/////////////////////////////////////////////////////////////////////////////
// Name: config.h
// Purpose: interface of wxConfigBase
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxConfigBase
@wxheader{config.h}
wxConfigBase defines the basic interface of all config classes. It can not
be used by itself (it is an abstract base class) and you will always use
one of its derivations: wxFileConfig, wxRegConfig or any other.
However, usually you don't even need to know the precise nature of the
class you're working with but you would just use the wxConfigBase methods.
This allows you to write the same code regardless of whether you're working
with the registry under Win32 or text-based config files under Unix (or
even Windows 3.1 .INI files if you're really unlucky). To make writing the
portable code even easier, wxWidgets provides a typedef wxConfig which is
mapped onto the native wxConfigBase implementation on the given platform:
i.e. wxRegConfig under Win32 and wxFileConfig otherwise.
See @ref overview_config for a description of all features of this class.
It is highly recommended to use static functions Get() and/or Set(), so
please have a look at them.
Related Include Files:
@li @c <wx/config.h> - Let wxWidgets choose a wxConfig class for your
platform.
@li @c <wx/confbase.h> - Base config class.
@li @c <wx/fileconf.h> - wxFileConfig class.
@li @c <wx/msw/regconf.h> - wxRegConfig class, see also wxRegKey.
@section configbase_example Example
Here is how you would typically use this class:
@code
// using wxConfig instead of writing wxFileConfig or wxRegConfig enhances
// portability of the code
wxConfig *config = new wxConfig("MyAppName");
wxString str;
if ( config->Read("LastPrompt", &str) ) {
// last prompt was found in the config file/registry and its value is
// now in str
// ...
}
else {
// no last prompt...
}
// another example: using default values and the full path instead of just
// key name: if the key is not found , the value 17 is returned
long value = config->ReadLong("/LastRun/CalculatedValues/MaxValue", 17);
// at the end of the program we would save everything back
config->Write("LastPrompt", str);
config->Write("/LastRun/CalculatedValues/MaxValue", value);
// the changes will be written back automatically
delete config;
@endcode
This basic example, of course, doesn't show all wxConfig features, such as
enumerating, testing for existence and deleting the entries and groups of
entries in the config file, its abilities to automatically store the
default values or expand the environment variables on the fly. However, the
main idea is that using this class is easy and that it should normally do
what you expect it to.
@note In the documentation of this class, the words "config file" also mean
"registry hive" for wxRegConfig and, generally speaking, might mean
any physical storage where a wxConfigBase-derived class stores its
data.
@section configbase_static Static Functions
The static functions provided deal with the "default" config object.
Although its usage is not at all mandatory it may be convenient to use a
global config object instead of creating and deleting the local config
objects each time you need one (especially because creating a wxFileConfig
object might be a time consuming operation). In this case, you may create
this global config object in the very start of the program and Set() it as
the default. Then, from anywhere in your program, you may access it using
the Get() function. This global wxConfig object will be deleted by
wxWidgets automatically if it exists. Note that this implies that if you do
delete this object yourself (usually in wxApp::OnExit()) you must use
Set(@NULL) to prevent wxWidgets from deleting it the second time.
As it happens, you may even further simplify the procedure described above:
you may forget about calling Set(). When Get() is called and there is no
current object, it will create one using Create() function. To disable this
behaviour DontCreateOnDemand() is provided.
@note You should use either Set() or Get() because wxWidgets library itself
would take advantage of it and could save various information in it.
For example wxFontMapper or Unix version of wxFileDialog have the
ability to use wxConfig class.
@section configbase_paths Path Management
As explained in the @ref overview_config "config overview", the config
classes support a file system-like hierarchy of keys (files) and groups
(directories). As in the file system case, to specify a key in the config
class you must use a path to it. Config classes also support the notion of
the current group, which makes it possible to use the relative paths. To
clarify all this, here is an example (it is only for the sake of
demonstration, it doesn't do anything sensible!):
@code
wxConfig *config = new wxConfig("FooBarApp");
// right now the current path is '/'
conf->Write("RootEntry", 1);
// go to some other place: if the group(s) don't exist, they will be created
conf->SetPath("/Group/Subgroup");
// create an entry in subgroup
conf->Write("SubgroupEntry", 3);
// '..' is understood
conf->Write("../GroupEntry", 2);
conf->SetPath("..");
wxASSERT( conf->ReadLong("Subgroup/SubgroupEntry", 0) == 3 );
// use absolute path: it is allowed, too
wxASSERT( conf->ReadLong("/RootEntry", 0) == 1 );
@endcode
It is highly recommended that you restore the path to its old value on
function exit:
@code
void foo(wxConfigBase *config)
{
wxString strOldPath = config->GetPath();
config->SetPath("/Foo/Data");
// ...
config->SetPath(strOldPath);
}
@endcode
Otherwise the assert in the following example will surely fail (we suppose
here that the foo() function is the same as above except that it doesnt
save and restore the path):
@code
void bar(wxConfigBase *config)
{
config->Write("Test", 17);
foo(config);
// we're reading "/Foo/Data/Test" here! -1 will probably be returned...
wxASSERT( config->ReadLong("Test", -1) == 17 );
}
@endcode
Finally, the path separator in wxConfigBase and derived classes is always
"/", regardless of the platform (i.e. it is not "\\" under Windows).
@section configbase_enumeration Enumeration
The enumeration functions allow you to enumerate all entries and groups in
the config file. All functions here return @false when there are no more
items.
You must pass the same index to GetNext() and GetFirst() (don't modify it).
Please note that it is not the index of the current item (you will have
some great surprises with wxRegConfig if you assume this) and you shouldn't
even look at it: it is just a "cookie" which stores the state of the
enumeration. It can't be stored inside the class because it would prevent
you from running several enumerations simultaneously, that's why you must
pass it explicitly.
Having said all this, enumerating the config entries/groups is very simple:
@code
wxConfigBase *config = ...;
wxArrayString aNames;
// enumeration variables
wxString str;
long dummy;
// first enum all entries
bool bCont = config->GetFirstEntry(str, dummy);
while ( bCont ) {
aNames.Add(str);
bCont = GetConfig()->GetNextEntry(str, dummy);
}
// ... we have all entry names in aNames...
// now all groups...
bCont = GetConfig()->GetFirstGroup(str, dummy);
while ( bCont ) {
aNames.Add(str);
bCont = GetConfig()->GetNextGroup(str, dummy);
}
// ... we have all group (and entry) names in aNames...
@endcode
There are also functions to get the number of entries/subgroups without
actually enumerating them, but you will probably never need them.
@section configbase_keyaccess Key Access
The key access functions are the core of wxConfigBase class: they allow you
to read and write config file data. All Read() functions take a default
value which will be returned if the specified key is not found in the
config file.
Currently, supported types of data are: wxString, @c long, @c double,
@c bool, wxColour and any other types for which the functions
wxToString() and wxFromString() are defined.
Try not to read long values into string variables and vice versa:
although it just might work with wxFileConfig, you will get a system
error with wxRegConfig because in the Windows registry the different
types of entries are indeed used.
Final remark: the @a szKey parameter for all these functions can
contain an arbitrary path (either relative or absolute), not just the
key name.
@beginWxPythonOnly
In place of a single overloaded method name, wxPython implements the
following methods:
- Read(key, default="") - Returns a string.
- ReadInt(key, default=0) - Returns an integer.
- ReadFloat(key, default=0.0) - Returns a floating point number.
- ReadBool(key, default=0) - Returns a boolean.
- Write(key, value) - Writes a string.
- WriteInt(key, value) - Writes an int.
- WriteFloat(key, value) - Writes a floating point number.
@endWxPythonOnly
@library{wxbase}
@category{misc}
*/
class wxConfigBase : public wxObject
{
public:
/**
This is the default and only constructor of the wxConfigBase class, and
derived classes.
@param appName
The application name. If this is empty, the class will normally use
wxApp::GetAppName() to set it. The application name is used in the
registry key on Windows, and can be used to deduce the local
filename parameter if that is missing.
@param vendorName
The vendor name. If this is empty, it is assumed that no vendor
name is wanted, if this is optional for the current config class.
The vendor name is appended to the application name for
wxRegConfig.
@param localFilename
Some config classes require a local filename. If this is not
present, but required, the application name will be used instead.
@param globalFilename
Some config classes require a global filename. If this is not
present, but required, the application name will be used instead.
@param style
Can be one of wxCONFIG_USE_LOCAL_FILE and wxCONFIG_USE_GLOBAL_FILE.
The style interpretation depends on the config class and is ignored
by some implementations. For wxFileConfig, these styles determine
whether a local or global config file is created or used: if
wxCONFIG_USE_GLOBAL_FILE is used, then settings are read from the
global config file and if wxCONFIG_USE_LOCAL_FILE is used, settings
are read from and written to local config file (if they are both
set, global file is read first, then local file, overwriting global
settings). If the flag is present but the parameter is empty, the
parameter will be set to a default. If the parameter is present but
the style flag not, the relevant flag will be added to the style.
For wxRegConfig, thie GLOBAL flag refers to HKLM key while LOCAL
one is for the usual HKCU one.
@n For wxFileConfig you can also add wxCONFIG_USE_RELATIVE_PATH by
logically or'ing it to either of the _FILE options to tell
wxFileConfig to use relative instead of absolute paths.
@n On non-VMS Unix systems, the default local configuration file is
"~/.appname". However, this path may be also used as user data
directory (see wxStandardPaths::GetUserDataDir()) if the
application has several data files. In this case
wxCONFIG_USE_SUBDIR flag, which changes the default local
configuration file to "~/.appname/appname" should be used. Notice
that this flag is ignored if localFilename is provided.
wxCONFIG_USE_SUBDIR is new since wxWidgets version 2.8.2.
@n For wxFileConfig, you can also add
wxCONFIG_USE_NO_ESCAPE_CHARACTERS which will turn off character
escaping for the values of entries stored in the config file: for
example a foo key with some backslash characters will be stored as
"foo=C:\mydir" instead of the usual storage of "foo=C:\\mydir".
@n The wxCONFIG_USE_NO_ESCAPE_CHARACTERS style can be helpful if your
config file must be read or written to by a non-wxWidgets program
(which might not understand the escape characters). Note, however,
that if wxCONFIG_USE_NO_ESCAPE_CHARACTERS style is used, it is is
now your application's responsibility to ensure that there is no
newline or other illegal characters in a value, before writing that
value to the file.
@param conv
This parameter is only used by wxFileConfig when compiled in
Unicode mode. It specifies the encoding in which the configuration
file is written.
@remarks By default, environment variable expansion is on and recording
defaults is off.
*/
wxConfigBase(const wxString& appName = wxEmptyString,
const wxString& vendorName = wxEmptyString,
const wxString& localFilename = wxEmptyString,
const wxString& globalFilename = wxEmptyString,
long style = 0,
const wxMBConv& conv = wxConvAuto());
/**
Empty but ensures that dtor of all derived classes is virtual.
*/
~wxConfigBase();
/**
@name Path Management
See @ref configbase_paths
*/
//@{
/**
Retrieve the current path (always as absolute path).
*/
const wxString GetPath() const;
/**
Set current path: if the first character is '/', it is the absolute
path, otherwise it is a relative path. '..' is supported. If @a strPath
doesn't exist it is created.
*/
void SetPath(const wxString& strPath);
//@}
/**
@name Enumeration
See @ref configbase_enumeration
*/
//@{
/**
Gets the first entry.
@beginWxPythonOnly
The wxPython version of this method returns a 3-tuple consisting of the
continue flag, the value string, and the index for the next call.
@endWxPythonOnly
*/
bool GetFirstEntry(wxString& str, long& index) const;
/**
Gets the first group.
@beginWxPythonOnly
The wxPython version of this method returns a 3-tuple consisting of the
continue flag, the value string, and the index for the next call.
@endWxPythonOnly
*/
bool GetFirstGroup(wxString& str, long& index) const;
/**
Gets the next entry.
@beginWxPythonOnly
The wxPython version of this method returns a 3-tuple consisting of the
continue flag, the value string, and the index for the next call.
@endWxPythonOnly
*/
bool GetNextEntry(wxString& str, long& index) const;
/**
Gets the next group.
@beginWxPythonOnly
The wxPython version of this method returns a 3-tuple consisting of the
continue flag, the value string, and the index for the next call.
@endWxPythonOnly
*/
bool GetNextGroup(wxString& str, long& index) const;
/**
Get number of entries in the current group.
*/
uint GetNumberOfEntries(bool bRecursive = false) const;
/**
Get number of entries/subgroups in the current group, with or without
its subgroups.
*/
uint GetNumberOfGroups(bool bRecursive = false) const;
//@}
enum EntryType
{
Type_Unknown,
Type_String,
Type_Boolean,
Type_Integer,
Type_Float
};
/**
@name Tests of Existence
*/
//@{
/**
@return @true if either a group or an entry with a given name exists.
*/
bool Exists(wxString& strName) const;
/**
Returns the type of the given entry or @e Unknown if the entry doesn't
exist. This function should be used to decide which version of Read()
should be used because some of wxConfig implementations will complain
about type mismatch otherwise: e.g., an attempt to read a string value
from an integer key with wxRegConfig will fail.
*/
wxConfigBase::EntryType GetEntryType(const wxString& name) const;
/**
@return @true if the entry by this name exists.
*/
bool HasEntry(wxString& strName) const;
/**
@return @true if the group by this name exists.
*/
bool HasGroup(const wxString& strName) const;
//@}
/**
@name Miscellaneous Functions
*/
//@{
/**
Returns the application name.
*/
wxString GetAppName() const;
/**
Returns the vendor name.
*/
wxString GetVendorName() const;
//@}
/**
@name Key Access
See @ref configbase_keyaccess
*/
//@{
/**
Permanently writes all changes (otherwise, they're only written from
object's destructor).
*/
bool Flush(bool bCurrentOnly = false);
/**
Read a string from the key, returning @true if the value was read. If
the key was not found, @a str is not changed.
*/
bool Read(const wxString& key, wxString* str) const;
/**
Read a string from the key. The default value is returned if the key
was not found.
@return @true if value was really read, @false if the default was used.
*/
const bool Read(const wxString& key, wxString* str,
const wxString& defaultVal) const;
/**
Another version of Read(), returning the string value directly.
*/
const wxString Read(const wxString& key,
const wxString& defaultVal) const;
/**
Reads a long value, returning @true if the value was found. If the
value was not found, @a l is not changed.
*/
const bool Read(const wxString& key, long* l) const;
/**
Reads a long value, returning @true if the value was found. If the
value was not found, @a defaultVal is used instead.
*/
const bool Read(const wxString& key, long* l,
long defaultVal) const;
/**
Reads a double value, returning @true if the value was found. If the
value was not found, @a d is not changed.
*/
const bool Read(const wxString& key, double* d) const;
/**
Reads a double value, returning @true if the value was found. If the
value was not found, @a defaultVal is used instead.
*/
const bool Read(const wxString& key, double* d,
double defaultVal) const;
/**
Reads a bool value, returning @true if the value was found. If the
value was not found, @a b is not changed.
*/
const bool Read(const wxString& key, bool* b) const;
/**
Reads a bool value, returning @true if the value was found. If the
value was not found, @a defaultVal is used instead.
*/
const bool Read(const wxString& key, bool* d,
bool defaultVal) const;
/**
Reads a binary block, returning @true if the value was found. If the
value was not found, @a buf is not changed.
*/
const bool Read(const wxString& key, wxMemoryBuffer* buf) const;
/**
Reads a value of type T, for which function wxFromString() is defined,
returning @true if the value was found. If the value was not found,
@a value is not changed.
*/
const bool Read(const wxString& key, T* value) const;
/**
Reads a value of type T, for which function wxFromString() is defined,
returning @true if the value was found. If the value was not found,
@a defaultVal is used instead.
*/
const bool Read(const wxString& key, T* value,
const T& defaultVal) const;
/**
Reads a bool value from the key and returns it. @a defaultVal is
returned if the key is not found.
*/
long ReadBool(const wxString& key, bool defaultVal) const;
/**
Reads a double value from the key and returns it. @a defaultVal is
returned if the key is not found.
*/
long ReadDouble(const wxString& key, double defaultVal) const;
/**
Reads a long value from the key and returns it. @a defaultVal is
returned if the key is not found.
*/
long ReadLong(const wxString& key, long defaultVal) const;
/**
Reads a value of type T (for which the function wxFromString() must be
defined) from the key and returns it. @a defaultVal is returned if the
key is not found.
*/
T ReadObject(const wxString& key, T const& defaultVal) const;
/**
Writes the wxString value to the config file and returns @true on
success.
*/
bool Write(const wxString& key, const wxString& value);
/**
Writes the long value to the config file and returns @true on success.
*/
bool Write(const wxString& key, long value);
/**
Writes the double value to the config file and returns @true on
success.
*/
bool Write(const wxString& key, double value);
/**
Writes the bool value to the config file and returns @true on success.
*/
bool Write(const wxString& key, bool value);
/**
Writes the wxMemoryBuffer value to the config file and returns @true on
success.
*/
bool Write(const wxString& key, const wxMemoryBuffer& buf);
/**
Writes the specified value to the config file and returns @true on
success. The function wxToString() must be defined for type @e T.
*/
bool Write(const wxString& key, T const& buf);
//@}
/**
@name Rename Entries/Groups
These functions allow renaming entries or subgroups of the current
group. They will return @false on error, typically because either the
entry/group with the original name doesn't exist, because the
entry/group with the new name already exists or because the function is
not supported in this wxConfig implementation.
*/
//@{
/**
Renames an entry in the current group. The entries names (both the old
and the new one) shouldn't contain backslashes, i.e. only simple names
and not arbitrary paths are accepted by this function.
@return @false if @a oldName doesn't exist or if @a newName already
exists.
*/
bool RenameEntry(const wxString& oldName, const wxString& newName);
/**
Renames a subgroup of the current group. The subgroup names (both the
old and the new one) shouldn't contain backslashes, i.e. only simple
names and not arbitrary paths are accepted by this function.
@return @false if @a oldName doesn't exist or if @a newName already
exists.
*/
bool RenameGroup(const wxString& oldName, const wxString& newName);
//@}
/**
@name Delete Entries/Groups
These functions delete entries and/or groups of entries from the config
file. DeleteAll() is especially useful if you want to erase all traces
of your program presence: for example, when you uninstall it.
*/
//@{
/**
Delete the whole underlying object (disk file, registry key, ...).
Primarly for use by uninstallation routine.
*/
bool DeleteAll();
/**
Deletes the specified entry and the group it belongs to if it was the
last key in it and the second parameter is @true.
*/
bool DeleteEntry(const wxString& key,
bool bDeleteGroupIfEmpty = true);
/**
Delete the group (with all subgroups). If the current path is under the
group being deleted it is changed to its deepest still existing
component. E.g. if the current path is @c "/A/B/C/D" and the group @c C
is deleted, the path becomes @c "/A/B".
*/
bool DeleteGroup(const wxString& key);
//@}
/**
@name Options
Some aspects of wxConfigBase behaviour can be changed during run-time.
The first of them is the expansion of environment variables in the
string values read from the config file: for example, if you have the
following in your config file:
@code
# config file for my program
UserData = $HOME/data
# the following syntax is valud only under Windows
UserData = %windir%\\data.dat
@endcode
The call to Read("UserData") will return something like
@c "/home/zeitlin/data" on linux for example.
Although this feature is very useful, it may be annoying if you read a
value which containts '$' or '%' symbols (% is used for environment
variables expansion under Windows) which are not used for environment
variable expansion. In this situation you may call
SetExpandEnvVars(@false) just before reading this value and
SetExpandEnvVars(@true) just after. Another solution would be to prefix
the offending symbols with a backslash.
*/
//@{
/**
Returns @true if we are expanding environment variables in key values.
*/
bool IsExpandingEnvVars() const;
/**
Returns @true if we are writing defaults back to the config file.
*/
bool IsRecordingDefaults() const;
/**
Determine whether we wish to expand environment variables in key
values.
*/
void SetExpandEnvVars(bool bDoIt = true);
/**
Sets whether defaults are recorded to the config file whenever an
attempt to read the value which is not present in it is done.
If on (default is off) all default values for the settings used by the
program are written back to the config file. This allows the user to
see what config options may be changed and is probably useful only for
wxFileConfig.
*/
void SetRecordDefaults(bool bDoIt = true);
//@}
/**
Create a new config object: this function will create the "best"
implementation of wxConfig available for the current platform, see
comments near the definition of wxCONFIG_WIN32_NATIVE for details. It
returns the created object and also sets it as the current one.
*/
static wxConfigBase* Create();
/**
Calling this function will prevent @e Get() from automatically creating
a new config object if the current one is @NULL. It might be useful to
call it near the program end to prevent "accidental" creation of a new
config object.
*/
static void DontCreateOnDemand();
/**
Get the current config object. If there is no current object and
@a CreateOnDemand is @true, this creates one (using Create()) unless
DontCreateOnDemand() was called previously.
*/
static wxConfigBase* Get(bool CreateOnDemand = true);
/**
Sets the config object as the current one, returns the pointer to the
previous current object (both the parameter and returned value may be
@NULL).
*/
static wxConfigBase* Set(wxConfigBase* pConfig);
};

62
interface/wx/control.h Normal file
View File

@@ -0,0 +1,62 @@
/////////////////////////////////////////////////////////////////////////////
// Name: control.h
// Purpose: interface of wxControl
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxControl
@wxheader{control.h}
This is the base class for a control or "widget".
A control is generally a small window which processes user input and/or
displays one or more item of data.
@library{wxcore}
@category{ctrl}
@see wxValidator
*/
class wxControl : public wxWindow
{
public:
/**
Simulates the effect of the user issuing a command to the item.
@see wxCommandEvent
*/
void Command(wxCommandEvent& event);
/**
Returns the control's text.
@note The returned string contains mnemonics ("&" characters) if it has
any, use GetLabelText() if they are undesired.
*/
wxString GetLabel() const;
/**
Returns the control's label without mnemonics.
*/
const wxString GetLabelText();
/**
Returns the given @a label string without mnemonics.
*/
static wxString GetLabelText(const wxString& label);
/**
Sets the item's text.
Any "&" characters in the @a label are special and indicate that the
following character is a mnemonic for this control and can be used to
activate it from the keyboard (typically by using @e Alt key in
combination with it). To insert a literal ampersand character, you need
to double it, i.e. use "&&".
*/
void SetLabel(const wxString& label);
};

97
interface/wx/convauto.h Normal file
View File

@@ -0,0 +1,97 @@
/////////////////////////////////////////////////////////////////////////////
// Name: convauto.h
// Purpose: interface of wxConvAuto
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxConvAuto
@wxheader{convauto.h}
This class implements a Unicode to/from multibyte converter capable of
automatically recognizing the encoding of the multibyte text on input. The
logic used is very simple: the class uses the BOM (byte order mark) if it's
present and tries to interpret the input as UTF-8 otherwise. If this fails,
the input is interpreted as being in the default multibyte encoding which
can be specified in the constructor of a wxConvAuto instance and, in turn,
defaults to the value of GetFallbackEncoding() if not explicitly given.
For the conversion from Unicode to multibyte, the same encoding as was
previously used for multibyte to Unicode conversion is reused. If there had
been no previous multibyte to Unicode conversion, UTF-8 is used by default.
Notice that once the multibyte encoding is automatically detected, it
doesn't change any more, i.e. it is entirely determined by the first use of
wxConvAuto object in the multibyte-to-Unicode direction. However creating a
copy of wxConvAuto object, either via the usual copy constructor or
assignment operator, or using wxMBConv::Clone(), resets the automatically
detected encoding so that the new copy will try to detect the encoding of
the input on first use.
This class is used by default in wxWidgets classes and functions reading
text from files such as wxFile, wxFFile, wxTextFile, wxFileConfig and
various stream classes so the encoding set with its SetFallbackEncoding()
method will affect how these classes treat input files. In particular, use
this method to change the fall-back multibyte encoding used to interpret
the contents of the files whose contents isn't valid UTF-8 or to disallow
it completely.
@library{wxbase}
@category{data}
@see @ref overview_mbconv
*/
class wxConvAuto : public wxMBConv
{
public:
/**
Constructs a new wxConvAuto instance. The object will try to detect the
input of the multibyte text given to its wxMBConv::ToWChar() method
automatically but if the automatic detection of Unicode encodings
fails, the fall-back encoding @a enc will be used to interpret it as
multibyte text.
The default value of @a enc, @c wxFONTENCODING_DEFAULT, means that the
global default value (which can be set using SetFallbackEncoding())
should be used. As with that method, passing @c wxFONTENCODING_MAX
inhibits using this encoding completely so the input multibyte text
will always be interpreted as UTF-8 in the absence of BOM and the
conversion will fail if the input doesn't form valid UTF-8 sequence.
Another special value is @c wxFONTENCODING_SYSTEM which means to use
the encoding currently used on the user system, i.e. the encoding
returned by wxLocale::GetSystemEncoding(). Any other encoding will be
used as is, e.g. passing @c wxFONTENCODING_ISO8859_1 ensures that
non-UTF-8 input will be treated as latin1.
*/
wxConvAuto(wxFontEncoding enc = wxFONTENCODING_DEFAULT);
/**
Disable the use of the fall back encoding: if the input doesn't have a
BOM and is not valid UTF-8, the conversion will fail.
*/
static void DisableFallbackEncoding();
/**
Returns the encoding used by default by wxConvAuto if no other encoding
is explicitly specified in constructor. By default, returns
@c wxFONTENCODING_ISO8859_1 but can be changed using
SetFallbackEncoding().
*/
static wxFontEncoding GetFallbackEncoding();
/**
Changes the encoding used by default by wxConvAuto if no other encoding
is explicitly specified in constructor. The default value, which can be
retrieved using GetFallbackEncoding(), is @c wxFONTENCODING_ISO8859_1.
Special values of @c wxFONTENCODING_SYSTEM or @c wxFONTENCODING_MAX can
be used for the @a enc parameter to use the encoding of the current
user locale as fall back or not use any encoding for fall back at all,
respectively (just as with the similar constructor parameter). However,
@c wxFONTENCODING_DEFAULT can't be used here.
*/
static void SetFallbackEncoding(wxFontEncoding enc);
};

52
interface/wx/cpp.h Normal file
View File

@@ -0,0 +1,52 @@
/////////////////////////////////////////////////////////////////////////////
// Name: cpp.h
// Purpose: interface of global functions
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/** @ingroup group_funcmacro_misc */
//@{
/**
This macro returns the concatenation of the arguments passed. Unlike when
using the preprocessor operator, the arguments undergo macro expansion
before being concatenated.
@header{wx/cpp.h}
*/
#define wxCONCAT(x1, x2)
#define wxCONCAT3(x1, x2, x3)
#define wxCONCAT4(x1, x2, x3, x4)
#define wxCONCAT5(x1, x2, x3, x4, x5)
//@}
/** @ingroup group_funcmacro_misc */
//@{
/**
Returns the string representation of the given symbol which can be either a
literal or a macro (hence the advantage of using this macro instead of the
standard preprocessor @c # operator which doesn't work with macros).
Notice that this macro always produces a @c char string, use
wxSTRINGIZE_T() to build a wide string Unicode build.
@see wxCONCAT()
@header{wx/cpp.h}
*/
#define wxSTRINGIZE(x)
/**
Returns the string representation of the given symbol as either an ASCII or
Unicode string, depending on the current build. This is the
Unicode-friendly equivalent of wxSTRINGIZE().
@header{wx/cpp.h}
*/
#define wxSTRINGIZE_T(x)
//@}

301
interface/wx/cshelp.h Normal file
View File

@@ -0,0 +1,301 @@
/////////////////////////////////////////////////////////////////////////////
// Name: cshelp.h
// Purpose: interface of wxHelpProvider
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxHelpProvider
@wxheader{cshelp.h}
wxHelpProvider is an abstract class used by a program implementing
context-sensitive help to show the help text for the given window.
The current help provider must be explicitly set by the application using
Set().
@library{wxcore}
@category{help}
@see wxContextHelp, wxContextHelpButton, wxSimpleHelpProvider,
wxHelpControllerHelpProvider, wxWindow::SetHelpText(),
wxWindow::GetHelpTextAtPoint()
*/
class wxHelpProvider
{
public:
/**
Virtual destructor for any base class.
*/
virtual ~wxHelpProvider();
/**
Associates the text with the given window.
@remarks
Although all help providers have these functions to allow making
wxWindow::SetHelpText() work, not all of them implement the functions.
*/
virtual void AddHelp(wxWindowBase* window, const wxString& text);
/**
Associates the text with the given ID.
This help text will be shown for all windows with ID @a id, unless they
have more specific help text associated using the other AddHelp()
prototype. May be used to set the same help string for all Cancel
buttons in the application, for example.
@remarks
Although all help providers have these functions to allow making
wxWindow::SetHelpText() work, not all of them implement the functions.
*/
virtual void AddHelp(wxWindowID id, const wxString& text);
/**
Returns pointer to help provider instance.
Unlike some other classes, the help provider is not created on demand.
This must be explicitly done by the application using Set().
*/
static wxHelpProvider* Get();
/**
This version associates the given text with all windows with this id.
May be used to set the same help string for all Cancel buttons in
the application, for example.
*/
virtual wxString GetHelp(const wxWindowBase* window);
/**
Removes the association between the window pointer and the help text.
This is called by the wxWindow destructor. Without this, the table of
help strings will fill up and when window pointers are reused, the
wrong help string will be found.
*/
virtual void RemoveHelp(wxWindowBase* window);
/**
Set the current, application-wide help provider.
@return Pointer to previous help provider or @NULL if there wasn't any.
*/
static wxHelpProvider* Set(wxHelpProvider* helpProvider);
/**
Shows help for the given window.
Override this function if the help doesn't depend on the exact position
inside the window, otherwise you need to override ShowHelpAtPoint().
Returns @true if help was shown, or @false if no help was available for
this window.
*/
virtual bool ShowHelp(wxWindowBase* window);
/**
This function may be overridden to show help for the window when it
should depend on the position inside the window, By default this method
forwards to ShowHelp(), so it is enough to only implement the latter if
the help doesn't depend on the position.
@param window
Window to show help text for.
@param point
Coordinates of the mouse at the moment of help event emission.
@param origin
Help event origin, see wxHelpEvent::GetOrigin.
@return @true if help was shown, or @false if no help was available
for this window.
@since 2.7.0
*/
virtual bool ShowHelpAtPoint(wxWindowBase* window, const wxPoint point,
wxHelpEvent::Origin origin);
};
/**
@class wxHelpControllerHelpProvider
@wxheader{cshelp.h}
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. If
you use this with a wxCHMHelpController instance on windows, it will use
the native style of tip window instead of wxTipWindow.
You can use the convenience function wxContextId() to convert an integer
context id to a string for passing to wxWindow::SetHelpText().
@library{wxcore}
@category{help}
@see wxHelpProvider, wxSimpleHelpProvider, wxContextHelp,
wxWindow::SetHelpText(), wxWindow::GetHelpTextAtPoint()
*/
class wxHelpControllerHelpProvider : public wxSimpleHelpProvider
{
public:
/**
Note that the instance doesn't own the help controller. The help
controller should be deleted separately.
*/
wxHelpControllerHelpProvider(wxHelpControllerBase* hc = NULL);
/**
Returns the help controller associated with this help provider.
*/
wxHelpControllerBase* GetHelpController() const;
/**
Sets the help controller associated with this help provider.
*/
void SetHelpController(wxHelpControllerBase* hc);
};
/**
@class wxContextHelp
@wxheader{cshelp.h}
This class changes the cursor to a query and puts the application into a
'context-sensitive help mode'. When the user left-clicks on a window
within the specified window, a wxEVT_HELP event is sent to that control,
and the application may respond to it by popping up some help.
For example:
@code
wxContextHelp contextHelp(myWindow);
@endcode
There are a couple of ways to invoke this behaviour implicitly:
- Use the wxDIALOG_EX_CONTEXTHELP style for a dialog (Windows only). This
will put a question mark in the titlebar, and Windows will put the
application into context-sensitive help mode automatically, with further
programming.
- Create a wxContextHelpButton, whose predefined behaviour is
to create a context help object. Normally you will write your application
so that this button is only added to a dialog for non-Windows platforms
(use wxDIALOG_EX_CONTEXTHELP on Windows).
Note that on Mac OS X, the cursor does not change when in context-sensitive
help mode.
@library{wxcore}
@category{help}
@see wxHelpEvent, wxHelpController, wxContextHelpButton
*/
class wxContextHelp : public wxObject
{
public:
/**
Constructs a context help object, calling BeginContextHelp() if
@a doNow is @true (the default).
If @a window is @NULL, the top window is used.
*/
wxContextHelp(wxWindow* window = NULL, bool doNow = true);
/**
Destroys the context help object.
*/
~wxContextHelp();
/**
Puts the application into context-sensitive help mode. @a window is the
window which will be used to catch events; if @NULL, the top window
will be used. Returns @true if the application was successfully put
into context-sensitive help mode. This function only returns when the
event loop has finished.
*/
bool BeginContextHelp(wxWindow* window = NULL);
/**
Ends context-sensitive help mode. Not normally called by the
application.
*/
bool EndContextHelp();
};
/**
@class wxContextHelpButton
@wxheader{cshelp.h}
Instances of this class may be used to add a question mark button that when
pressed, puts the application into context-help mode. It does this by
creating a wxContextHelp object which itself generates a wxEVT_HELP event
when the user clicks on a window.
On Windows, you may add a question-mark icon to a dialog by use of the
wxDIALOG_EX_CONTEXTHELP extra style, but on other platforms you will have
to add a button explicitly, usually next to OK, Cancel or similar buttons.
@library{wxcore}
@category{help}
@see wxBitmapButton, wxContextHelp
*/
class wxContextHelpButton : public wxBitmapButton
{
public:
/// Default constructor.
wxContextHelpButton();
/**
Constructor, creating and showing a context help button.
@param parent
Parent window. Must not be @NULL.
@param id
Button identifier. Defaults to wxID_CONTEXT_HELP.
@param pos
Button position.
@param size
Button size. If wxDefaultSize is specified then the button is sized
appropriately for the question mark bitmap.
@param style
Window style.
@remarks
Normally you only need pass the parent window to the constructor, and
use the defaults for the remaining parameters.
*/
wxContextHelpButton(wxWindow* parent,
wxWindowID id = wxID_CONTEXT_HELP,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxBU_AUTODRAW);
};
/**
@class wxSimpleHelpProvider
@wxheader{cshelp.h}
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.
@library{wxcore}
@category{help}
@see wxHelpProvider, wxHelpControllerHelpProvider, wxContextHelp,
wxWindow::SetHelpText()(, wxWindow::GetHelpTextAtPoint()
*/
class wxSimpleHelpProvider : public wxHelpProvider
{
public:
};

665
interface/wx/ctrlsub.h Normal file
View File

@@ -0,0 +1,665 @@
/////////////////////////////////////////////////////////////////////////////
// Name: ctrlsub.h
// Purpose: interface of wxControlWithItems
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxItemContainerImmutable
@wxheader{ctrlsub.h}
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.
Note that this is not a control, it's a mixin interface that classes
have to derive from in addition to wxControl or wxWindow.
Examples: wxListBox, wxCheckListBox, wxChoice and wxComboBox (which
implements an extended interface deriving from this one)
@library{wxcore}
@category{ctrl}
@see wxControlWithItems, wxItemContainer
*/
class wxItemContainerImmutable
{
public:
/// Constructor
wxItemContainerImmutable();
//@{
/**
Returns the number of items in the control.
@see IsEmpty()
*/
virtual unsigned int GetCount() const;
/**
Returns @true if the control is empty or @false if it has some items.
@see GetCount()
*/
bool IsEmpty() const;
/**
Returns the label of the item with the given index.
@param n
The zero-based index.
@return The label of the item or an empty string if the position was
invalid.
*/
virtual wxString GetString(unsigned int n) const;
/**
Returns the array of the labels of all items in the control.
*/
wxArrayString GetStrings() const;
/**
Sets the label for the given item.
@param n
The zero-based item index.
@param string
The label to set.
*/
virtual void SetString(unsigned int n, const wxString& s);
/**
Finds an item whose label matches the given string.
@param string
String to find.
@param caseSensitive
Whether search is case sensitive (default is not).
@return The zero-based position of the item, or wxNOT_FOUND if the
string was not found.
*/
virtual int FindString(const wxString& s, bool bCase = false) const;
//@}
/// @name Selection
//@{
/**
Sets the selection to the given item @a n or removes the selection
entirely if @a n == @c wxNOT_FOUND.
Note that this does not cause any command events to be emitted nor does
it deselect any other items in the controls which support multiple
selections.
@param n
The string position to select, starting from zero.
@see SetString(), SetStringSelection()
*/
virtual void SetSelection(int n);
/**
Returns the index of the selected item or @c wxNOT_FOUND if no item is
selected.
@return The position of the current selection.
@remarks This method can be used with single selection list boxes only,
you should use wxListBox::GetSelections() for the list
boxes with wxLB_MULTIPLE style.
@see SetSelection(), GetStringSelection()
*/
virtual int GetSelection() const;
/**
Selects the item with the specified string in the control. This doesn't
cause any command events to be emitted.
@param string
The string to select.
@return @true if the specified string has been selected, @false if it
wasn't found in the control.
*/
bool SetStringSelection(const wxString& string);
/**
Returns the label of the selected item or an empty string if no item is
selected.
@see GetSelection()
*/
virtual wxString GetStringSelection() const;
/**
This is the same as SetSelection() and exists only because it is
slightly more natural for controls which support multiple selection.
*/
void Select(int n);
//@}
};
/**
@class wxItemContainer
@wxheader{ctrlsub.h}
This class is an abstract base class for some wxWidgets controls which
contain several items such as wxListBox, wxCheckListBox, wxComboBox or
wxChoice. It defines an interface which is implemented by all controls
which have string subitems each of which may be selected.
wxItemContainer extends wxItemContainerImmutable interface with methods
for adding/removing items.
It defines the methods for accessing the controls items and although each
of the derived classes implements them differently, they still all conform
to the same interface.
The items in a wxItemContainer have (non-empty) string labels and,
optionally, client data associated with them. Client data may be of two
different kinds: either simple untyped (@c void *) pointers which are
simply stored by the control but not used in any way by it, or typed
pointers (wxClientData*) which are owned by the control meaning that the
typed client data (and only it) will be deleted when an item is deleted
using Delete() or the entire control is cleared using Clear(), which also
happens when it is destroyed.
Finally note that in the same control all items must have client data of
the same type (typed or untyped), if any. This type is determined by the
first call to Append() (the version with client data pointer) or
SetClientData().
Note that this is not a control, it's a mixin interface that classes
have to derive from in addition to wxControl or wxWindow. Convenience
class wxControlWithItems is provided for this purpose.
@library{wxcore}
@category{ctrl}
@see wxControlWithItems, wxItemContainerImmutable
*/
class wxItemContainer : public wxItemContainerImmutable
{
public:
//@{
/**
Appends item into the control.
@param item
String to add.
@return The return value is the index of the newly inserted item.
Note that this may be different from the last one if the
control is sorted (e.g. has @c wxLB_SORT or @c wxCB_SORT
style).
*/
int Append(const wxString& item);
/**
Appends item into the control.
@param item
String to add.
@param clientData
Pointer to client data to associate with the new item.
@return The return value is the index of the newly inserted item.
Note that this may be different from the last one if the
control is sorted (e.g. has @c wxLB_SORT or @c wxCB_SORT
style).
*/
int Append(const wxString& item, void* clientData);
/**
Appends item into the control.
@param item
String to add.
@param clientData
Pointer to client data to associate with the new item.
@return The return value is the index of the newly inserted item.
Note that this may be different from the last one if the
control is sorted (e.g. has @c wxLB_SORT or @c wxCB_SORT
style).
*/
int Append(const wxString& item, wxClientData* clientData);
/**
Appends several items at once into the control.
Notice that calling this method is usually much faster than appending
them one by one if you need to add a lot of items.
@param items
Array of strings to insert.
*/
void Append(const wxArrayString& items);
/**
Appends several items at once into the control.
Notice that calling this method is usually much faster than appending
them one by one if you need to add a lot of items.
@param items
Array of strings to insert.
@param clientData
Array of client data pointers of the same size as @a items to
associate with the new items.
*/
void Append(const wxArrayString& items, void **clientData);
/**
Appends several items at once into the control.
Notice that calling this method is usually much faster than appending
them one by one if you need to add a lot of items.
@param items
Array of strings to insert.
@param clientData
Array of client data pointers of the same size as @a items to
associate with the new items.
*/
void Append(const wxArrayString& items, wxClientData **clientData);
/**
Appends several items at once into the control.
Notice that calling this method is usually much faster than appending
them one by one if you need to add a lot of items.
@param n
Number of items in the @a items array.
@param items
Array of strings of size @a n.
*/
void Append(unsigned int n, const wxString* items);
/**
Appends several items at once into the control.
Notice that calling this method is usually much faster than appending
them one by one if you need to add a lot of items.
@param n
Number of items in the @a items array.
@param items
Array of strings of size @a n.
@param clientData
Array of client data pointers of size @a n to associate with the
new items.
*/
void Append(unsigned int n, const wxString* items,
void** clientData);
/**
Appends several items at once into the control.
Notice that calling this method is usually much faster than appending
them one by one if you need to add a lot of items.
@param n
Number of items in the @a items array.
@param items
Array of strings of size @a n.
@param clientData
Array of client data pointers of size @a n to associate with the
new items.
*/
void Append(unsigned int n, const wxString* items,
wxClientData** clientData);
//@}
/**
Removes all items from the control.
Clear() also deletes the client data of the existing items if it is
owned by the control.
*/
void Clear();
/**
Deletes an item from the control.
The client data associated with the item will be also deleted if it is
owned by the control. Note that it is an error (signalled by an assert
failure in debug builds) to remove an item with the index negative or
greater or equal than the number of items in the control.
@param n
The zero-based item index.
@see Clear()
*/
void Delete(unsigned int n);
//@{
/**
Returns a pointer to the client data associated with the given item (if
any). It is an error to call this function for a control which doesn't
have untyped client data at all although it is OK to call it even if
the given item doesn't have any client data associated with it (but
other items do).
@param n
The zero-based position of the item.
@return A pointer to the client data, or @NULL if not present.
*/
void* GetClientData(unsigned int n) const;
/**
Returns a pointer to the client data associated with the given item (if
any). It is an error to call this function for a control which doesn't
have typed client data at all although it is OK to call it even if the
given item doesn't have any client data associated with it (but other
items do).
@param n
The zero-based position of the item.
@return A pointer to the client data, or @NULL if not present.
*/
wxClientData* GetClientObject(unsigned int n) const;
/**
Associates the given untyped client data pointer with the given item.
Note that it is an error to call this function if any typed client data
pointers had been associated with the control items before.
@param n
The zero-based item index.
@param data
The client data to associate with the item.
*/
void SetClientData(unsigned int n, void* data);
/**
Associates the given typed client data pointer with the given item: the
@a data object will be deleted when the item is deleted (either
explicitly by using Delete() or implicitly when the control itself is
destroyed). Note that it is an error to call this function if any
untyped client data pointers had been associated with the control items
before.
@param n
The zero-based item index.
@param data
The client data to associate with the item.
*/
void SetClientObject(unsigned int n, wxClientData* data);
//@}
//@{
/**
Inserts item into the control.
@param item
String to add.
@param pos
Position to insert item before, zero based.
@return The return value is the index of the newly inserted item.
If the insertion failed for some reason, -1 is returned.
*/
int Insert(const wxString& item, unsigned int pos);
/**
Inserts item into the control.
@param item
String to add.
@param pos
Position to insert item before, zero based.
@param clientData
Pointer to client data to associate with the new item.
@return The return value is the index of the newly inserted item.
If the insertion failed for some reason, -1 is returned.
*/
int Insert(const wxString& item, unsigned int pos, void* clientData);
/**
Inserts item into the control.
@param item
String to add.
@param pos
Position to insert item before, zero based.
@param clientData
Pointer to client data to associate with the new item.
@return The return value is the index of the newly inserted item.
If the insertion failed for some reason, -1 is returned.
*/
int Insert(const wxString& item, unsigned int pos,
wxClientData* clientData);
/**
Inserts several items at once into the control.
Notice that calling this method is usually much faster than inserting
them one by one if you need to insert a lot of items.
@param items
Array of strings to insert.
@param pos
Position to insert the items before, zero based.
*/
void Insert(const wxArrayString& items, unsigned int pos);
/**
Inserts several items at once into the control.
Notice that calling this method is usually much faster than inserting
them one by one if you need to insert a lot of items.
@param items
Array of strings to insert.
@param pos
Position to insert the items before, zero based.
@param clientData
Array of client data pointers of the same size as @a items to
associate with the new items.
*/
void Insert(const wxArrayString& items, unsigned int pos,
void **clientData);
/**
Inserts several items at once into the control.
Notice that calling this method is usually much faster than inserting
them one by one if you need to insert a lot of items.
@param items
Array of strings to insert.
@param pos
Position to insert the items before, zero based.
@param clientData
Array of client data pointers of the same size as @a items to
associate with the new items.
*/
void Insert(const wxArrayString& items, unsigned int pos,
wxClientData **clientData);
/**
Inserts several items at once into the control.
Notice that calling this method is usually much faster than inserting
them one by one if you need to insert a lot of items.
@param n
Number of items in the @a items array.
@param items
Array of strings of size @a n.
@param pos
Position to insert the items before, zero based.
*/
void Insert(unsigned int n, const wxString* items,
unsigned int pos);
/**
Inserts several items at once into the control.
Notice that calling this method is usually much faster than inserting
them one by one if you need to insert a lot of items.
@param n
Number of items in the @a items array.
@param items
Array of strings of size @a n.
@param pos
Position to insert the new items before, zero based.
@param clientData
Array of client data pointers of size @a n to associate with the
new items.
*/
void Insert(unsigned int n, const wxString* items,
unsigned int pos,
void** clientData);
/**
Inserts several items at once into the control.
Notice that calling this method is usually much faster than inserting
them one by one if you need to insert a lot of items.
@param n
Number of items in the @a items array.
@param items
Array of strings of size @a n.
@param pos
Position to insert the new items before, zero based.
@param clientData
Array of client data pointers of size @a n to associate with the
new items.
*/
void Insert(unsigned int n, const wxString* items,
unsigned int pos,
wxClientData** clientData);
//@}
//@{
/**
Replaces the current control contents with the given items.
Notice that calling this method is usually much faster than appending
them one by one if you need to add a lot of items.
@param items
Array of strings to insert.
*/
void Set(const wxArrayString& items);
/**
Replaces the current control contents with the given items.
Notice that calling this method is usually much faster than appending
them one by one if you need to add a lot of items.
@param items
Array of strings to insert.
@param clientData
Array of client data pointers of the same size as @a items to
associate with the new items.
*/
void Set(const wxArrayString& items, void **clientData);
/**
Replaces the current control contents with the given items.
Notice that calling this method is usually much faster than appending
them one by one if you need to add a lot of items.
@param items
Array of strings to insert.
@param clientData
Array of client data pointers of the same size as @a items to
associate with the new items.
*/
void Set(const wxArrayString& items, wxClientData **clientData);
/**
Replaces the current control contents with the given items.
Notice that calling this method is usually much faster than appending
them one by one if you need to add a lot of items.
@param n
Number of items in the @a items array.
@param items
Array of strings of size @a n.
*/
void Set(unsigned int n, const wxString* items);
/**
Replaces the current control contents with the given items.
Notice that calling this method is usually much faster than appending
them one by one if you need to add a lot of items.
@param n
Number of items in the @a items array.
@param items
Array of strings of size @a n.
@param clientData
Array of client data pointers of size @a n to associate with the
new items.
*/
void Set(unsigned int n, const wxString* items, void** clientData);
/**
Replaces the current control contents with the given items.
Notice that calling this method is usually much faster than appending
them one by one if you need to add a lot of items.
@param n
Number of items in the @a items array.
@param items
Array of strings of size @a n.
@param clientData
Array of client data pointers of size @a n to associate with the
new items.
*/
void Set(unsigned int n, const wxString* items, wxClientData** clientData);
//@}
};
/**
@class wxControlWithItems
@wxheader{ctrlsub.h}
This is convenience class that derives from both wxControl and
wxItemContainer. It is used as basis for some wxWidgets controls
(wxChoice and wxListBox).
@library{wxcore}
@category{ctrl}
@see wxItemContainer, wxItemContainerImmutable
*/
class wxControlWithItems : public wxControl, public wxItemContainer
{
};

220
interface/wx/cursor.h Normal file
View File

@@ -0,0 +1,220 @@
/////////////////////////////////////////////////////////////////////////////
// Name: cursor.h
// Purpose: interface of wxCursor
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxCursor
@wxheader{cursor.h}
A cursor is a small bitmap usually used for denoting where the mouse
pointer is, with a picture that might indicate the interpretation of a
mouse click. As with icons, cursors in X and MS Windows are created in a
different manner. Therefore, separate cursors will be created for the
different environments. Platform-specific methods for creating a wxCursor
object are catered for, and this is an occasion where conditional
compilation will probably be required (see wxIcon for an example).
A single cursor object may be used in many windows (any subwindow type).
The wxWidgets convention is to set the cursor for a window, as in X, rather
than to set it globally as in MS Windows, although a global wxSetCursor()
function is also available for MS Windows use.
@section cursor_custom Creating a Custom Cursor
The following is an example of creating a cursor from 32x32 bitmap data
(down_bits) and a mask (down_mask) where 1 is black and 0 is white for the
bits, and 1 is opaque and 0 is transparent for the mask. It works on
Windows and GTK+.
@code
static char down_bits[] = { 255, 255, 255, 255, 31,
255, 255, 255, 31, 255, 255, 255, 31, 255, 255, 255,
31, 255, 255, 255, 31, 255, 255, 255, 31, 255, 255,
255, 31, 255, 255, 255, 31, 255, 255, 255, 25, 243,
255, 255, 19, 249, 255, 255, 7, 252, 255, 255, 15, 254,
255, 255, 31, 255, 255, 255, 191, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,
255 };
static char down_mask[] = { 240, 1, 0, 0, 240, 1,
0, 0, 240, 1, 0, 0, 240, 1, 0, 0, 240, 1, 0, 0, 240, 1,
0, 0, 240, 1, 0, 0, 240, 1, 0, 0, 255, 31, 0, 0, 255,
31, 0, 0, 254, 15, 0, 0, 252, 7, 0, 0, 248, 3, 0, 0,
240, 1, 0, 0, 224, 0, 0, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0 };
#ifdef __WXMSW__
wxBitmap down_bitmap(down_bits, 32, 32);
wxBitmap down_mask_bitmap(down_mask, 32, 32);
down_bitmap.SetMask(new wxMask(down_mask_bitmap));
wxImage down_image = down_bitmap.ConvertToImage();
down_image.SetOption(wxIMAGE_OPTION_CUR_HOTSPOT_X, 6);
down_image.SetOption(wxIMAGE_OPTION_CUR_HOTSPOT_Y, 14);
wxCursor down_cursor = wxCursor(down_image);
#else
wxCursor down_cursor = wxCursor(down_bits, 32, 32, 6, 14,
down_mask, wxWHITE, wxBLACK);
#endif
@endcode
@library{wxcore}
@category{gdi}
@stdobjects
- ::wxNullCursor
- ::wxSTANDARD_CURSOR
- ::wxHOURGLASS_CURSOR
- ::wxCROSS_CURSOR
@see wxBitmap, wxIcon, wxWindow::SetCursor(), wxSetCursor(),
::wxStockCursor
*/
class wxCursor : public wxBitmap
{
public:
/**
Default constructor.
*/
wxCursor();
/**
Constructs a cursor by passing an array of bits (Motif and GTK+ only).
@a maskBits is used only under Motif and GTK+. The parameters @a fg and
@a bg are only present on GTK+, and force the cursor to use particular
background and foreground colours.
If either @a hotSpotX or @a hotSpotY is -1, the hotspot will be the
centre of the cursor image (Motif only).
@param bits
An array of bits.
@param maskBits
Bits for a mask bitmap.
@param width
Cursor width.
@param height
Cursor height.
@param hotSpotX
Hotspot x coordinate.
@param hotSpotY
Hotspot y coordinate.
*/
wxCursor(const char bits[], int width, int height,
int hotSpotX = -1, int hotSpotY = -1,
const char maskBits[] = NULL,
wxColour* fg = NULL, wxColour* bg = NULL);
/**
Constructs a cursor by passing a string resource name or filename.
On MacOS when specifying a string resource name, first the color
cursors 'crsr' and then the black/white cursors 'CURS' in the resource
chain are scanned through.
@a hotSpotX and @a hotSpotY are currently only used under Windows when
loading from an icon file, to specify the cursor hotspot relative to
the top left of the image.
@param type
Icon type to load. Under Motif, type defaults to wxBITMAP_TYPE_XBM.
Under Windows, it defaults to wxBITMAP_TYPE_CUR_RESOURCE. Under
MacOS, it defaults to wxBITMAP_TYPE_MACCURSOR_RESOURCE.
Under X, the permitted cursor types are:
<ul>
<li>wxBITMAP_TYPE_XBM - Load an X bitmap file.</li>
</ul>
Under Windows, the permitted types are:
- wxBITMAP_TYPE_CUR - Load a cursor from a .cur cursor file (only
if USE_RESOURCE_LOADING_IN_MSW is enabled in
setup.h).
- wxBITMAP_TYPE_CUR_RESOURCE - Load a Windows resource (as
specified in the .rc file).
- wxBITMAP_TYPE_ICO - Load a cursor from a .ico icon file (only if
USE_RESOURCE_LOADING_IN_MSW is enabled in
setup.h). Specify @a hotSpotX and @a hotSpotY.
@param hotSpotX
Hotspot x coordinate.
@param hotSpotY
Hotspot y coordinate.
*/
wxCursor(const wxString& cursorName, long type,
int hotSpotX = 0, int hotSpotY = 0);
/**
Constructs a cursor using a cursor identifier.
@param cursorId
A stock cursor identifier. See ::wxStockCursor.
*/
wxCursor(wxStockCursor cursorId);
/**
Constructs a cursor from a wxImage. If cursor are monochrome on the
current platform, colors with the RGB elements all greater than 127
will be foreground, colors less than this background. The mask (if any)
will be used to specify the transparent area.
In wxMSW the foreground will be white and the background black. If the
cursor is larger than 32x32 it is resized.
In wxGTK, colour cursors and alpha channel are supported (starting from
GTK+ 2.2). Otherwise the two most frequent colors will be used for
foreground and background. In any case, the cursor will be displayed at
the size of the image.
In wxMac, if the cursor is larger than 16x16 it is resized and
currently only shown as black/white (mask respected).
*/
wxCursor(const wxImage& image);
/**
Copy constructor, uses @ref overview_refcount "reference counting".
@param cursor
Pointer or reference to a cursor to copy.
*/
wxCursor(const wxCursor& cursor);
/**
Destroys the cursor. See
@ref overview_refcount_destruct "reference-counted object destruction"
for more info.
A cursor can be reused for more than one window, and does not get
destroyed when the window is destroyed. wxWidgets destroys all cursors
on application exit, although it is best to clean them up explicitly.
*/
~wxCursor();
/**
Returns @true if cursor data is present.
*/
bool IsOk() const;
/**
Assignment operator, using @ref overview_refcount "reference counting".
*/
wxCursor operator =(const wxCursor& cursor);
};
/**
@name Predefined cursors.
@see wxStockCursor
*/
//@{
wxCursor wxNullCursor;
wxCursor* wxSTANDARD_CURSOR;
wxCursor* wxHOURGLASS_CURSOR;
wxCursor* wxCROSS_CURSOR;
//@}

705
interface/wx/dataobj.h Normal file
View File

@@ -0,0 +1,705 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dataobj.h
// Purpose: interface of wx*DataObject
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxCustomDataObject
@wxheader{dataobj.h}
wxCustomDataObject is a specialization of wxDataObjectSimple for some
application-specific data in arbitrary (either custom or one of the
standard ones). The only restriction is that it is supposed that this data
can be copied bitwise (i.e. with @c memcpy()), so it would be a bad idea to
make it contain a C++ object (though C struct is fine).
By default, wxCustomDataObject stores the data inside in a buffer. To put
the data into the buffer you may use either SetData() or TakeData()
depending on whether you want the object to make a copy of data or not.
This class may be used as is, but if you don't want store the data inside
the object but provide it on demand instead, you should override GetSize(),
GetData() and SetData() (or may be only the first two or only the last one
if you only allow reading/writing the data).
@library{wxcore}
@category{dnd}
@see wxDataObject
*/
class wxCustomDataObject : public wxDataObjectSimple
{
public:
/**
The constructor accepts a @a format argument which specifies the
(single) format supported by this object. If it isn't set here,
wxDataObjectSimple::SetFormat() should be used.
*/
wxCustomDataObject(const wxDataFormat& format = wxFormatInvalid);
/**
The destructor will free the data held by the object. Notice that
although it calls the virtual Free() function, the base class version
will always be called (C++ doesn't allow calling virtual functions from
constructors or destructors), so if you override Free(), you should
override the destructor in your class as well (which would probably
just call the derived class' version of Free()).
*/
virtual ~wxCustomDataObject();
/**
This function is called to allocate @a size bytes of memory from
SetData(). The default version just uses the 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 the data.
*/
virtual void Free();
/**
Returns a pointer to the data.
*/
virtual void* GetData() const;
/**
Returns the data size in bytes.
*/
virtual size_t GetSize() const;
/**
Set the data. The data object will make an internal copy.
@beginWxPythonOnly
This method expects a string in wxPython. You can pass nearly any
object by pickling it first.
@endWxPythonOnly
*/
virtual void SetData(size_t size, const void data);
/**
Like SetData(), but doesn't copy the data - instead the object takes
ownership of the pointer.
@beginWxPythonOnly
This method expects a string in wxPython. You can pass nearly any
object by pickling it first.
@endWxPythonOnly
*/
virtual void TakeData(size_t size, const void data);
};
/**
@class wxDataObjectComposite
@wxheader{dataobj.h}
wxDataObjectComposite is the simplest wxDataObject derivation which may be
used to support multiple formats. It contains several wxDataObjectSimple
objects and supports any format supported by at least one of them. Only one
of these data objects is @e preferred (the first one if not explicitly
changed by using the second parameter of Add()) and its format determines
the preferred format of the composite data object as well.
See wxDataObject documentation for the reasons why you might prefer to use
wxDataObject directly instead of wxDataObjectComposite for efficiency
reasons.
@library{wxcore}
@category{dnd}
@see @ref overview_dnd, wxDataObject, wxDataObjectSimple, wxFileDataObject,
wxTextDataObject, wxBitmapDataObject
*/
class wxDataObjectComposite : public wxDataObject
{
public:
/**
The default constructor.
*/
wxDataObjectComposite();
/**
Adds the @a dataObject to the list of supported objects and it becomes
the preferred object if @a preferred is @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 recieved data from
the clipboard or the DnD operation. You can use this method to find
out what kind of data object was recieved.
*/
wxDataFormat GetReceivedFormat() const;
};
/**
@class wxDataObjectSimple
@wxheader{dataobj.h}
This is the simplest possible implementation of the wxDataObject class. The
data object of (a class derived from) this class only supports one format,
so the number of virtual functions to be implemented is reduced.
Notice that this is still an abstract base class and cannot be used
directly, it must be derived. The objects supporting rendering the data
must override GetDataSize() and GetDataHere() while the objects which may
be set must override SetData(). Of course, the objects supporting both
operations must override all three methods.
@beginWxPythonOnly
If you wish to create a derived wxDataObjectSimple class in wxPython you
should derive the class from wxPyDataObjectSimple in order to get
Python-aware capabilities for the various virtual methods.
@endWxPythonOnly
@beginWxPerlOnly
In wxPerl, you need to derive your data object class from
Wx::PlDataObjectSimple.
@endWxPerlOnly
@library{wxcore}
@category{dnd}
@see @ref overview_dnd, @ref page_samples_dnd, wxFileDataObject,
wxTextDataObject, wxBitmapDataObject
*/
class wxDataObjectSimple : public wxDataObject
{
public:
/**
Constructor accepts the supported format (none by default) which may
also be set later with SetFormat().
*/
wxDataObjectSimple(const wxDataFormat& format = wxFormatInvalid);
/**
Copy the data to the buffer, return @true on success. Must be
implemented in the derived class if the object supports rendering its
data.
@beginWxPythonOnly
When implementing this method in wxPython, no additional parameters are
required and the data should be returned from the method as a string.
@endWxPythonOnly
*/
virtual bool GetDataHere(void buf) const;
/**
Gets the size of our data. Must be implemented in the derived class if
the object supports rendering its data.
*/
virtual size_t GetDataSize() const;
/**
Returns the (one and only one) format supported by this object. It is
assumed that the format is supported in both directions.
*/
const wxDataFormat GetFormat() const;
/**
Copy the data from the buffer, return @true on success. Must be
implemented in the derived class if the object supports setting its
data.
@beginWxPythonOnly
When implementing this method in wxPython, the data comes as a single
string parameter rather than the two shown here.
@endWxPythonOnly
*/
virtual bool SetData(size_t len, const void buf);
/**
Sets the supported format.
*/
void SetFormat(const wxDataFormat& format);
};
/**
@class wxBitmapDataObject
@wxheader{dataobj.h}
wxBitmapDataObject is a specialization of wxDataObject for bitmap data. It
can be used without change to paste data into the wxClipboard or a
wxDropSource. A user may wish to derive a new class from this class for
providing a bitmap on-demand in order to minimize memory consumption when
offering data in several formats, such as a bitmap and GIF.
This class may be used as is, but GetBitmap() may be overridden to increase
efficiency.
@beginWxPythonOnly
If you wish to create a derived wxBitmapDataObject class in wxPython you
should derive the class from wxPyBitmapDataObject in order to get
Python-aware capabilities for the various virtual methods.
@endWxPythonOnly
@library{wxcore}
@category{dnd}
@see @ref overview_dnd, wxDataObject, wxDataObjectSimple, wxFileDataObject,
wxTextDataObject, wxDataObject
*/
class wxBitmapDataObject : public wxDataObjectSimple
{
public:
/**
Constructor, optionally passing a bitmap (otherwise use SetBitmap()
later).
*/
wxBitmapDataObject(const wxBitmap& bitmap = wxNullBitmap);
/**
Returns the bitmap associated with the data object. You may wish to
override this method when offering data on-demand, but this is not
required by wxWidgets' internals. Use this method to get data in bitmap
form from the wxClipboard.
*/
virtual wxBitmap GetBitmap() const;
/**
Sets the bitmap associated with the data object. This method is called
when the data object receives data. Usually there will be no reason to
override this function.
*/
virtual void SetBitmap(const wxBitmap& bitmap);
};
/**
@class wxDataFormat
@wxheader{dataobj.h}
A wxDataFormat is an encapsulation of a platform-specific format handle
which is used by the system for the clipboard and drag and drop operations.
The applications are usually only interested in, for example, pasting data
from the clipboard only if the data is in a format the program understands
and a data format is something which uniquely identifies this format.
On the system level, a data format is usually just a number (@c CLIPFORMAT
under Windows or @c Atom under X11, for example) and the standard formats
are, indeed, just numbers which can be implicitly converted to wxDataFormat.
The standard formats are:
@beginDefList
@itemdef{wxDF_INVALID,
An invalid format - used as default argument for functions taking
a wxDataFormat argument sometimes.}
@itemdef{wxDF_TEXT,
Text format (wxString).}
@itemdef{wxDF_BITMAP,
A bitmap (wxBitmap).}
@itemdef{wxDF_METAFILE,
A metafile (wxMetafile, Windows only).}
@itemdef{wxDF_FILENAME,
A list of filenames.}
@itemdef{wxDF_HTML,
An HTML string. This is only valid when passed to
wxSetClipboardData when compiled with Visual C++ in non-Unicode
mode.}
@endDefList
As mentioned above, these standard formats may be passed to any function
taking wxDataFormat argument because wxDataFormat has an implicit
conversion from them (or, to be precise from the type
@c wxDataFormat::NativeFormat which is the type used by the underlying
platform for data formats).
Aside the standard formats, the application may also use custom formats
which are identified by their names (strings) and not numeric identifiers.
Although internally custom format must be created (or @e registered) first,
you shouldn't care about it because it is done automatically the first time
the wxDataFormat object corresponding to a given format name is created.
The only implication of this is that you should avoid having global
wxDataFormat objects with non-default constructor because their
constructors are executed before the program has time to perform all
necessary initialisations and so an attempt to do clipboard format
registration at this time will usually lead to a crash!
@library{wxbase}
@category{dnd}
@see @ref overview_dnd, @ref page_samples_dnd, wxDataObject
*/
class wxDataFormat
{
public:
/**
Constructs a data format object for one of the standard data formats or
an empty data object (use SetType() or SetId() later in this case).
*/
wxDataFormat(NativeFormat format = wxDF_INVALID);
/**
Constructs a data format object for a custom format identified by its
name @a format.
*/
wxDataFormat(const wxChar format);
/**
Returns the name of a custom format (this function will fail for a
standard format).
*/
wxString GetId() const;
/**
Returns the platform-specific number identifying the format.
*/
NativeFormat GetType() const;
/**
Sets the format to be the custom format identified by the given name.
*/
void SetId(const wxChar format);
/**
Sets the format to the given value, which should be one of wxDF_XXX
constants.
*/
void SetType(NativeFormat format);
/**
Returns @true if the formats are different.
*/
bool operator !=(const wxDataFormat& format) const;
/**
Returns @true if the formats are equal.
*/
bool operator ==(const wxDataFormat& format) const;
};
/**
@class wxURLDataObject
@wxheader{dataobj.h}
wxURLDataObject is a wxDataObject containing an URL and can be used e.g.
when you need to put an URL on or retrieve it from the clipboard:
@code
wxTheClipboard->SetData(new wxURLDataObject(url));
@endcode
@note This class is derived from wxDataObjectComposite on Windows rather
than wxTextDataObject on all other platforms.
@library{wxcore}
@category{dnd}
@see @ref overview_dnd, wxDataObject
*/
class wxURLDataObject: public wxTextDataObject
{
public:
/**
Constructor, may be used to initialize the URL. If @a url is empty,
SetURL() can be used later.
*/
wxURLDataObject(const wxString& url = wxEmptyString);
/**
Returns the URL stored by this object, as a string.
*/
wxString GetURL() const;
/**
Sets the URL stored by this object.
*/
void SetURL(const wxString& url);
};
/**
@class wxDataObject
@wxheader{dataobj.h}
A wxDataObject represents data that can be copied to or from the clipboard,
or dragged and dropped. The important thing about wxDataObject is that this
is a 'smart' piece of data unlike 'dumb' data containers such as memory
buffers or files. Being 'smart' here means that the data object itself
should know what data formats it supports and how to render itself in each
of its supported formats.
A supported format, incidentally, is exactly the format in which the data
can be requested from a data object or from which the data object may be
set. In the general case, an object may support different formats on
'input' and 'output', i.e. it may be able to render itself in a given
format but not be created from data on this format or vice versa.
wxDataObject defines an enumeration type which distinguishes between them:
@code
enum Direction
{
Get = 0x01, // format is supported by GetDataHere()
Set = 0x02 // format is supported by SetData()
};
@endcode
See wxDataFormat documentation for more about formats.
Not surprisingly, being 'smart' comes at a price of added complexity. This
is reasonable for the situations when you really need to support multiple
formats, but may be annoying if you only want to do something simple like
cut and paste text.
To provide a solution for both cases, wxWidgets has two predefined classes
which derive from wxDataObject: wxDataObjectSimple and
wxDataObjectComposite. wxDataObjectSimple is the simplest wxDataObject
possible and only holds data in a single format (such as HTML or text) and
wxDataObjectComposite is the simplest way to implement a wxDataObject that
does support multiple formats because it achieves this by simply holding
several wxDataObjectSimple objects.
So, you have several solutions when you need a wxDataObject class (and you
need one as soon as you want to transfer data via the clipboard or drag and
drop):
-# Use one of the built-in classes.
- You may use wxTextDataObject, wxBitmapDataObject or wxFileDataObject
in the simplest cases when you only need to support one format and
your data is either text, bitmap or list of files.
-# Use wxDataObjectSimple
- Deriving from wxDataObjectSimple is the simplest solution for custom
data - you will only support one format and so probably won't be able
to communicate with other programs, but data transfer will work in
your program (or between different copies of it).
-# Use wxDataObjectComposite
- This is a simple but powerful solution which allows you to support
any number of formats (either standard or custom if you combine it
with the previous solution).
-# Use wxDataObject Directly
- This is the solution for maximal flexibility and efficiency, but it
is also the most difficult to implement.
Please note that the easiest way to use drag and drop and the clipboard
with multiple formats is by using wxDataObjectComposite, but it is not the
most efficient one as each wxDataObjectSimple would contain the whole data
in its respective formats. Now imagine that you want to paste 200 pages of
text in your proprietary format, as well as Word, RTF, HTML, Unicode and
plain text to the clipboard and even today's computers are in trouble. For
this case, you will have to derive from wxDataObject directly and make it
enumerate its formats and provide the data in the requested format on
demand.
Note that neither the GTK+ data transfer mechanisms for clipboard and drag
and drop, nor OLE data transfer, copy any data until another application
actually requests the data. This is in contrast to the 'feel' offered to
the user of a program who would normally think that the data resides in the
clipboard after having pressed 'Copy' - in reality it is only declared to
be available.
There are several predefined data object classes derived from
wxDataObjectSimple: wxFileDataObject, wxTextDataObject, wxBitmapDataObject
and wxURLDataObject which can be used without change.
You may also derive your own data object classes from wxCustomDataObject
for user-defined types. The format of user-defined data is given as a
mime-type string literal, such as "application/word" or "image/png". These
strings are used as they are under Unix (so far only GTK+) to identify a
format and are translated into their Windows equivalent under Win32 (using
the OLE IDataObject for data exchange to and from the clipboard and for
drag and drop). Note that the format string translation under Windows is
not yet finished.
Each class derived directly from wxDataObject must override and implement
all of its functions which are pure virtual in the base class. The data
objects which only render their data or only set it (i.e. work in only one
direction), should return 0 from GetFormatCount().
@beginWxPythonOnly
At this time this class is not directly usable from wxPython. Derive a
class from wxPyDataObjectSimple() instead.
@endWxPythonOnly
@beginWxPerlOnly
This class is not currently usable from wxPerl; you may use
Wx::PlDataObjectSimple instead.
@endWxPerlOnly
@library{wxcore}
@category{dnd}
@see @ref overview_dnd, @ref page_samples_dnd, wxFileDataObject,
wxTextDataObject, wxBitmapDataObject, wxCustomDataObject,
wxDropTarget, wxDropSource, wxTextDropTarget, wxFileDropTarget
*/
class wxDataObject
{
public:
/**
Constructor.
*/
wxDataObject();
/**
Destructor.
*/
~wxDataObject();
/**
Copy all supported formats in the given direction to the array pointed
to by @a formats. There is enough space for GetFormatCount(dir) formats
in it.
*/
virtual void GetAllFormats(wxDataFormat* formats,
Direction dir = Get) const;
/**
The method will write the data of the format @a format in the buffer
@a buf and return @true on success, @false on failure.
*/
virtual bool GetDataHere(const wxDataFormat& format, void buf) const;
/**
Returns the data size of the given format @a format.
*/
virtual size_t GetDataSize(const wxDataFormat& format) const;
/**
Returns the number of available formats for rendering or setting the
data.
*/
virtual size_t GetFormatCount(Direction dir = Get) const;
/**
Returns the preferred format for either rendering the data (if @a dir
is @c Get, its default value) or for setting it. Usually this will be
the native format of the wxDataObject.
*/
virtual wxDataFormat GetPreferredFormat(Direction dir = Get) const;
/**
Set the data in the format @a format of the length @a len provided in
the buffer @a buf.
@return @true on success, @false on failure.
*/
virtual bool SetData(const wxDataFormat& format, size_t len,
const void buf);
};
/**
@class wxTextDataObject
@wxheader{dataobj.h}
wxTextDataObject is a specialization of wxDataObject for text data. It can
be used without change to paste data into the wxClipboard or a
wxDropSource. A user may wish to derive a new class from this class for
providing text on-demand in order to minimize memory consumption when
offering data in several formats, such as plain text and RTF because by
default the text is stored in a string in this class, but it might as well
be generated when requested. For this, GetTextLength() and GetText() will
have to be overridden.
Note that if you already have the text inside a string, you will not
achieve any efficiency gain by overriding these functions because copying
wxStrings is already a very efficient operation (data is not actually
copied because wxStrings are reference counted).
@beginWxPythonOnly
If you wish to create a derived wxTextDataObject class in wxPython you
should derive the class from wxPyTextDataObject in order to get
Python-aware capabilities for the various virtual methods.
@endWxPythonOnly
@library{wxcore}
@category{dnd}
@see @ref overview_dnd, wxDataObject, wxDataObjectSimple, wxFileDataObject,
wxBitmapDataObject
*/
class wxTextDataObject : public wxDataObjectSimple
{
public:
/**
Constructor, may be used to initialise the text (otherwise SetText()
should be used later).
*/
wxTextDataObject(const wxString& text = wxEmptyString);
/**
Returns the text associated with the data object. You may wish to
override this method when offering data on-demand, but this is not
required by wxWidgets' internals. Use this method to get data in text
form from the wxClipboard.
*/
virtual wxString GetText() const;
/**
Returns the data size. By default, returns the size of the text data
set in the constructor or using SetText(). This can be overridden to
provide text size data on-demand. It is recommended to return the text
length plus 1 for a trailing zero, but this is not strictly required.
*/
virtual size_t GetTextLength() const;
/**
Sets the text associated with the data object. This method is called
when the data object receives the data and, by default, copies the text
into the member variable. If you want to process the text on the fly
you may wish to override this function.
*/
virtual void SetText(const wxString& strText);
};
/**
@class wxFileDataObject
@wxheader{dataobj.h}
wxFileDataObject is a specialization of wxDataObject for file names. The
program works with it just as if it were a list of absolute file names, but
internally it uses the same format as Explorer and other compatible
programs under Windows or GNOME/KDE filemanager under Unix which makes it
possible to receive files from them using this class.
@warning Under all non-Windows platforms this class is currently
"input-only", i.e. you can receive the files from another
application, but copying (or dragging) file(s) from a wxWidgets
application is not currently supported. PS: GTK2 should work as
well.
@library{wxcore}
@category{dnd}
@see wxDataObject, wxDataObjectSimple, wxTextDataObject,
wxBitmapDataObject, wxDataObject
*/
class wxFileDataObject : public wxDataObjectSimple
{
public:
/**
Constructor.
*/
wxFileDataObject();
/**
Adds a file to the file list represented by this data object (Windows
only).
*/
virtual void AddFile(const wxString& file);
/**
Returns the array of file names.
*/
const wxArrayString GetFilenames() const;
};

1997
interface/wx/dataview.h Normal file

File diff suppressed because it is too large Load Diff

157
interface/wx/datectrl.h Normal file
View File

@@ -0,0 +1,157 @@
/////////////////////////////////////////////////////////////////////////////
// Name: datectrl.h
// Purpose: interface of wxDatePickerCtrl
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxDatePickerCtrl
@wxheader{datectrl.h}
This control allows the user to select a date. Unlike wxCalendarCtrl, which
is a relatively big control, wxDatePickerCtrl is implemented as a small
window showing the currently selected date. The control can be edited using
the keyboard, and can also display a popup window for more user-friendly
date selection, depending on the styles used and the platform, except
PalmOS where date is selected using native dialog.
It is only available if @c wxUSE_DATEPICKCTRL is set to 1.
@beginStyleTable
@style{wxDP_SPIN}
Creates a control without a month calendar drop down but with
spin-control-like arrows to change individual date components. This
style is not supported by the generic version.
@style{wxDP_DROPDOWN}
Creates a control with a month calendar drop-down part from which
the user can select a date.
@style{wxDP_DEFAULT}
Creates a control with the style that is best supported for the
current platform (currently wxDP_SPIN under Windows and
wxDP_DROPDOWN elsewhere).
@style{wxDP_ALLOWNONE}
With this style, the control allows the user to not enter any valid
date at all. Without it - the default - the control always has some
valid date.
@style{wxDP_SHOWCENTURY}
Forces display of the century in the default date format. Without
this style the century could be displayed, or not, depending on the
default date representation in the system.
@endStyleTable
@beginEventTable{wxDateEvent}
@event{EVT_DATE_CHANGED(id, func)}
This event fires when the user changes the current selection in the
control.
@endEventTable
@library{wxadv}
@category{pickers}
<!-- @appearance{datepickerctrl.png} -->
@see wxCalendarCtrl, wxDateEvent
*/
class wxDatePickerCtrl : public wxControl
{
public:
/**
Initializes the object and calls Create() with all the parameters.
*/
wxDatePickerCtrl(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 = "datectrl");
/**
@param parent
Parent window, must not be non-@NULL.
@param id
The identifier for the control.
@param dt
The initial value of the control, if an invalid date (such as the
default value) is used, the control is set to today.
@param pos
Initial position.
@param size
Initial size. If left at default value, the control chooses its own
best size by using the height approximately equal to a text control
and width large enough to show the date string fully.
@param style
The window style, should be left at 0 as there are no special
styles for this control in this version.
@param validator
Validator which can be used for additional date checks.
@param name
Control name.
@return @true if the control was successfully created or @false if
creation failed.
*/
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 = "datectrl");
/**
If the control had been previously limited to a range of dates using
SetRange(), returns the lower and upper bounds of this range. If no
range is set (or only one of the bounds is set), @a dt1 and/or @a dt2
are set to be invalid.
@param dt1
Pointer to the object which receives the lower range limit or
becomes invalid if it is not set. May be @NULL if the caller is not
interested in lower limit.
@param dt2
Same as above but for the upper limit.
@return @false if no range limits are currently set, @true if at least
one bound is set.
*/
bool GetRange(wxDateTime* dt1, wxDateTime dt2) const;
/**
Returns the currently selected. If there is no selection or the
selection is outside of the current range, an invalid object is
returned.
*/
wxDateTime GetValue() const;
/**
Sets the display format for the date in the control. See wxDateTime for
the meaning of format strings.
@note This function is only available in the generic version of this
control. The native version always uses the current system locale.
@remarks If the format parameter is invalid, the behaviour is undefined.
*/
void SetFormat(const wxChar* format);
/**
Sets the valid range for the date selection. If @a dt1 is valid, it
becomes the earliest date (inclusive) accepted by the control. If
@a dt2 is valid, it becomes the latest possible date.
@remarks If the current value of the control is outside of the newly
set range bounds, the behaviour is undefined.
*/
void SetRange(const wxDateTime& dt1, const wxDateTime& dt2);
/**
Changes the current value of the control. The date should be valid and
included in the currently selected range, if any.
Calling this method does not result in a date change event.
*/
void SetValue(const wxDateTime& dt);
};

34
interface/wx/dateevt.h Normal file
View File

@@ -0,0 +1,34 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dateevt.h
// Purpose: interface of wxDateEvent
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxDateEvent
@wxheader{dateevt.h}
This event class holds information about a date change and is used together
with wxDatePickerCtrl. It also serves as a base class
for wxCalendarEvent.
@library{wxadv}
@category{events}
*/
class wxDateEvent : public wxCommandEvent
{
public:
/**
Returns the date.
*/
const wxDateTime GetDate() const;
/**
Sets the date carried by the event, normally only used by the library
internally.
*/
void SetDate(const wxDateTime& date);
};

2061
interface/wx/datetime.h Normal file

File diff suppressed because it is too large Load Diff

280
interface/wx/datstrm.h Normal file
View File

@@ -0,0 +1,280 @@
/////////////////////////////////////////////////////////////////////////////
// Name: datstrm.h
// Purpose: interface of wxDataInputStream and wxDataOutputStream
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxDataOutputStream
@wxheader{datstrm.h}
This class provides functions that write binary data types in a portable
way. Data can be written in either big-endian or little-endian format,
little-endian being the default on all architectures.
If you want to write data to text files (or streams) use wxTextOutputStream
instead.
The "<<" operator is overloaded and you can use this class like a standard
C++ iostream. See wxDataInputStream for its usage and caveats.
@library{wxbase}
@category{streams}
@see wxDataInputStream
*/
class wxDataOutputStream
{
public:
/**
Constructs a datastream object from an output stream. Only write
methods will be available.
@param stream
The output stream.
*/
wxDataOutputStream(wxOutputStream& stream);
/**
Constructs a datastream object from an output stream. Only write
methods will be available. This constructor is only available in
Unicode builds of wxWidgets.
@param stream
The output stream.
@param conv
Charset conversion object object used to encoding Unicode strings
before writing them to the stream in Unicode mode (see
WriteString() for a detailed description). Note that you must not
destroy @a conv before you destroy this wxDataOutputStream
instance! It is recommended to use the default value (UTF-8).
*/
wxDataOutputStream(wxOutputStream& stream,
const wxMBConv& conv = wxConvAuto());
/**
Destroys the wxDataOutputStream object.
*/
~wxDataOutputStream();
/**
If @a be_order is @true, all data will be written in big-endian order,
e.g. for reading on a Sparc or from Java-Streams (which always use
big-endian order), otherwise data will be written in little-endian
order.
*/
void BigEndianOrdered(bool be_order);
/**
Writes the single byte @a i8 to the stream.
*/
void Write8(wxUint8 i8);
/**
Writes an array of bytes to the stream. The amount of bytes to write is
specified with the @a size variable.
*/
void Write8(const wxUint8* buffer, size_t size);
/**
Writes the 16 bit unsigned integer @a i16 to the stream.
*/
void Write16(wxUint16 i16);
/**
Writes an array of 16 bit unsigned integer to the stream. The amount of
16 bit unsigned integer to write is specified with the @a size variable.
*/
void Write16(const wxUint16* buffer, size_t size);
/**
Writes the 32 bit unsigned integer @a i32 to the stream.
*/
void Write32(wxUint32 i32);
/**
Writes an array of 32 bit unsigned integer to the stream. The amount of
32 bit unsigned integer to write is specified with the @a size variable.
*/
void Write32(const wxUint32* buffer, size_t size);
/**
Writes the 64 bit unsigned integer @a i64 to the stream.
*/
void Write64(wxUint64 i64);
/**
Writes an array of 64 bit unsigned integer to the stream. The amount of
64 bit unsigned integer to write is specified with the @a size variable.
*/
void Write64(const wxUint64* buffer, size_t size);
/**
Writes the double @a f to the stream using the IEEE format.
*/
void WriteDouble(double f);
/**
Writes an array of double to the stream. The amount of double to write is
specified with the @a size variable.
*/
void WriteDouble(const double* buffer, size_t size);
/**
Writes @a string to the stream. Actually, this method writes the size
of the string before writing @a string itself.
In ANSI build of wxWidgets, the string is written to the stream in
exactly same way it is represented in memory. In Unicode build,
however, the string is first converted to multibyte representation with
@e conv object passed to stream's constructor (consequently, ANSI
applications can read data written by Unicode application, as long as
they agree on encoding) and this representation is written to the
stream. UTF-8 is used by default.
*/
void WriteString(const wxString& string);
};
/**
@class wxDataInputStream
@wxheader{datstrm.h}
This class provides functions that read binary data types in a portable
way. Data can be read in either big-endian or little-endian format,
little-endian being the default on all architectures.
If you want to read data from text files (or streams) use wxTextInputStream
instead.
The ">>" operator is overloaded and you can use this class like a standard
C++ iostream. Note, however, that the arguments are the fixed size types
wxUint32, wxInt32 etc and on a typical 32-bit computer, none of these match
to the "long" type (wxInt32 is defined as signed int on 32-bit
architectures) so that you cannot use long. To avoid problems (here and
elsewhere), make use of the wxInt32, wxUint32, etc types.
For example:
@code
wxFileInputStream input( "mytext.dat" );
wxDataInputStream store( input );
wxUint8 i1;
float f2;
wxString line;
store >> i1; // read a 8 bit integer.
store >> i1 >> f2; // read a 8 bit integer followed by float.
store >> line; // read a text line
@endcode
@library{wxbase}
@category{streams}
@see wxDataOutputStream
*/
class wxDataInputStream
{
public:
/**
Constructs a datastream object from an input stream. Only read methods
will be available.
@param stream
The input stream.
*/
wxDataInputStream(wxInputStream& stream);
/**
Constructs a datastream object from an input stream. Only read methods
will be available. This constructor is only available in Unicode builds
of wxWidgets.
@param stream
The input stream.
@param conv
Charset conversion object object used to decode strings in Unicode
mode (see ReadString() for a detailed description). Note that you
must not destroy @a conv before you destroy this wxDataInputStream
instance!
*/
wxDataInputStream(wxInputStream& stream,
const wxMBConv& conv = wxConvAuto());
/**
Destroys the wxDataInputStream object.
*/
~wxDataInputStream();
/**
If @a be_order is @true, all data will be read in big-endian order,
such as written by programs on a big endian architecture (e.g. Sparc)
or written by Java-Streams (which always use big-endian order).
*/
void BigEndianOrdered(bool be_order);
/**
Reads a single byte from the stream.
*/
wxUint8 Read8();
/**
Reads bytes from the stream in a specified buffer. The amount of bytes
to read is specified by the @a size variable.
*/
void Read8(wxUint8* buffer, size_t size);
/**
Reads a 16 bit unsigned integer from the stream.
*/
wxUint16 Read16();
/**
Reads 16 bit unsigned integers from the stream in a specified buffer.
The amount of 16 bit unsigned integers to read is specified by the
@a size variable.
*/
void Read16(wxUint16* buffer, size_t size);
/**
Reads a 32 bit unsigned integer from the stream.
*/
wxUint32 Read32();
/**
Reads 32 bit unsigned integers from the stream in a specified buffer.
The amount of 32 bit unsigned integers to read is specified by the
@a size variable.
*/
void Read32(wxUint32* buffer, size_t size);
/**
Reads a 64 bit unsigned integer from the stream.
*/
wxUint64 Read64();
/**
Reads 64 bit unsigned integers from the stream in a specified buffer.
The amount of 64 bit unsigned integers to read is specified by the
@a size variable.
*/
void Read64(wxUint64* buffer, size_t size);
/**
Reads a double (IEEE encoded) from the stream.
*/
double ReadDouble();
/**
Reads double data (IEEE encoded) from the stream in a specified buffer.
The amount of doubles to read is specified by the @a size variable.
*/
void ReadDouble(double* buffer, size_t size);
/**
Reads a string from a stream. Actually, this function first reads a
long integer specifying the length of the string (without the last null
character) and then reads the string.
In Unicode build of wxWidgets, the fuction first reads multibyte
(char*) string from the stream and then converts it to Unicode using
the @e conv object passed to constructor and returns the result as
wxString. You are responsible for using the same convertor as when
writing the stream.
@see wxDataOutputStream::WriteString()
*/
wxString ReadString();
};

1145
interface/wx/dc.h Normal file

File diff suppressed because it is too large Load Diff

180
interface/wx/dcbuffer.h Normal file
View File

@@ -0,0 +1,180 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dcbuffer.h
// Purpose: interface of wxBufferedDC
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxBufferedDC
@wxheader{dcbuffer.h}
This class provides a simple way to avoid flicker: when drawing on it,
everything is in fact first drawn on an in-memory buffer (a wxBitmap) and
then copied to the screen, using the associated wxDC, only once, when this
object is destroyed. wxBufferedDC itself is typically associated with
wxClientDC, if you want to use it in your @c EVT_PAINT handler, you should
look at wxBufferedPaintDC instead.
When used like this, a valid @e DC must be specified in the constructor
while the @e buffer bitmap doesn't have to be explicitly provided, by
default this class will allocate the bitmap of required size itself.
However using a dedicated bitmap can speed up the redrawing process by
eliminating the repeated creation and destruction of a possibly big bitmap.
Otherwise, wxBufferedDC can be used in the same way as any other device
context.
There is another possible use for wxBufferedDC is to use it to maintain a
backing store for the window contents. In this case, the associated @e DC
may be @NULL but a valid backing store bitmap should be specified.
Finally, please note that GTK+ 2.0 as well as OS X provide double buffering
themselves natively. You can either use wxWindow::IsDoubleBuffered() to
determine whether you need to use buffering or not, or use
wxAutoBufferedPaintDC to avoid needless double buffering on the systems
which already do it automatically.
@library{wxcore}
@category{dc}
@see wxDC, wxMemoryDC, wxBufferedPaintDC, wxAutoBufferedPaintDC
*/
class wxBufferedDC : public wxMemoryDC
{
public:
/**
Default constructor. You must call one of the Init() methods later in
order to use the device context.
*/
wxBufferedDC();
//@{
/**
Creates a buffer for the provided @dc. Init() must not be called when
using this constructor.
@param dc
The underlying DC: everything drawn to this object will be flushed
to this DC when this object is destroyed. You may pass @NULL in
order to just initialize the buffer, and not flush it.
@param area
The size of the bitmap to be used for buffering (this bitmap is
created internally when it is not given explicitly).
@param buffer
Explicitly provided bitmap to be used for buffering: this is the
most efficient solution as the bitmap doesn't have to be recreated
each time but it also requires more memory as the bitmap is never
freed. The bitmap should have appropriate size, anything drawn
outside of its bounds is clipped.
@param style
wxBUFFER_CLIENT_AREA to indicate that just the client area of the
window is buffered, or wxBUFFER_VIRTUAL_AREA to indicate that the
buffer bitmap covers the virtual area.
*/
wxBufferedDC(wxDC* dc, const wxSize& area,
int style = wxBUFFER_CLIENT_AREA);
wxBufferedDC(wxDC* dc, wxBitmap& buffer,
int style = wxBUFFER_CLIENT_AREA);
//@}
/**
Copies everything drawn on the DC so far to the underlying DC
associated with this object, if any.
*/
~wxBufferedDC();
//@{
/**
Initializes the object created using the default constructor. Please
see the constructors for parameter details.
*/
void Init(wxDC* dc, const wxSize& area,
int style = wxBUFFER_CLIENT_AREA);
void Init(wxDC* dc, wxBitmap& buffer,
int style = wxBUFFER_CLIENT_AREA);
//@}
};
/**
@class wxAutoBufferedPaintDC
@wxheader{dcbuffer.h}
This wxDC derivative can be used inside of an @c EVT_PAINT() event handler
to achieve double-buffered drawing. Just use this class instead of
wxPaintDC and make sure wxWindow::SetBackgroundStyle() is called with
wxBG_STYLE_CUSTOM somewhere in the class initialization code, and that's
all you have to do to (mostly) avoid flicker.
The difference between wxBufferedPaintDC and this class is that this class
won't double-buffer on platforms which have native double-buffering
already, avoiding any unneccessary buffering to avoid flicker.
wxAutoBufferedPaintDC is simply a typedef of wxPaintDC on platforms that
have native double-buffering, otherwise, it is a typedef of
wxBufferedPaintDC.
@library{wxbase}
@category{dc}
@see wxDC, wxBufferedPaintDC, wxPaintDC
*/
class wxAutoBufferedPaintDC : public wxBufferedPaintDC
{
public:
/**
Constructor. Pass a pointer to the window on which you wish to paint.
*/
wxAutoBufferedPaintDC(wxWindow* window);
};
/**
@class wxBufferedPaintDC
@wxheader{dcbuffer.h}
This is a subclass of wxBufferedDC which can be used inside of an
@c EVT_PAINT() event handler to achieve double-buffered drawing. Just use
this class instead of wxPaintDC and make sure
wxWindow::SetBackgroundStyle() is called with wxBG_STYLE_CUSTOM somewhere
in the class initialization code, and that's all you have to do to (mostly)
avoid flicker. The only thing to watch out for is that if you are using
this class together with wxScrolled, you probably do @b not want to call
wxScrolled::PrepareDC() on it as it already does this internally for the
real underlying wxPaintDC.
@library{wxcore}
@category{dc}
@see wxDC, wxBufferedDC, wxAutoBufferedPaintDC, wxPaintDC
*/
class wxBufferedPaintDC : public wxBufferedDC
{
public:
//@{
/**
As with wxBufferedDC, you may either provide the bitmap to be used for
buffering or let this object create one internally (in the latter case,
the size of the client part of the window is used).
Pass wxBUFFER_CLIENT_AREA for the @a style parameter to indicate that
just the client area of the window is buffered, or
wxBUFFER_VIRTUAL_AREA to indicate that the buffer bitmap covers the
virtual area.
*/
wxBufferedPaintDC(wxWindow* window, wxBitmap& buffer,
int style = wxBUFFER_CLIENT_AREA);
wxBufferedPaintDC(wxWindow* window,
int style = wxBUFFER_CLIENT_AREA);
//@}
/**
Copies everything drawn on the DC so far to the window associated with
this object, using a wxPaintDC.
*/
~wxBufferedPaintDC();
};

112
interface/wx/dcclient.h Normal file
View File

@@ -0,0 +1,112 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dcclient.h
// Purpose: interface of wxClientDC and wxPaintDC
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxPaintDC
@wxheader{dcclient.h}
A wxPaintDC must be constructed if an application wishes to paint on the
client area of a window from within an EVT_PAINT() event handler. This
should normally be constructed as a temporary stack object; don't store a
wxPaintDC object. If you have an EVT_PAINT() handler, you @e must create a
wxPaintDC object within it even if you don't actually use it.
Using wxPaintDC within your EVT_PAINT() handler is important because it
automatically sets the clipping area to the damaged area of the window.
Attempts to draw outside this area do not appear.
To draw on a window from outside your EVT_PAINT() handler, construct a
wxClientDC object.
To draw on the whole window including decorations, construct a wxWindowDC
object (Windows only).
A wxPaintDC object is initialized to use the same font and colours as the
window it is associated with.
@library{wxcore}
@category{dc}
@see wxDC, wxClientDC, wxMemoryDC, wxWindowDC, wxScreenDC
*/
class wxPaintDC : public wxWindowDC
{
public:
/**
Constructor. Pass a pointer to the window on which you wish to paint.
*/
wxPaintDC(wxWindow* window);
};
/**
@class wxClientDC
@wxheader{dcclient.h}
A wxClientDC must be constructed if an application wishes to paint on the
client area of a window from outside an EVT_PAINT() handler. This should
normally be constructed as a temporary stack object; don't store a
wxClientDC object.
To draw on a window from within an EVT_PAINT() handler, construct a
wxPaintDC object instead.
To draw on the whole window including decorations, construct a wxWindowDC
object (Windows only).
A wxClientDC object is initialized to use the same font and colours as the
window it is associated with.
@library{wxcore}
@category{dc}
@see wxDC, wxMemoryDC, wxPaintDC, wxWindowDC, wxScreenDC
*/
class wxClientDC : public wxWindowDC
{
public:
/**
Constructor. Pass a pointer to the window on which you wish to paint.
*/
wxClientDC(wxWindow* window);
};
/**
@class wxWindowDC
@wxheader{dcclient.h}
A wxWindowDC must be constructed if an application wishes to paint on the
whole area of a window (client and decorations). This should normally be
constructed as a temporary stack object; don't store a wxWindowDC object.
To draw on a window from inside an EVT_PAINT() handler, construct a
wxPaintDC object instead.
To draw on the client area of a window from outside an EVT_PAINT() handler,
construct a wxClientDC object.
A wxWindowDC object is initialized to use the same font and colours as the
window it is associated with.
@library{wxcore}
@category{dc}
@see wxDC, wxMemoryDC, wxPaintDC, wxClientDC, wxScreenDC
*/
class wxWindowDC : public wxDC
{
public:
/**
Constructor. Pass a pointer to the window on which you wish to paint.
*/
wxWindowDC(wxWindow* window);
};

44
interface/wx/dcgraph.h Normal file
View File

@@ -0,0 +1,44 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dcgraph.h
// Purpose: interface of wxGCDC
// Author: wxWidgets team
// RCS-ID: $Id: $
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxGCDC
@wxheader{dcgraph.h}
wxGCDC is a device context that draws on a wxGraphicsContext.
@library{wxcore}
@category{dc}
@see wxDC, wxGraphicsContext
*/
class wxGCDC: public wxDC
{
public:
/**
Constructs a wxGCDC from a wxWindowDC.
*/
wxGCDC( const wxWindowDC& dc );
/**
Constructs a wxGCDC from a wxMemoryDC.
*/
wxGCDC( const wxMemoryDC& dc );
/**
Constructs a wxGCDC from a wxPrinterDC.
*/
wxGCDC( const wxPrinterDC& dc );
/**
Retrieves associated wxGraphicsContext
*/
wxGraphicsContext* GetGraphicsContext();
};

99
interface/wx/dcmemory.h Normal file
View File

@@ -0,0 +1,99 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dcmemory.h
// Purpose: interface of wxMemoryDC
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxMemoryDC
@wxheader{dcmemory.h}
A memory device context provides a means to draw graphics onto a bitmap.
When drawing in to a mono-bitmap, using @c wxWHITE, @c wxWHITE_PEN and
@c wxWHITE_BRUSH will draw the background colour (i.e. 0) whereas all other
colours will draw the foreground colour (i.e. 1).
A bitmap must be selected into the new memory DC before it may be used for
anything. Typical usage is as follows:
@code
// Create a memory DC
wxMemoryDC temp_dc;
temp_dc.SelectObject(test_bitmap);
// We can now draw into the memory DC...
// Copy from this DC to another DC.
old_dc.Blit(250, 50, BITMAP_WIDTH, BITMAP_HEIGHT, temp_dc, 0, 0);
@endcode
Note that the memory DC must be deleted (or the bitmap selected out of it)
before a bitmap can be reselected into another memory DC.
And, before performing any other operations on the bitmap data, the bitmap
must be selected out of the memory DC:
@code
temp_dc.SelectObject(wxNullBitmap);
@endcode
This happens automatically when wxMemoryDC object goes out of scope.
@library{wxcore}
@category{dc}
@see wxBitmap, wxDC
*/
class wxMemoryDC : public wxDC
{
public:
/**
Constructs a new memory device context.
Use the wxDC::Ok() member to test whether the constructor was
successful in creating a usable device context. Don't forget to select
a bitmap into the DC before drawing on it.
*/
wxMemoryDC();
/**
Constructs a new memory device context and calls SelectObject() with
the given bitmap.
Use the wxDC::Ok() member to test whether the constructor was
successful in creating a usable device context.
*/
wxMemoryDC(wxBitmap& bitmap);
/**
Works exactly like SelectObjectAsSource() but this is the function you
should use when you select a bitmap because you want to modify it, e.g.
drawing on this DC.
Using SelectObjectAsSource() when modifying the bitmap may incurr some
problems related to wxBitmap being a reference counted object (see
@ref overview_refcount).
Also, before using the updated bitmap data, make sure to select it out
of context first (for example by selecting wxNullBitmap into the device
context).
@see wxDC::DrawBitmap()
*/
void SelectObject(wxBitmap& bitmap);
/**
Selects the given bitmap into the device context, to use as the memory
bitmap. Selecting the bitmap into a memory DC allows you to draw into
the DC (and therefore the bitmap) and also to use wxDC::Blit() to copy
the bitmap to a window. For this purpose, you may find wxDC::DrawIcon()
easier to use instead.
If the argument is wxNullBitmap (or some other uninitialised wxBitmap)
the current bitmap is selected out of the device context, and the
original bitmap restored, allowing the current bitmap to be destroyed
safely.
*/
void SelectObjectAsSource(const wxBitmap& bitmap);
};

37
interface/wx/dcmirror.h Normal file
View File

@@ -0,0 +1,37 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dcmirror.h
// Purpose: interface of wxMirrorDC
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxMirrorDC
@wxheader{dcmirror.h}
wxMirrorDC is a simple wrapper class which is always associated with a real
wxDC object and either forwards all of its operations to it without changes
(no mirroring takes place) or exchanges @e x and @e y coordinates which
makes it possible to reuse the same code to draw a figure and its mirror --
i.e. reflection related to the diagonal line x == y.
@since 2.5.0
@library{wxcore}
@category{dc}
*/
class wxMirrorDC : public wxDC
{
public:
/**
Creates a (maybe) mirrored DC associated with the real @a dc.
Everything drawn on wxMirrorDC will appear (and maybe mirrored) on
@a dc.
@a mirror specifies if we do mirror (if it is @true) or not (if it is
@false).
*/
wxMirrorDC(wxDC& dc, bool mirror);
};

60
interface/wx/dcprint.h Normal file
View File

@@ -0,0 +1,60 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dcprint.h
// Purpose: interface of wxPrinterDC
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxPrinterDC
@wxheader{dcprint.h}
A printer device context is specific to MSW and Mac, and allows access to
any printer with a Windows or Macintosh driver. See wxDC for further
information on device contexts, and wxDC::GetSize() for advice on achieving
the correct scaling for the page.
@library{wxcore}
@category{printing}
@see @ref overview_printing, wxDC
*/
class wxPrinterDC : public wxDC
{
public:
/**
Constructor. Pass a wxPrintData object with information necessary for
setting up a suitable printer device context. This is the recommended
way to construct a wxPrinterDC. Make sure you specify a reference to a
wxPrintData object, not a pointer - you may not even get a warning if
you pass a pointer instead.
*/
wxPrinterDC(const wxPrintData& printData);
/**
Constructor. With empty strings for the first three arguments, the
default printer dialog is displayed. @a device indicates the type of
printer and @a output is an optional file for printing to. The
@a driver parameter is currently unused. Use the wxDC::Ok() member to
test whether the constructor was successful in creating a usable device
context.
@deprecated This constructor is deprecated and retained only for
backward compatibility.
*/
wxPrinterDC(const wxString& driver, const wxString& device,
const wxString& output, const bool interactive = true,
int orientation = wxPORTRAIT);
/**
Return the rectangle in device coordinates that corresponds to the full
paper area, including the nonprinting regions of the paper. The point
(0,0) in device coordinates is the top left corner of the page
rectangle, which is the printable area on MSW and Mac. The coordinates
of the top left corner of the paper rectangle will therefore have small
negative values, while the bottom right coordinates will be somewhat
larger than the values returned by wxDC::GetSize().
*/
wxRect wxPrinterDC::GetPaperRect();
};

58
interface/wx/dcps.h Normal file
View File

@@ -0,0 +1,58 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dcps.h
// Purpose: interface of wxPostScriptDC
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxPostScriptDC
@wxheader{dcps.h}
This defines the wxWidgets Encapsulated PostScript device context, which
can write PostScript files on any platform. See wxDC for descriptions of
the member functions.
@library{wxbase}
@category{dc}
*/
class wxPostScriptDC : public wxDC
{
public:
/**
Constructs a PostScript printer device context from a wxPrintData
object.
*/
wxPostScriptDC(const wxPrintData& printData);
/**
Constructor. @a output is an optional file for printing to, and if
@a interactive is @true a dialog box will be displayed for adjusting
various parameters. @a parent is the parent of the printer dialog box.
Use the wxDC::Ok() member to test whether the constructor was
successful in creating a usable device context.
See wxPrintData for various functions to set and get PostScript
printing settings.
@deprecated This constructor is deprecated.
*/
wxPostScriptDC(const wxString& output,
bool interactive = true,
wxWindow* parent);
/**
Return resolution used in PostScript output.
@see SetResolution()
*/
static int GetResolution();
/**
Set resolution (in pixels per inch) that will be used in PostScript
output. Default is 720ppi.
*/
static void SetResolution(int ppi);
};

83
interface/wx/dcscreen.h Normal file
View File

@@ -0,0 +1,83 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dcscreen.h
// Purpose: interface of wxScreenDC
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxScreenDC
@wxheader{dcscreen.h}
A wxScreenDC can be used to paint on the screen. This should normally be
constructed as a temporary stack object; don't store a wxScreenDC object.
@library{wxcore}
@category{dc}
@see wxDC, wxMemoryDC, wxPaintDC, wxClientDC, wxWindowDC
*/
class wxScreenDC : public wxDC
{
public:
/**
Constructor.
*/
wxScreenDC();
/**
Use this in conjunction with StartDrawingOnTop().
This function destroys the temporary window created to implement on-top
drawing (X only).
*/
bool EndDrawingOnTop();
/**
Use this in conjunction with EndDrawingOnTop() to ensure that drawing
to the screen occurs on top of existing windows. Without this, some
window systems (such as X) only allow drawing to take place underneath
other windows.
This version of StartDrawingOnTop() is used to specify that the area
that will be drawn on coincides with the given window. It is
recommended that an area of the screen is specified with
StartDrawingOnTop(wxRect*) because with large regions, flickering
effects are noticeable when destroying the temporary transparent window
used to implement this feature.
You might use this function when implementing a drag feature, for
example as in the wxSplitterWindow implementation.
@remarks This function is probably obsolete since the X implementations
allow drawing directly on the screen now. However, the fact
that this function allows the screen to be refreshed
afterwards, may be useful to some applications.
*/
bool StartDrawingOnTop(wxWindow* window);
/**
Use this in conjunction with EndDrawingOnTop() to ensure that drawing
to the screen occurs on top of existing windows. Without this, some
window systems (such as X) only allow drawing to take place underneath
other windows.
This version of StartDrawingOnTop() is used to specify an area of the
screen which is to be drawn on. If @NULL is passed, the whole screen is
available. It is recommended that an area of the screen is specified
with this function rather than with StartDrawingOnTop(wxWindow*),
because with large regions, flickering effects are noticeable when
destroying the temporary transparent window used to implement this
feature.
You might use this function when implementing a drag feature, for
example as in the wxSplitterWindow implementation.
@remarks This function is probably obsolete since the X implementations
allow drawing directly on the screen now. However, the fact
that this function allows the screen to be refreshed
afterwards, may be useful to some applications.
*/
bool StartDrawingOnTop(wxRect* rect = NULL);
};

660
interface/wx/dcsvg.h Normal file
View File

@@ -0,0 +1,660 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dcsvg.h
// Purpose: interface of wxSVGFileDC
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxSVGFileDC
@wxheader{dcsvg.h}
A wxSVGFileDC is a device context onto which graphics and text can be
drawn, and the output produced as a vector file, in SVG format (see the W3C
SVG Specifications <http://www.w3.org/TR/2001/REC-SVG-20010904/>). This
format can be read by a range of programs, including a Netscape plugin
(Adobe), full details are given in the SVG Implementation and Resource
Directory <http://www.svgi.org/>. Vector formats may often be smaller than
raster formats.
The intention behind wxSVGFileDC is that it can be used to produce a file
corresponding to the screen display context, wxSVGFileDC, by passing the
wxSVGFileDC as a parameter instead of a wxSVGFileDC. Thus the wxSVGFileDC
is a write-only class.
As the wxSVGFileDC is a vector format, raster operations like GetPixel()
are unlikely to be supported. However, the SVG specification allows for PNG
format raster files to be embedded in the SVG, and so bitmaps, icons and
blit operations in wxSVGFileDC are supported.
A more substantial SVG library (for reading and writing) is available at
the wxArt2D website <http://wxart2d.sourceforge.net/>.
@library{wxcore}
@category{dc}
*/
class wxSVGFileDC : public wxDC
{
public:
/**
Initializes a wxSVGFileDC with the given @a f filename with a default
size (340x240) at 72.0 dots per inch (a frequent screen resolution).
*/
wxSVGFileDC(wxString f);
/**
Initializes a wxSVGFileDC with the given @a f filename with the given
@a Width and @a Height at 72.0 dots per inch.
*/
wxSVGFileDC(wxString f, int Width, int Height);
/**
Initializes a wxSVGFileDC with the given @a f filename with the given
@a Width and @a Height at @a dpi resolution.
*/
wxSVGFileDC(wxString f, int Width, int Height, float dpi);
/**
Destructor.
*/
~wxSVGFileDC();
/**
Copies from a source DC to this DC, specifying the destination
coordinates, size of area to copy, source DC, source coordinates,
logical function, whether to use a bitmap mask, and mask source
position.
@see wxDC::Blit()
*/
bool Blit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
wxSVGFileDC* source, wxCoord xsrc, wxCoord ysrc,
int logicalFunc = wxCOPY, bool useMask = FALSE,
wxCoord xsrcMask = -1, wxCoord ysrcMask = -1);
/**
Adds the specified point to the bounding box which can be retrieved
with wxDC::MinX(), wxDC::MaxX() and wxDC::MinY(), wxDC::MaxY()
functions.
*/
void CalcBoundingBox(wxCoord x, wxCoord y);
/**
This makes no sense in wxSVGFileDC and does nothing.
*/
void Clear();
/**
Not Implemented.
*/
void CrossHair(wxCoord x, wxCoord y);
/**
Not Implemented.
*/
void DestroyClippingRegion();
/**
Convert device X coordinate to logical coordinate, using the current
mapping mode.
*/
wxCoord DeviceToLogicalX(wxCoord x);
/**
Convert device X coordinate to relative logical coordinate, using the
current mapping mode but ignoring the x axis orientation. Use this
function for converting a width, for example.
*/
wxCoord DeviceToLogicalXRel(wxCoord x);
/**
Converts device Y coordinate to logical coordinate, using the current
mapping mode.
*/
wxCoord DeviceToLogicalY(wxCoord y);
/**
Convert device Y coordinate to relative logical coordinate, using the
current mapping mode but ignoring the y axis orientation. Use this
function for converting a height, for example.
*/
wxCoord DeviceToLogicalYRel(wxCoord y);
/**
Draws an arc of a circle, centred on (@a xc, @a yc), with starting
point (@a x1, @a y1) and ending at (@a x2, @a y2). The current pen is
used for the outline and the current brush for filling the shape.
The arc is drawn in a counter-clockwise direction from the start point
to the end point.
*/
void DrawArc(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2,
wxCoord xc, wxCoord yc);
/**
Draw a bitmap on the device context at the specified point. If
@a transparent is @true and the bitmap has a transparency mask, the
bitmap will be drawn transparently.
When drawing a mono-bitmap, the current text foreground colour will be
used to draw the foreground of the bitmap (all bits set to 1), and the
current text background colour to draw the background (all bits set to
0).
@see wxDC::SetTextForeground(), wxDC::SetTextBackground(), wxMemoryDC
*/
void DrawBitmap(const wxBitmap& bitmap, wxCoord x, wxCoord y,
bool transparent);
//@{
/**
Draws a check mark inside the given rectangle.
*/
void DrawCheckMark(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
void DrawCheckMark(const wxRect& rect);
//@}
//@{
/**
Draws a circle with the given centre and radius.
@see wxDC::DrawEllipse()
*/
void DrawCircle(wxCoord x, wxCoord y, wxCoord radius);
void DrawCircle(const wxPoint& pt, wxCoord radius);
//@}
//@{
/**
Draws an ellipse contained in the rectangle specified either with the
given top left corner and the given size or directly. The current pen
is used for the outline and the current brush for filling the shape.
@see wxDC::DrawCircle()
*/
void DrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
void DrawEllipse(const wxPoint& pt, const wxSize& size);
void DrawEllipse(const wxRect& rect);
//@}
/**
Draws an arc of an ellipse. The current pen is used for drawing the arc
and the current brush is used for drawing the pie.
@a x and @a y specify the x and y coordinates of the upper-left corner
of the rectangle that contains the ellipse.
@a width and @a height specify the width and height of the rectangle
that contains the ellipse.
@a start and @a end specify the start and end of the arc relative to
the three-o'clock position from the center of the rectangle. Angles are
specified in degrees (360 is a complete circle). Positive values mean
counter-clockwise motion. If @a start is equal to @a end, a complete
ellipse will be drawn.
*/
void DrawEllipticArc(wxCoord x, wxCoord y, wxCoord width, wxCoord height,
double start, double end);
/**
Draw an icon on the display (does nothing if the device context is
PostScript). This can be the simplest way of drawing bitmaps on a
window.
*/
void DrawIcon(const wxIcon& icon, wxCoord x, wxCoord y);
/**
Draws a line from the first point to the second. The current pen is
used for drawing the line.
*/
void DrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
//@{
/**
Draws lines using an array of @a points of size @a n, or list of
pointers to points, adding the optional offset coordinate. The current
pen is used for drawing the lines. The programmer is responsible for
deleting the list of points.
*/
void DrawLines(int n, wxPoint points[], wxCoord xoffset = 0,
wxCoord yoffset = 0);
void DrawLines(wxList* points, wxCoord xoffset = 0,
wxCoord yoffset = 0);
//@}
/**
Draws a point using the current pen.
*/
void DrawPoint(wxCoord x, wxCoord y);
//@{
/**
Draws a filled polygon using an array of @a points of size @a n,
or list of pointers to points, adding the optional offset coordinate.
wxWidgets automatically closes the first and last points.
The last argument specifies the fill rule: @c wxODDEVEN_RULE (the
default) or @c wxWINDING_RULE.
The current pen is used for drawing the outline, and the current brush
for filling the shape. Using a transparent brush suppresses filling.
The programmer is responsible for deleting the list of points.
*/
void DrawPolygon(int n, wxPoint points[], wxCoord xoffset = 0,
wxCoord yoffset = 0, int fill_style = wxODDEVEN_RULE);
void DrawPolygon(wxList* points, wxCoord xoffset = 0,
wxCoord yoffset = 0, int fill_style = wxODDEVEN_RULE);
//@}
/**
Draws a rectangle with the given top left corner, and with the given
size. The current pen is used for the outline and the current brush
for filling the shape.
*/
void DrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
/**
Draws the text rotated by @a angle degrees.
The wxMSW wxDC and wxSVGFileDC rotate the text around slightly
different points, depending on the size of the font.
*/
void DrawRotatedText(const wxString& text, wxCoord x, wxCoord y,
double angle);
/**
Draws a rectangle with the given top left corner, and with the given
size. The corners are quarter-circles using the given radius. The
current pen is used for the outline and the current brush for filling
the shape.
If @a radius is positive, the value is assumed to be the radius of the
rounded corner. If @a radius is negative, the absolute value is assumed
to be the @e proportion of the smallest dimension of the rectangle.
This means that the corner can be a sensible size relative to the size
of the rectangle, and also avoids the strange effects X produces when
the corners are too big for the rectangle.
*/
void DrawRoundedRectangle(wxCoord x, wxCoord y, wxCoord width,
wxCoord height, double radius = 20);
/**
Draws a spline between all given control points, using the current pen.
The programmer is responsible for deleting the list of points. The
spline is drawn using a series of lines, using an algorithm taken from
the X drawing program "XFIG".
*/
void DrawSpline(wxList* points);
/**
@param string
The text string to measure.
Draws a three-point spline using the current pen.
*/
void DrawSpline(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2,
wxCoord x3, wxCoord y3);
/**
Draws a text string at the specified point, using the current text
font, and the current text foreground and background colours.
The coordinates refer to the top-left corner of the rectangle bounding
the string. See wxDC::GetTextExtent() for how to get the dimensions of
a text string, which can be used to position the text more precisely.
*/
void DrawText(const wxString& text, wxCoord x, wxCoord y);
/**
Does nothing.
*/
void EndDoc();
/**
Does nothing.
*/
void EndDrawing();
/**
Does nothing.
*/
void EndPage();
/**
Not implemented.
*/
void FloodFill(wxCoord x, wxCoord y, const wxColour& colour,
int style = wxFLOOD_SURFACE);
//@{
/**
Gets the brush used for painting the background.
@see SetBackground()
*/
wxBrush GetBackground() const;
const wxBrush GetBackground() const;
//@}
/**
Returns the current background mode: @c wxSOLID or @c wxTRANSPARENT.
@see SetBackgroundMode()
*/
int GetBackgroundMode() const;
//@{
/**
Gets the current brush.
@see SetBrush()
*/
wxBrush GetBrush() const;
const wxBrush GetBrush() const;
//@}
/**
Gets the character height of the currently set font.
*/
wxCoord GetCharHeight();
/**
Gets the average character width of the currently set font.
*/
wxCoord GetCharWidth();
/**
Not implemented.
*/
void GetClippingBox(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
//@{
/**
Gets the current font.
@see SetFont()
*/
wxFont GetFont() const;
const wxFont GetFont() const;
//@}
/**
Gets the current logical function.
@see SetLogicalFunction()
*/
int GetLogicalFunction();
/**
Gets the mapping mode for the device context.
@see SetMapMode()
*/
int GetMapMode();
//@{
/**
Gets the current pen.
@see SetPen()
*/
wxPen GetPen() const;
const wxPen GetPen() const;
//@}
/**
Not implemented.
*/
bool GetPixel(wxCoord x, wxCoord y, wxColour* colour);
/**
For a Windows printer device context, this gets the horizontal and
vertical resolution.
*/
void GetSize(wxCoord* width, wxCoord* height);
//@{
/**
Gets the current text background colour.
@see SetTextBackground()
*/
wxColour GetTextBackground() const;
const wxColour GetTextBackground() const;
//@}
/**
Gets the dimensions of the string using the currently selected font.
@param string
The text string to measure.
@param w
This value will be set to the width after this call.
@param h
This value will be set to the height after this call.
@param descent
The dimension from the baseline of the font to the bottom of the
descender.
@param externalLeading
Any extra vertical space added to the font by the font designer
(usually is zero).
The optional parameter @a font specifies an alternative to the
currently selected font: but note that this does not yet work under
Windows, so you need to set a font for the device context first.
@see wxFont, SetFont()
*/
void GetTextExtent(const wxString& string, wxCoord* w, wxCoord* h,
wxCoord* descent = NULL,
wxCoord* externalLeading = NULL,
wxFont* font = NULL);
//@{
/**
Gets the current text foreground colour.
@see SetTextForeground()
*/
wxColour GetTextForeground() const;
const wxColour GetTextForeground() const;
//@}
/**
Gets the current user scale factor.
@see SetUserScale()
*/
void GetUserScale(double x, double y);
/**
Converts logical X coordinate to device coordinate, using the current
mapping mode.
*/
wxCoord LogicalToDeviceX(wxCoord x);
/**
Converts logical X coordinate to relative device coordinate, using the
current mapping mode but ignoring the x axis orientation. Use this for
converting a width, for example.
*/
wxCoord LogicalToDeviceXRel(wxCoord x);
/**
Converts logical Y coordinate to device coordinate, using the current
mapping mode.
*/
wxCoord LogicalToDeviceY(wxCoord y);
/**
Converts logical Y coordinate to relative device coordinate, using the
current mapping mode but ignoring the y axis orientation. Use this for
converting a height, for example.
*/
wxCoord LogicalToDeviceYRel(wxCoord y);
/**
Gets the maximum horizontal extent used in drawing commands so far.
*/
wxCoord MaxX();
/**
Gets the maximum vertical extent used in drawing commands so far.
*/
wxCoord MaxY();
/**
Gets the minimum horizontal extent used in drawing commands so far.
*/
wxCoord MinX();
/**
Gets the minimum vertical extent used in drawing commands so far.
*/
wxCoord MinY();
/**
Returns @true if the DC is ok to use. @false values arise from being
unable to write the file.
*/
bool Ok();
/**
Resets the bounding box. After a call to this function, the bounding
box doesn't contain anything.
@see CalcBoundingBox()
*/
void ResetBoundingBox();
/**
Sets the x and y axis orientation (i.e., the direction from lowest to
highest values on the axis). The default orientation is the natural
orientation, e.g. x axis from left to right and y axis from bottom up.
@param xLeftRight
@true to set the x axis orientation to the natural left to right
orientation, @false to invert it.
@param yBottomUp
@true to set the y axis orientation to the natural bottom up
orientation, @false to invert it.
*/
void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
/**
Sets the current background brush for the DC.
*/
void SetBackground(const wxBrush& brush);
/**
@a mode may be one of wxSOLID and wxTRANSPARENT. This setting determines
whether text will be drawn with a background colour or not.
*/
void SetBackgroundMode(int mode);
/**
Sets the current brush for the DC. If the argument is wxNullBrush, the
current brush is selected out of the device context, and the original
brush restored, allowing the current brush to be destroyed safely.
@see wxBrush, wxMemoryDC (for the interpretation of colours
when drawing into a monochrome bitmap).
*/
void SetBrush(const wxBrush& brush);
//@{
/**
Not implemented.
*/
void SetClippingRegion(wxCoord x, wxCoord y, wxCoord width,
wxCoord height);
void SetClippingRegion(const wxPoint& pt, const wxSize& sz);
void SetClippingRegion(const wxRect& rect);
void SetClippingRegion(const wxRegion& region);
//@}
/**
Sets the device origin (i.e., the origin in pixels after scaling has
been applied). This function may be useful in Windows printing
operations for placing a graphic on a page.
*/
void SetDeviceOrigin(wxCoord x, wxCoord y);
/**
Sets the current font for the DC. It must be a valid font, in
particular you should not pass @c wxNullFont to this method.
@see wxFont
*/
void SetFont(const wxFont& font);
/**
Does the same as wxDC::SetLogicalFunction(), except that only wxCOPY is
avalaible. Trying to set one of the othe values will fail.
*/
void SetLogicalFunction(int function);
/**
The mapping mode of the device context defines the unit of measurement
used to convert logical units to device units. Note that in X, text
drawing isn't handled consistently with the mapping mode; a font is
always specified in point size. However, setting the user scale scales
the text appropriately. In Windows, scalable TrueType fonts are always
used; in X, results depend on availability of fonts, but usually a
reasonable match is found.
Note that the coordinate origin should ideally be selectable, but for
now is always at the top left of the screen/printer.
Drawing to a Windows printer device context under UNIX uses the current
mapping mode, but mapping mode is currently ignored for PostScript
output.
The mapping mode can be one of the following:
- wxMM_TWIPS - Each logical unit is 1/20 of a point, or 1/1440 of an
inch.
- wxMM_POINTS - Each logical unit is a point, or 1/72 of an inch.
- wxMM_METRIC - Each logical unit is 1 mm.
- wxMM_LOMETRIC - Each logical unit is 1/10 of a mm.
- wxMM_TEXT - Each logical unit is 1 pixel.
*/
void SetMapMode(int mode);
/**
Not implemented.
*/
void SetPalette(const wxPalette& palette);
/**
Sets the current pen for the DC. If the argument is wxNullPen, the
current pen is selected out of the device context, and the original pen
restored.
@see wxMemoryDC (for the interpretation of colours when drawing into a
monochrome bitmap)
*/
void SetPen(const wxPen& pen);
/**
Sets the current text background colour for the DC.
*/
void SetTextBackground(const wxColour& colour);
/**
Sets the current text foreground colour for the DC.
@see wxMemoryDC (for the interpretation of colours when drawing into a
monochrome bitmap)
*/
void SetTextForeground(const wxColour& colour);
/**
Sets the user scaling factor, useful for applications which require
"zooming".
*/
void SetUserScale(double xScale, double yScale);
/**
Does nothing.
*/
bool StartDoc(const wxString& message);
};

352
interface/wx/dde.h Normal file
View File

@@ -0,0 +1,352 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dde.h
// Purpose: interface of wxDDEConnection
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxDDEConnection
@wxheader{dde.h}
A wxDDEConnection object represents the connection between a client and a
server. It can be created by making a connection using a wxDDEClient
object, or by the acceptance of a connection by a wxDDEServer object. The
bulk of a DDE (Dynamic Data Exchange) conversation is controlled by calling
members in a wxDDEConnection object or by overriding its members.
An application should normally derive a new connection class from
wxDDEConnection, in order to override the communication event handlers to
do something interesting.
This DDE-based implementation is available on Windows only, but a
platform-independent, socket-based version of this API is available using
wxTCPConnection.
@library{wxbase}
@category{ipc}
@see wxConnectionBase, wxDDEClient, wxDDEServer, @ref overview_ipc
*/
class wxDDEConnection : public wxConnectionBase
{
public:
/**
Constructs a connection object. If no user-defined connection object is
to be derived from wxDDEConnection, then the constructor should not be
called directly, since the default connection object will be provided
on requesting (or accepting) a connection. However, if the user defines
his or her own derived connection object, the
wxDDEServer::OnAcceptConnection() and/or
wxDDEClient::OnMakeConnection() members should be replaced by functions
which construct the new connection object.
A default buffer will be associated with this connection.
*/
wxDDEConnection();
/**
Constructs a connection object. If no user-defined connection object is
to be derived from wxDDEConnection, then the constructor should not be
called directly, since the default connection object will be provided
on requesting (or accepting) a connection. However, if the user defines
his or her own derived connection object, the
wxDDEServer::OnAcceptConnection() and/or
wxDDEClient::OnMakeConnection() members should be replaced by functions
which construct the new connection object.
@param buffer
Buffer for this connection object to use in transactions.
@param size
Size of the buffer given.
*/
wxDDEConnection(void* buffer, size_t size);
//@{
/**
Called by the server application to advise the client of a change in
the data associated with the given item. Causes the client connection's
OnAdvise() member to be called.
@return @true if successful.
*/
bool Advise(const wxString& item, const void* data, size_t size,
wxIPCFormat format = wxIPC_PRIVATE);
bool Advise(const wxString& item, const char* data);
bool Advise(const wxString& item, const wchar_t* data);
bool Advise(const wxString& item, const wxString data);
//@}
/**
Called by the client or server application to disconnect from the other
program; it causes the OnDisconnect() message to be sent to the
corresponding connection object in the other program. The default
behaviour of OnDisconnect() is to delete the connection, but the
calling application must explicitly delete its side of the connection
having called Disconnect().
@return @true if successful.
*/
bool Disconnect();
//@{
/**
Called by the client application to execute a command on the server.
Can also be used to transfer arbitrary data to the server (similar to
Poke() in that respect). Causes the server connection's OnExecute()
member to be called.
@return @true if successful.
*/
bool Execute(const void* data, size_t size,
wxIPCFormat format = wxIPC_PRIVATE);
bool Execute(const char* data);
bool Execute(const wchar_t* data);
bool Execute(const wxString data);
//@}
/**
Message sent to the client application when the server notifies it of a
change in the data associated with the given item.
*/
virtual bool OnAdvise(const wxString& topic, const wxString& item,
const void* data, size_t size, wxIPCFormat format);
/**
Message sent to the client or server application when the other
application notifies it to delete the connection. Default behaviour is
to delete the connection object.
*/
virtual bool OnDisconnect();
/**
Message sent to the server application when the client notifies it to
execute the given data. Note that there is no item associated with
this message.
*/
virtual bool OnExecute(const wxString& topic, const void* data,
size_t size, wxIPCFormat format);
/**
Message sent to the server application when the client notifies it to
accept the given data.
*/
virtual bool OnPoke(const wxString& topic, const wxString& item,
const void* data, size_t size, wxIPCFormat format);
/**
Message sent to the server application when the client calls Request().
The server should respond by returning a character string from
OnRequest(), or @NULL to indicate no data.
*/
virtual const void* OnRequest(const wxString& topic,
const wxString& item, size_t* size,
wxIPCFormat format);
/**
Message sent to the server application by the client, when the client
wishes to start an "advise loop" for the given topic and item. The
server can refuse to participate by returning @false.
*/
virtual bool OnStartAdvise(const wxString& topic, const wxString& item);
/**
Message sent to the server application by the client, when the client
wishes to stop an "advise loop" for the given topic and item. The
server can refuse to stop the advise loop by returning @false, although
this doesn't have much meaning in practice.
*/
virtual bool OnStopAdvise(const wxString& topic, const wxString& item);
//@{
/**
Called by the client application to poke data into the server. Can be
used to transfer arbitrary data to the server. Causes the server
connection's OnPoke() member to be called.
@return @true if successful.
*/
bool Poke(const wxString& item, const void* data, size_t size,
wxIPCFormat format = wxIPC_PRIVATE);
bool Poke(const wxString& item, const char* data);
bool Poke(const wxString& item, const wchar_t* data);
bool Poke(const wxString& item, const wxString data);
//@}
/**
Called by the client application to request data from the server.
Causes the server connection's OnRequest() member to be called.
@return A character string (actually a pointer to the connection's
buffer) if successful, @NULL otherwise.
*/
const void* Request(const wxString& item, size_t* size,
wxIPCFormat format = wxIPC_TEXT);
/**
Called by the client application to ask if an advise loop can be
started with the server. Causes the server connection's OnStartAdvise()
member to be called.
@return @true if the server okays it, @false otherwise.
*/
bool StartAdvise(const wxString& item);
/**
Called by the client application to ask if an advise loop can be
stopped. Causes the server connection's OnStopAdvise() member to be
called.
@return @true if the server okays it, @false otherwise.
*/
bool StopAdvise(const wxString& item);
};
/**
@class wxDDEClient
@wxheader{dde.h}
A wxDDEClient object represents the client part of a client-server DDE
(Dynamic Data Exchange) conversation.
To create a client which can communicate with a suitable server, you need
to derive a class from wxDDEConnection and another from wxDDEClient. The
custom wxDDEConnection class will intercept communications in a
"conversation" with a server, and the custom wxDDEServer is required so
that a user-overridden OnMakeConnection() member can return a
wxDDEConnection of the required class, when a connection is made.
This DDE-based implementation is available on Windows only, but a
platform-independent, socket-based version of this API is available using
wxTCPClient.
@library{wxbase}
@category{ipc}
@see wxDDEServer, wxDDEConnection, @ref overview_ipc
*/
class wxDDEClient : public wxObject
{
public:
/**
Constructs a client object.
*/
wxDDEClient();
/**
Tries to make a connection with a server specified by the host (machine
name under UNIX, ignored under Windows), service name (must contain an
integer port number under UNIX), and topic string. If the server allows
a connection, a wxDDEConnection object will be returned.
The type of wxDDEConnection returned can be altered by overriding the
OnMakeConnection() member to return your own derived connection object.
*/
wxConnectionBase* MakeConnection(const wxString& host,
const wxString& service,
const wxString& topic);
/**
The type of wxDDEConnection returned from a MakeConnection() call can
be altered by deriving the OnMakeConnection() member to return your own
derived connection object. By default, a wxDDEConnection object is
returned.
The advantage of deriving your own connection class is that it will
enable you to intercept messages initiated by the server, such as
wxDDEConnection::OnAdvise(). You may also want to store
application-specific data in instances of the new class.
*/
wxConnectionBase* OnMakeConnection();
/**
Returns @true if this is a valid host name, @false otherwise. This
always returns @true under MS Windows.
*/
bool ValidHost(const wxString& host);
};
/**
@class wxDDEServer
@wxheader{dde.h}
A wxDDEServer object represents the server part of a client-server DDE
(Dynamic Data Exchange) conversation.
This DDE-based implementation is available on Windows only, but a
platform-independent, socket-based version of this API is available using
wxTCPServer.
@library{wxbase}
@category{ipc}
@see wxDDEClient, wxDDEConnection, @ref overview_ipc
*/
class wxDDEServer
{
public:
/**
Constructs a server object.
*/
wxDDEServer();
/**
Registers the server using the given service name. Under UNIX, the
string must contain an integer id which is used as an Internet port
number. @false is returned if the call failed (for example, if the port
number is already in use).
*/
bool Create(const wxString& service);
/**
When a client calls wxDDEClient::MakeConnection(), the server receives
the message and this member is called. The application should derive a
member to intercept this message and return a connection object of
either the standard wxDDEConnection type, or of a user-derived type.
If the @a topic is "STDIO", the application may wish to refuse the
connection. Under UNIX, when a server is created the
OnAcceptConnection() message is always sent for standard input and
output, but in the context of DDE messages it doesn't make a lot of
sense.
*/
virtual wxConnectionBase* OnAcceptConnection(const wxString& topic);
};
// ============================================================================
// Global functions/macros
// ============================================================================
/** @ingroup group_funcmacro_misc */
//@{
/**
Called when wxWidgets exits, to clean up the DDE system. This no longer
needs to be called by the application.
@see wxDDEInitialize()
@header{wx/dde.h}
*/
void wxDDECleanUp();
/**
Initializes the DDE system. May be called multiple times without harm.
This no longer needs to be called by the application: it will be called by
wxWidgets if necessary.
@see wxDDEServer, wxDDEClient, wxDDEConnection, wxDDECleanUp()
@header{wx/dde.h}
*/
void wxDDEInitialize();
//@}

220
interface/wx/debug.h Normal file
View File

@@ -0,0 +1,220 @@
/////////////////////////////////////////////////////////////////////////////
// Name: debug.h
// Purpose: interface of global functions
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/** @ingroup group_funcmacro_debug */
//@{
/**
Assert macro. An error message will be generated if the condition is @false in
debug mode, but nothing will be done in the release build.
Please note that the condition in wxASSERT() should have no side effects
because it will not be executed in release mode at all.
@see wxASSERT_MSG(), wxCOMPILE_TIME_ASSERT()
@header{wx/debug.h}
*/
#define wxASSERT( condition )
/**
This macro results in a
@ref overview_wxcompiletimeassert "compile time assertion failure" if the
size of the given @c type is less than @c size bits.
You may use it like this, for example:
@code
// we rely on the int being able to hold values up to 2^32
wxASSERT_MIN_BITSIZE(int, 32);
// can't work with the platforms using UTF-8 for wchar_t
wxASSERT_MIN_BITSIZE(wchar_t, 16);
@endcode
@header{wx/debug.h}
*/
#define wxASSERT_MIN_BITSIZE( type, size )
/**
Assert macro with message. An error message will be generated if the
condition is @false.
@see wxASSERT(), wxCOMPILE_TIME_ASSERT()
@header{wx/debug.h}
*/
#define wxASSERT_MSG( condition, message )
/**
Checks that the condition is @true, returns with the given return value if
not (stops execution in debug mode). This check is done even in release
mode.
@header{wx/debug.h}
*/
#define wxCHECK( condition, retValue )
/**
Checks that the condition is @true, returns with the given return value if
not (stops execution in debug mode). This check is done even in release
mode.
This macro may be only used in non-void functions, see also wxCHECK_RET().
@header{wx/debug.h}
*/
#define wxCHECK_MSG( condition, retValue, message )
/**
Checks that the condition is @true, and returns if not (stops execution
with the given error message in debug mode). This check is done even in
release mode.
This macro should be used in void functions instead of wxCHECK_MSG().
@header{wx/debug.h}
*/
#define wxCHECK_RET( condition, message )
/**
Checks that the condition is @true, and if not, it will wxFAIL() and
execute the given @c operation if it is not. This is a generalisation of
wxCHECK() and may be used when something else than just returning from the
function must be done when the @c condition is @false. This check is done
even in release mode.
@header{wx/debug.h}
*/
#define wxCHECK2(condition, operation)
/**
This is the same as wxCHECK2(), but wxFAIL_MSG() with the specified
@c message is called instead of wxFAIL() if the @c condition is @false.
@header{wx/debug.h}
*/
#define wxCHECK2_MSG( condition, operation, message )
/**
Using wxCOMPILE_TIME_ASSERT() results in a compilation error if the
specified @c condition is @false. The compiler error message should include
the @c message identifier - please note that it must be a valid C++
identifier and not a string unlike in the other cases.
This macro is mostly useful for testing the expressions involving the
@c sizeof operator as they can't be tested by the preprocessor but it is
sometimes desirable to test them at the compile time.
Note that this macro internally declares a struct whose name it tries to
make unique by using the @c __LINE__ in it but it may still not work if you
use it on the same line in two different source files. In this case you may
either change the line in which either of them appears on or use the
wxCOMPILE_TIME_ASSERT2() macro.
Also note that Microsoft Visual C++ has a bug which results in compiler
errors if you use this macro with 'Program Database For Edit And Continue'
(@c /ZI) option, so you shouldn't use it ('Program Database' (@c /Zi) is ok
though) for the code making use of this macro.
@see wxASSERT_MSG(), wxASSERT_MIN_BITSIZE()
@header{wx/debug.h}
*/
#define wxCOMPILE_TIME_ASSERT( condition, message )
/**
This macro is identical to wxCOMPILE_TIME_ASSERT() except that it allows
you to specify a unique @c name for the struct internally defined by this
macro to avoid getting the compilation errors described for
wxCOMPILE_TIME_ASSERT().
@header{wx/debug.h}
*/
#define wxCOMPILE_TIME_ASSERT2(condition, message, name)
/**
Will always generate an assert error if this code is reached (in debug
mode).
@see wxFAIL_MSG()
@header{wx/debug.h}
*/
#define wxFAIL()
/**
Will always generate an assert error with specified message if this code is
reached (in debug mode).
This macro is useful for marking unreachable" code areas, for example it
may be used in the "default:" branch of a switch statement if all possible
cases are processed above.
@see wxFAIL()
@header{wx/debug.h}
*/
#define wxFAIL_MSG( message )
/**
Returns @true if the program is running under debugger, @false otherwise.
Please note that this function is currently only implemented for Win32 and
Mac builds using CodeWarrior and always returns @false elsewhere.
@header{wx/debug.h}
*/
bool wxIsDebuggerRunning();
/**
This function is called whenever one of debugging macros fails (i.e.
condition is @false in an assertion). It is only defined in the debug mode,
in release builds the wxCHECK() failures don't result in anything.
To override the default behaviour in the debug builds which is to show the
user a dialog asking whether he wants to abort the program, continue or
continue ignoring any subsequent assert failures, you may override
wxApp::OnAssertFailure() which is called by this function if the global
application object exists.
@header{wx/debug.h}
*/
void wxOnAssert( const char* fileName,
int lineNumber,
const char* function,
const char* condition,
const char* message = NULL );
/**
In debug mode (when @c __WXDEBUG__ is defined) this function generates a
debugger exception meaning that the control is passed to the debugger if
one is attached to the process. Otherwise the program just terminates
abnormally. In release mode this function does nothing.
@header{wx/debug.h}
*/
void wxTrap();
//@}
/** @ingroup group_funcmacro_misc */
//@{
/**
This macro expands to the name of the current function if the compiler
supports any of @c __FUNCTION__, @c __func__ or equivalent variables or
macros or to @NULL if none of them is available.
@header{wx/debug.h}
*/
#define __WXFUNCTION__
//@}

351
interface/wx/debugrpt.h Normal file
View File

@@ -0,0 +1,351 @@
/////////////////////////////////////////////////////////////////////////////
// Name: debugrpt.h
// Purpose: interface of wxDebugReport*
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxDebugReportPreview
@wxheader{debugrpt.h}
This class presents the debug report to the user and allows him to veto
report entirely or remove some parts of it. Although not mandatory, using
this class is strongly recommended as data included in the debug report
might contain sensitive private information and the user should be notified
about it as well as having a possibility to examine the data which had been
gathered to check whether this is effectively the case and discard the
debug report if it is.
wxDebugReportPreview is an abstract base class, currently the only concrete
class deriving from it is wxDebugReportPreviewStd.
@library{wxqa}
@category{debugging}
*/
class wxDebugReportPreview
{
public:
/**
Default constructor.
*/
wxDebugReportPreview();
/**
Destructor is trivial as well but should be virtual for a base class.
*/
virtual ~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;
};
/**
@class wxDebugReportCompress
@wxheader{debugrpt.h}
wxDebugReportCompress is a wxDebugReport which compresses all the files in
this debug report into a single ZIP file in its wxDebugReport::Process()
function.
@library{wxqa}
@category{debugging}
*/
class wxDebugReportCompress : public wxDebugReport
{
public:
/**
Default constructor does nothing special.
*/
wxDebugReportCompress();
/**
Returns the full path of the compressed file (empty if creation
failed).
*/
const wxString GetCompressedFileName() const;
};
/**
@class wxDebugReport
@wxheader{debugrpt.h}
wxDebugReport is used to generate a debug report, containing information
about the program current state. It is usually used from
wxApp::OnFatalException() as shown in the @ref page_samples_debugrpt.
A wxDebugReport object contains one or more files. A few of them can be
created by the class itself but more can be created from the outside and
then added to the report. Also note that several virtual functions may be
overridden to further customize the class behaviour.
Once a report is fully assembled, it can simply be left in the temporary
directory so that the user can email it to the developers (in which case
you should still use wxDebugReportCompress to compress it in a single file)
or uploaded to a Web server using wxDebugReportUpload (setting up the Web
server to accept uploads is your responsibility, of course). Other
handlers, for example for automatically emailing the report, can be defined
as well but are not currently included in wxWidgets.
A typical usage example:
@code
wxDebugReport report;
wxDebugReportPreviewStd preview;
report.AddCurrentContext(); // could also use AddAll()
report.AddCurrentDump(); // to do both at once
if ( preview.Show(report) )
report.Process();
@endcode
@library{wxqa}
@category{debugging}
*/
class wxDebugReport
{
public:
/**
This enum is used for functions that report either the current state or
the state during the last (fatal) exception.
*/
enum Context {
Context_Current,
Context_Exception
};
/**
The constructor creates a temporary directory where the files that will
be included in the report are created. Use IsOk() to check for errors.
*/
wxDebugReport();
/**
The destructor normally destroys the temporary directory created in the
constructor with all the files it contains. Call Reset() to prevent
this from happening.
*/
~wxDebugReport();
/**
Adds all available information to the report. Currently this includes a
text (XML) file describing the process context and, under Win32, a
minidump file.
*/
void AddAll(Context context = Context_Exception);
/**
Add an XML file containing the current or exception context and the
stack trace.
*/
bool AddContext(Context ctx);
/**
The same as calling AddContext(Context_Current).
*/
bool AddCurrentContext();
/**
The same as calling AddDump(Context_Current).
*/
bool AddCurrentDump();
/**
Adds the minidump file to the debug report.
Minidumps are only available under recent Win32 versions
(@c dbghlp32.dll can be installed under older systems to make minidumps
available).
*/
bool AddDump(Context ctx);
/**
The same as calling AddContext(Context_Exception).
*/
bool AddExceptionContext();
/**
The same as calling AddDump(Context_Exception).
*/
bool AddExceptionDump();
/**
Add another file to the report. If @a filename is an absolute path, it
is copied to a file in the debug report directory with the same name.
Otherwise the file should already exist in this directory
@a description only exists to be displayed to the user in the report
summary shown by wxDebugReportPreview.
@see GetDirectory(), AddText()
*/
void AddFile(const wxString& filename, const wxString& description);
/**
This is a convenient wrapper around AddFile(). It creates the file with
the given @a name and writes @a text to it, then adds the file to the
report. The @a filename shouldn't contain the path.
@return @true if file could be added successfully, @false if an IO
error occurred.
*/
bool AddText(const wxString& filename, const wxString& text,
const wxString& description);
/**
This function may be overridden to add arbitrary custom context to the
XML context file created by AddContext(). By default, it does nothing.
*/
void DoAddCustomContext(wxXmlNode* nodeRoot);
/**
This function may be overridden to modify the contents of the exception
tag in the XML context file.
*/
bool DoAddExceptionInfo(wxXmlNode* nodeContext);
/**
This function may be overridden to modify the contents of the modules
tag in the XML context file.
*/
bool DoAddLoadedModules(wxXmlNode* nodeModules);
/**
This function may be overridden to modify the contents of the system
tag in the XML context file.
*/
bool DoAddSystemInfo(wxXmlNode* nodeSystemInfo);
/**
This method should be used to construct the full name of the files
which you wish to add to the report using AddFile().
@return The name of the temporary directory used for the files in this
report.
*/
const wxString GetDirectory() const;
/**
Retrieves the name (relative to GetDirectory()) and the description of
the file with the given index. If @a n is greater than or equal to the
number of filse, @false is returned.
*/
bool GetFile(size_t n, wxString* name, wxString* desc) const;
/**
Gets the current number files in this report.
*/
size_t GetFilesCount() const;
/**
Gets the name used as a base name for various files, by default
wxApp::GetAppName() is used.
*/
wxString GetReportName() const;
/**
Returns @true if the object was successfully initialized. If this
method returns @false the report can't be used.
*/
bool IsOk() const;
/**
Processes 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();
/**
Removes 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);
/**
Resets the directory name we use. The object can't be used any more
after this as it becomes uninitialized and invalid.
*/
void Reset();
};
/**
@class wxDebugReportPreviewStd
@wxheader{debugrpt.h}
wxDebugReportPreviewStd is a standard debug report preview window. It
displays a dialog allowing the user to examine the contents of a debug
report, remove files from and add notes to it.
@library{wxqa}
@category{debugging}
*/
class wxDebugReportPreviewStd : public wxDebugReportPreview
{
public:
/**
Trivial default constructor.
*/
wxDebugReportPreviewStd();
/**
Shows the dialog.
@see wxDebugReportPreview::Show()
*/
bool Show(wxDebugReport& dbgrpt) const;
};
/**
@class wxDebugReportUpload
@wxheader{debugrpt.h}
This class is used to upload a compressed file using HTTP POST request. As
this class derives from wxDebugReportCompress, before upload the report is
compressed in a single ZIP file.
@library{wxqa}
@category{debugging}
*/
class 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 @a url
is the upload page address, @a input is the name of the @c "type=file"
control on the form used for the file name and @a action is the value
of the form action field. The report is uploaded using the @e curl
program which should be available, the @e curl parameter may be used to
specify the full path to it.
*/
wxDebugReportUpload(const wxString& url, const wxString& input,
const wxString& action,
const wxString& curl = "curl");
/**
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. Value returned by this function becomes the return value of
wxDebugReport::Process().
*/
bool OnServerReply(const wxArrayString& reply);
};

362
interface/wx/defs.h Normal file
View File

@@ -0,0 +1,362 @@
/////////////////////////////////////////////////////////////////////////////
// Name: defs.h
// Purpose: interface of global functions
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
Item kinds for use with wxMenu, wxMenuItem, and wxToolBar.
@see wxMenu::Append(), wxMenuItem::wxMenuItem(), wxToolBar::AddTool()
*/
enum wxItemKind
{
wxITEM_SEPARATOR = -1,
/**
Normal tool button / menu item.
@see wxToolBar::AddTool(), wxMenu::AppendItem().
*/
wxITEM_NORMAL,
/**
Check (or toggle) tool button / menu item.
@see wxToolBar::AddCheckTool(), wxMenu::AppendCheckItem().
*/
wxITEM_CHECK,
/**
Radio tool button / menu item.
@see wxToolBar::AddRadioTool(), wxMenu::AppendRadioItem().
*/
wxITEM_RADIO,
/**
Normal tool button with a dropdown arrow next to it. Clicking the
dropdown arrow sends a @c wxEVT_COMMAND_TOOL_DROPDOWN_CLICKED event and may
also display the menu previously associated with the item with
wxToolBar::SetDropdownMenu(). Currently this type of tools is supported
under MSW and GTK.
*/
wxITEM_DROPDOWN,
wxITEM_MAX
};
/**
Paper size types for use with the printing framework.
@see overview_printing, wxPrintData::SetPaperId()
*/
enum wxPaperSize
{
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
// Windows 95 Only
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
};
/** @ingroup group_funcmacro_byteorder */
//@{
/**
This macro will swap the bytes of the @a value variable from little endian
to big endian or vice versa unconditionally, i.e. independently of the
current platform.
@header{wx/defs.h}
*/
#define wxINT32_SWAP_ALWAYS( wxInt32 value )
#define wxUINT32_SWAP_ALWAYS( wxUint32 value )
#define wxINT16_SWAP_ALWAYS( wxInt16 value )
#define wxUINT16_SWAP_ALWAYS( wxUint16 value )
//@}
/** @ingroup group_funcmacro_byteorder */
//@{
/**
This macro will swap the bytes of the @a value variable from little endian
to big endian or vice versa if the program is compiled on a big-endian
architecture (such as Sun work stations). If the program has been compiled
on a little-endian architecture, the value will be unchanged.
Use these macros to read data from and write data to a file that stores
data in little-endian (for example Intel i386) format.
@header{wx/defs.h}
*/
#define wxINT32_SWAP_ON_BE( wxInt32 value )
#define wxUINT32_SWAP_ON_BE( wxUint32 value )
#define wxINT16_SWAP_ON_BE( wxInt16 value )
#define wxUINT16_SWAP_ON_BE( wxUint16 value )
//@}
/** @ingroup group_funcmacro_byteorder */
//@{
/**
This macro will swap the bytes of the @a value variable from little endian
to big endian or vice versa if the program is compiled on a little-endian
architecture (such as Intel PCs). If the program has been compiled on a
big-endian architecture, the value will be unchanged.
Use these macros to read data from and write data to a file that stores
data in big-endian format.
@header{wx/defs.h}
*/
#define wxINT32_SWAP_ON_LE( wxInt32 value )
#define wxUINT32_SWAP_ON_LE( wxUint32 value )
#define wxINT16_SWAP_ON_LE( wxInt16 value )
#define wxUINT16_SWAP_ON_LE( wxUint16 value )
//@}
/** @ingroup group_funcmacro_misc */
//@{
/**
This macro can be used around a function declaration to generate warnings
indicating that this function is deprecated (i.e. obsolete and planned to
be removed in the future) when it is used. Only Visual C++ 7 and higher and
g++ compilers currently support this functionality.
Example of use:
@code
// old function, use wxString version instead
wxDEPRECATED( void wxGetSomething(char *buf, size_t len) );
// ...
wxString wxGetSomething();
@endcode
@header{wx/defs.h}
*/
#define wxDEPRECATED(function)
/**
This is a special version of wxDEPRECATED() macro which only does something
when the deprecated function is used from the code outside wxWidgets itself
but doesn't generate warnings when it is used from wxWidgets.
It is used with the virtual functions which are called by the library
itself -- even if such function is deprecated the library still has to call
it to ensure that the existing code overriding it continues to work, but
the use of this macro ensures that a deprecation warning will be generated
if this function is used from the user code or, in case of Visual C++, even
when it is simply overridden.
@header{wx/defs.h}
*/
#define wxDEPRECATED_BUT_USED_INTERNALLY(function)
/**
This macro is similar to wxDEPRECATED() but can be used to not only declare
the function @a function as deprecated but to also provide its (inline)
implementation @a body.
It can be used as following:
@code
class wxFoo
{
public:
// OldMethod() is deprecated, use NewMethod() instead
void NewMethod();
wxDEPRECATED_INLINE( void OldMethod(), NewMethod() );
};
@endcode
@header{wx/defs.h}
*/
#define wxDEPRECATED_INLINE(func, body)
/**
@c wxEXPLICIT is a macro which expands to the C++ @c explicit keyword if
the compiler supports it or nothing otherwise. Thus, it can be used even in
the code which might have to be compiled with an old compiler without
support for this language feature but still take advantage of it when it is
available.
@header{wx/defs.h}
*/
#define wxEXPLICIT
/**
GNU C++ compiler gives a warning for any class whose destructor is private
unless it has a friend. This warning may sometimes be useful but it doesn't
make sense for reference counted class which always delete themselves
(hence destructor should be private) but don't necessarily have any
friends, so this macro is provided to disable the warning in such case. The
@a name parameter should be the name of the class but is only used to
construct a unique friend class name internally.
Example of using the macro:
@code
class RefCounted
{
public:
RefCounted() { m_nRef = 1; }
void IncRef() { m_nRef++ ; }
void DecRef() { if ( !--m_nRef ) delete this; }
private:
~RefCounted() { }
wxSUPPRESS_GCC_PRIVATE_DTOR(RefCounted)
};
@endcode
Notice that there should be no semicolon after this macro.
@header{wx/defs.h}
*/
#define wxSUPPRESS_GCC_PRIVATE_DTOR_WARNING(name)
/**
This macro is the same as the standard C99 @c va_copy for the compilers
which support it or its replacement for those that don't. It must be used
to preserve the value of a @c va_list object if you need to use it after
passing it to another function because it can be modified by the latter.
As with @c va_start, each call to @c wxVaCopy must have a matching
@c va_end.
@header{wx/defs.h}
*/
void wxVaCopy(va_list argptrDst, va_list argptrSrc);
//@}

613
interface/wx/dialog.h Normal file
View File

@@ -0,0 +1,613 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dialog.h
// Purpose: interface of wxDialog
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
Modes used for wxDialog::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.
};
/**
@class wxDialog
@wxheader{dialog.h}
A dialog box is a window with a title bar and sometimes a system menu,
which can be moved around the screen. It can contain controls and other
windows and is often used to allow the user to make some choice or to
answer a question.
Dialogs can be made scrollable, automatically, for computers with low
resolution screens: please see @ref overview_dialog_autoscrolling for
further details.
Dialogs usually contains either a single button allowing to close the
dialog or two buttons, one accepting the changes and the other one
discarding them (such button, if present, is automatically activated if the
user presses the "Esc" key). By default, buttons with the standard wxID_OK
and wxID_CANCEL identifiers behave as expected. Starting with wxWidgets 2.7
it is also possible to use a button with a different identifier instead,
see SetAffirmativeId() and SetEscapeId().
Also notice that the CreateButtonSizer() should be used to create the
buttons appropriate for the current platform and positioned correctly
(including their order which is platform-dependent).
@section dialog_modal Modal and Modeless
There are two kinds of dialog, modal and modeless. A modal dialog blocks
program flow and user input on other windows until it is dismissed, whereas
a modeless dialog behaves more like a frame in that program flow continues,
and input in other windows is still possible. To show a modal dialog you
should use the ShowModal() method while to show a dialog modelessly you
simply use Show(), just as with frames.
Note that the modal dialog is one of the very few examples of
wxWindow-derived objects which may be created on the stack and not on the
heap. In other words, while most windows would be created like this:
@code
void AskUser()
{
MyAskDialog *dlg = new MyAskDialog(...);
if ( dlg->ShowModal() == wxID_OK )
// ...
//else: dialog was cancelled or some another button pressed
dlg->Destroy();
}
@endcode
You can achieve the same result with dialogs by using simpler code:
@code
void AskUser()
{
MyAskDialog dlg(...);
if ( dlg.ShowModal() == wxID_OK )
// ...
// no need to call Destroy() here
}
@endcode
An application can define a wxCloseEvent handler for the dialog to respond
to system close events.
@beginStyleTable
@style{wxCAPTION}
Puts a caption on the dialog box.
@style{wxDEFAULT_DIALOG_STYLE}
Equivalent to a combination of wxCAPTION, wxCLOSE_BOX and
wxSYSTEM_MENU (the last one is not used under Unix).
@style{wxRESIZE_BORDER}
Display a resizeable frame around the window.
@style{wxSYSTEM_MENU}
Display a system menu.
@style{wxCLOSE_BOX}
Displays a close box on the frame.
@style{wxMAXIMIZE_BOX}
Displays a maximize box on the dialog.
@style{wxMINIMIZE_BOX}
Displays a minimize box on the dialog.
@style{wxTHICK_FRAME}
Display a thick frame around the window.
@style{wxSTAY_ON_TOP}
The dialog stays on top of all other windows.
@style{wxNO_3D}
Under Windows, specifies that the child controls should not have 3D
borders unless specified in the control.
@style{wxDIALOG_NO_PARENT}
By default, a dialog created with a @NULL parent window will be
given the @ref wxApp::GetTopWindow() "application's top level window"
as parent. Use this style to prevent this from happening and create
an orphan dialog. This is not recommended for modal dialogs.
@style{wxDIALOG_EX_CONTEXTHELP}
Under Windows, puts a query button on the caption. When pressed,
Windows will go into a context-sensitive help mode and wxWidgets
will send a wxEVT_HELP event if the user clicked on an application
window. Note that this is an extended style and must be set by
calling SetExtraStyle() before Create is called (two-step
construction).
@style{wxDIALOG_EX_METAL}
On Mac OS X, frames with this style will be shown with a metallic
look. This is an extra style.
@endStyleTable
Under Unix or Linux, MWM (the Motif Window Manager) or other window
managers recognizing the MHM hints should be running for any of these
styles to have an effect.
@library{wxcore}
@category{cmndlg}
@see @ref overview_dialog, wxFrame, @ref overview_validator
*/
class wxDialog : public wxTopLevelWindow
{
public:
/**
Default constructor.
*/
wxDialog();
/**
Constructor.
@param parent
Can be @NULL, a frame or another dialog box.
@param id
An identifier for the dialog. A value of -1 is taken to mean a
default.
@param title
The title of the dialog.
@param pos
The dialog position. The value wxDefaultPosition indicates a
default position, chosen by either the windowing system or
wxWidgets, depending on platform.
@param size
The dialog size. The value wxDefaultSize indicates a default size,
chosen by either the windowing system or wxWidgets, depending on
platform.
@param style
The window style.
@param name
Used to associate a name with the window, allowing the application
user to set Motif resource values for individual dialog boxes.
@see Create()
*/
wxDialog(wxWindow* parent, wxWindowID id, const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_DIALOG_STYLE,
const wxString& name = "dialogBox");
/**
Destructor. Deletes any child windows before deleting the physical
window.
*/
~wxDialog();
/**
Adds an identifier to be regarded as a main button for the
non-scrolling area of a dialog.
@see @ref overview_dialog_autoscrolling (for more on layout adaptation)
*/
void AddMainButtonId(wxWindowID id);
/**
Returns @true if this dialog can and should perform layout adaptation
using DoLayoutAdaptation(), usually if the dialog is too large to fit
on the display.
@see @ref overview_dialog_autoscrolling (for more on layout adaptation)
*/
bool CanDoLayoutAdapation();
/**
Centres the dialog box on the display.
@param direction
May be wxHORIZONTAL, wxVERTICAL or wxBOTH.
*/
void Centre(int direction = wxBOTH);
/**
Used for two-step dialog box construction.
@see wxDialog()
*/
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 = "dialogBox");
/**
Creates a sizer with standard buttons. @a flags is a bit list of the
following flags: wxOK, wxCANCEL, wxYES, wxNO, wxAPPLY, wxCLOSE, wxHELP,
wxNO_DEFAULT.
The sizer lays out the buttons in a manner appropriate to the platform.
This function uses CreateStdDialogButtonSizer() internally for most
platforms but doesn't create the sizer at all for the platforms with
hardware buttons (such as smartphones) for which it sets up the
hardware buttons appropriately and returns @NULL, so don't forget to
test that the return value is valid before using it.
*/
wxSizer* CreateButtonSizer(long flags);
/**
Creates a sizer with standard buttons using CreateButtonSizer()
separated from the rest of the dialog contents by a horizontal
wxStaticLine.
@note Just like CreateButtonSizer(), this function may return @NULL if
no buttons were created.
*/
wxSizer* CreateSeparatedButtonSizer(long flags);
/**
Creates a wxStdDialogButtonSizer with standard buttons. @a flags is a
bit list of the following flags: wxOK, wxCANCEL, wxYES, wxNO, wxAPPLY,
wxCLOSE, wxHELP, wxNO_DEFAULT.
The sizer lays out the buttons in a manner appropriate to the platform.
*/
wxStdDialogButtonSizer* CreateStdDialogButtonSizer(long flags);
/**
Performs layout adaptation, usually if the dialog is too large to fit
on the display.
@see @ref overview_dialog_autoscrolling (for more on layout adaptation)
*/
bool DoLayoutAdapation();
/**
This function is called when the titlebar OK button is pressed
(PocketPC only). A command event for the identifier returned by
GetAffirmativeId() is sent by default. You can override this function.
If the function returns @false, wxWidgets will call Close() for the
dialog.
*/
virtual bool DoOK();
/**
A static function enabling or disabling layout adaptation for all
dialogs.
@see @ref overview_dialog_autoscrolling (for more on layout adaptation)
*/
static void EnableLayoutAdaptation(bool enable);
/**
Ends a modal dialog, passing a value to be returned from the
ShowModal() invocation.
@param retCode
The value that should be returned by ShowModal.
@see ShowModal(), GetReturnCode(), SetReturnCode()
*/
void EndModal(int retCode);
/**
Gets the identifier of the button which works like standard OK button
in this dialog.
@see SetAffirmativeId()
*/
int GetAffirmativeId() const;
/**
Override this to return a window containing the main content of the
dialog. This is particularly useful when the dialog implements pages,
such as wxPropertySheetDialog, and allows the
@ref overview_dialog "layout adaptation code" to know that only the
pages need to be made scrollable.
*/
wxWindow* GetContentWindow() const;
/**
Gets the identifier of the button to map presses of @c ESC button to.
@see SetEscapeId()
*/
int GetEscapeId() const;
/**
Returns @true if the dialog has been adapted, usually by making it
scrollable to work with a small display.
@see @ref overview_dialog_autoscrolling (for more on layout adaptation)
*/
bool GetLayoutAdaptationDone() const;
/**
Gets a value representing the aggressiveness of search for buttons and
sizers to be in the non-scrolling part of a layout-adapted dialog. Zero
switches off adaptation, and 3 allows search for standard buttons
anywhere in the dialog.
@see @ref overview_dialog_autoscrolling (for more on layout adaptation)
*/
int GetLayoutAdaptationLevel();
/**
Gets the adaptation mode, overriding the global adaptation flag.
@see @ref overview_dialog_autoscrolling (for more on layout adaptation)
*/
wxDialogLayoutAdaptationMode GetLayoutAdaptationMode() const;
/**
A static function getting the current layout adapter object.
@see @ref overview_dialog_autoscrolling (for more on layout adaptation)
*/
static wxDialogLayoutAdapter* GetLayoutAdapter();
/**
Returns an array of identifiers to be regarded as the main buttons for
the non-scrolling area of a dialog.
@see @ref overview_dialog_autoscrolling (for more on layout adaptation)
*/
wxArrayInt GetMainButtonIds();
/**
Gets the return code for this window.
@remarks A return code is normally associated with a modal dialog,
where ShowModal() returns a code to the application.
@see SetReturnCode(), ShowModal(), EndModal()
*/
int GetReturnCode();
/**
On PocketPC, a dialog is automatically provided with an empty toolbar.
This function allows you to access the toolbar and add tools to it.
Removing tools and adding arbitrary controls are not currently
supported.
This function is not available on any other platform.
*/
wxToolBar* GetToolBar() const;
/**
Iconizes or restores the dialog. Windows only.
@param iconize
If @true, iconizes the dialog box; if @false, shows and restores it.
@remarks Note that in Windows, iconization has no effect since dialog
boxes cannot be iconized. However, applications may need to
explicitly restore dialog boxes under Motif which have
user-iconizable frames, and under Windows calling
Iconize(@false) will bring the window to the front, as does
Show(@true).
*/
void Iconize(bool iconize);
/**
Returns @true if the dialog box is iconized. Windows only.
@remarks Always returns @false under Windows since dialogs cannot be
iconized.
*/
bool IsIconized() const;
/**
A static function returning @true if layout adaptation is enabled for
all dialogs.
@see @ref overview_dialog_autoscrolling (for more on layout adaptation)
*/
static bool IsLayoutAdaptationEnabled();
/**
Returns @true if @a id is in the array of identifiers to be regarded as
the main buttons for the non-scrolling area of a dialog.
@see @ref overview_dialog_autoscrolling (for more on layout adaptation)
*/
bool IsMainButton(wxWindowID& id) const;
/**
Returns @true if the dialog box is modal, @false otherwise.
*/
bool IsModal() const;
/**
The default handler for wxEVT_SYS_COLOUR_CHANGED.
@param event
The colour change event.
@remarks Changes the dialog's colour to conform to the current settings
(Windows only). Add an event table entry for your dialog class
if you wish the behaviour to be different (such as keeping a
user-defined background colour). If you do override this
function, call wxEvent::Skip() to propagate the notification
to child windows and controls.
@see wxSysColourChangedEvent
*/
void OnSysColourChanged(wxSysColourChangedEvent& event);
/**
Sets the identifier to be used as OK button. When the button with this
identifier is pressed, the dialog calls wxWindow::Validate() and
wxWindow::TransferDataFromWindow() and, if they both return @true,
closes the dialog with wxID_OK return code.
Also, when the user presses a hardware OK button on the devices having
one or the special OK button in the PocketPC title bar, an event with
this id is generated.
By default, the affirmative id is wxID_OK.
@see GetAffirmativeId(), SetEscapeId()
*/
void SetAffirmativeId(int id);
/**
Sets the identifier of the button which should work like the standard
"Cancel" button in this dialog. When the button with this id is
clicked, the dialog is closed. Also, when the user presses @c ESC key
in the dialog or closes the dialog using the close button in the title
bar, this is mapped to the click of the button with the specified id.
By default, the escape id is the special value wxID_ANY meaning that
wxID_CANCEL button is used if it's present in the dialog and otherwise
the button with GetAffirmativeId() is used. Another special value for
@a id is wxID_NONE meaning that @c ESC presses should be ignored. If
any other value is given, it is interpreted as the id of the button to
map the escape key to.
*/
void SetEscapeId(int id);
/**
Sets the icon for this dialog.
@param icon
The icon to associate with this dialog.
@see wxIcon
*/
void SetIcon(const wxIcon& icon);
/**
Sets the icons for this dialog.
@param icons
The icons to associate with this dialog.
@see wxIconBundle
*/
void SetIcons(const wxIconBundle& icons);
/**
Marks the dialog as having been adapted, usually by making it
scrollable to work with a small display.
@see @ref overview_dialog_autoscrolling (for more on layout adaptation)
*/
void SetLayoutAdaptationDone(bool done);
/**
Sets the aggressiveness of search for buttons and sizers to be in the
non-scrolling part of a layout-adapted dialog. Zero switches off
adaptation, and 3 allows search for standard buttons anywhere in the
dialog.
@see @ref overview_dialog_autoscrolling (for more on layout adaptation)
*/
void SetLayoutAdaptationLevel(int level);
/**
Sets the adaptation mode, overriding the global adaptation flag.
@see wxDialogLayoutAdaptationMode, @ref overview_dialog_autoscrolling
(for more on layout adaptation)
*/
void SetLayoutAdaptationMode(wxDialogLayoutAdaptationMode mode);
/**
A static function for setting the current layout adapter object,
returning the old adapter. If you call this, you should delete the old
adapter object.
@see wxDialogLayoutAdapter, @ref overview_dialog_autoscrolling
*/
static wxDialogLayoutAdapter* SetLayoutAdapter(wxDialogLayoutAdapter* adapter);
/**
@deprecated This function doesn't work for all ports, just use
ShowModal() to show a modal dialog instead.
Allows the programmer to specify whether the dialog box is modal
(Show() blocks control until the dialog is hidden) or modeless (control
returns immediately).
@param flag
If @true, the dialog will be modal, otherwise it will be modeless.
*/
void SetModal(bool flag);
/**
Sets the return code for this window.
A return code is normally associated with a modal dialog, where
ShowModal() returns a code to the application. The function EndModal()
calls SetReturnCode().
@param retCode
The integer return code, usually a control identifier.
@see GetReturnCode(), ShowModal(), EndModal()
*/
void SetReturnCode(int retCode);
/**
Hides or shows the dialog. The preferred way of dismissing a modal
dialog is to use EndModal().
@param show
If @true, the dialog box is shown and brought to the front,
otherwise the box is hidden. If @false and the dialog is modal,
control is returned to the calling program.
*/
bool Show(bool show);
/**
Shows a modal dialog.
Program flow does not return until the dialog has been dismissed with
EndModal().
Notice that it is possible to call ShowModal() for a dialog which had
been previously shown with Show(), this allows to make an existing
modeless dialog modal. However ShowModal() can't be called twice
without intervening EndModal() calls.
@return The value set with SetReturnCode().
@see EndModal(), GetReturnCode(), SetReturnCode()
*/
int ShowModal();
};
/**
@class wxDialogLayoutAdapter
@wxheader{dialog.h}
This abstract class is the base for classes that help wxWidgets peform
run-time layout adaptation of dialogs. Principally, this is to cater for
small displays by making part of the dialog scroll, but the application
developer may find other uses for layout adaption.
By default, there is one instance of wxStandardDialogLayoutAdapter which
can perform adaptation for most custom dialogs and dialogs with book
controls such as wxPropertySheetDialog.
@library{wxcore}
@category{winlayout}
@see @ref overview_dialog_autoscrolling
*/
class wxDialogLayoutAdapter
{
public:
/**
Default constructor.
*/
wxDialogLayoutAdapter();
/**
Override this to returns @true if adaptation can and should be done.
*/
bool CanDoLayoutAdaptation(wxDialog* dialog);
/**
Override this to perform layout adaptation, such as making parts of the
dialog scroll and resizing the dialog to fit the display. Normally this
function will be called just before the dialog is shown.
*/
bool DoLayoutAdaptation(wxDialog* dialog);
};

217
interface/wx/dialup.h Normal file
View File

@@ -0,0 +1,217 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dialup.h
// Purpose: interface of wxDialUpManager
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxDialUpManager
@wxheader{dialup.h}
This class encapsulates functions dealing with verifying the connection
status of the workstation (connected to the Internet via a direct
connection, connected through a modem or not connected at all) and to
establish this connection if possible/required (i.e. in the case of the
modem).
The program may also wish to be notified about the change in the connection
status (for example, to perform some action when the user connects to the
network the next time or, on the contrary, to stop receiving data from the
net when the user hangs up the modem). For this, you need to use one of the
event macros described below.
This class is different from other wxWidgets classes in that there is at
most one instance of this class in the program accessed via Create() and
you can't create the objects of this class directly.
@beginEventTable{wxDialUpEvent}
@event{EVT_DIALUP_CONNECTED(func)}
A connection with the network was established.
@event{EVT_DIALUP_DISCONNECTED(func)}
The connection with the network was lost.
@endEventTable
@library{wxcore}
@category{net}
@see @ref page_samples_dialup, wxDialUpEvent
*/
class wxDialUpManager
{
public:
/**
Destructor.
*/
~wxDialUpManager();
/**
Cancel dialing the number initiated with Dial() with async parameter
equal to @true.
@note This won't result in a DISCONNECTED event being sent.
@see IsDialing()
*/
bool CancelDialing();
/**
This function should create and return the object of the
platform-specific class derived from wxDialUpManager. You should delete
the pointer when you are done with it.
*/
wxDialUpManager* Create();
/**
Dial the given ISP, use @a username and @a password to authenticate.
The parameters are only used under Windows currently, for Unix you
should use SetConnectCommand() to customize this functions behaviour.
If no @a nameOfISP is given, the function will select the default one
(proposing the user to choose among all connections defined on this
machine) and if no username and/or password are given, the function
will try to do without them, but will ask the user if really needed.
If @a async parameter is @false, the function waits until the end of
dialing and returns @true upon successful completion.
If @a 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).
*/
bool Dial(const wxString& nameOfISP = wxEmptyString,
const wxString& username = wxEmptyString,
const wxString& password = wxEmptyString,
bool async = true);
/**
Disable automatic check for connection status change - notice that the
@c wxEVT_DIALUP_XXX events won't be sent any more neither.
*/
void DisableAutoCheckOnlineStatus();
/**
Enable automatic 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 and specifies
how often should we repeat the check (each minute by default). Under
Windows, the notification about the change of connection status is sent
by the system and so we don't do any polling and this parameter is
ignored.
@return @false if couldn't set up automatic check for online status.
*/
bool EnableAutoCheckOnlineStatus(size_t nSeconds = 60);
/**
This function is only implemented under Windows.
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).
*/
size_t GetISPNames(wxArrayString& names) const;
/**
Hang up the currently active dial up connection.
*/
bool HangUp();
/**
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.
@note This function tries to guess the result and it is not always
guaranteed to be correct, so it is better to ask user for
confirmation or give him a possibility to override it.
*/
bool IsAlwaysOnline() const;
/**
Returns @true if (async) dialing is in progress.
@see Dial()
*/
bool IsDialing() const;
/**
Returns @true if the dialup manager was initialized correctly. If this
function returns @false, no other functions will work neither, so it is
a good idea to call this function and check its result before calling
any other wxDialUpManager methods.
*/
bool IsOk() const;
/**
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.
*/
bool IsOnline() const;
/**
This method is for Unix only.
Sets the commands to start up the network and to hang up again.
*/
void SetConnectCommand(const wxString& commandDial = "/usr/bin/pon",
const wxString& commandHangup = "/usr/bin/poff") const;
/**
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.
@see IsOnline()
*/
void SetOnlineStatus(bool isOnline = true);
/**
This method is for Unix only.
Under Unix, the value of well-known host is used to check whether we're
connected to the internet. It is unused under Windows, but this
function is always safe to call. The default value is
@c "www.yahoo.com:80".
*/
void SetWellKnownHost(const wxString& hostname, int portno = 80);
};
/**
@class wxDialUpEvent
@wxheader{dialup.h}
This is the event class for the dialup events sent by wxDialUpManager.
@library{wxcore}
@category{events}
*/
class wxDialUpEvent : public wxEvent
{
public:
/**
Constructor is only used by wxDialUpManager.
*/
wxDialUpEvent(bool isConnected, bool isOwnEvent);
/**
Is this a @c CONNECTED or @c DISCONNECTED event? In other words, does
it notify about transition from offline to online state or vice versa?
*/
bool IsConnectedEvent() const;
/**
Does this event come from wxDialUpManager::Dial() or from some extrenal
process (i.e. does it result from our own attempt to establish the
connection)?
*/
bool IsOwnEvent() const;
};

292
interface/wx/dir.h Normal file
View File

@@ -0,0 +1,292 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dir.h
// Purpose: interface of wxDir and wxDirTraverser
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
Possible return values of wxDirTraverser callback functions.
*/
enum wxDirTraverseResult
{
wxDIR_IGNORE = -1, ///< Ignore this directory but continue with others.
wxDIR_STOP, ///< Stop traversing.
wxDIR_CONTINUE ///< Continue into this directory.
};
/**
@class wxDirTraverser
@wxheader{dir.h}
wxDirTraverser is an abstract interface which must be implemented by
objects passed to wxDir::Traverse() function.
Example of use (this works almost like wxDir::GetAllFiles()):
@code
class wxDirTraverserSimple : public wxDirTraverser
{
public:
wxDirTraverserSimple(wxArrayString& files) : m_files(files) { }
virtual wxDirTraverseResult OnFile(const wxString& filename)
{
m_files.Add(filename);
return wxDIR_CONTINUE;
}
virtual wxDirTraverseResult OnDir(const wxString& WXUNUSED(dirname))
{
return wxDIR_CONTINUE;
}
private:
wxArrayString& m_files;
};
// get the names of all files in the array
wxArrayString files;
wxDirTraverserSimple traverser(files);
wxDir dir(dirname);
dir.Traverse(traverser);
@endcode
@library{wxbase}
@category{file}
*/
class wxDirTraverser
{
public:
/**
This function is called for each directory. It may return ::wxDIR_STOP
to abort traversing completely, ::wxDIR_IGNORE to skip this directory
but continue with others or ::wxDIR_CONTINUE to enumerate all files and
subdirectories in this directory.
This is a pure virtual function and must be implemented in the derived
class.
*/
virtual wxDirTraverseResult OnDir(const wxString& dirname);
/**
This function is called for each file. It may return ::wxDIR_STOP to
abort traversing (for example, if the file being searched is found) or
::wxDIR_CONTINUE to proceed.
This is a pure virtual function and must be implemented in the derived
class.
*/
virtual wxDirTraverseResult OnFile(const wxString& filename);
/**
This function is called for each directory which we failed to open for
enumerating. It may return ::wxDIR_STOP to abort traversing completely,
::wxDIR_IGNORE to skip this directory but continue with others or
::wxDIR_CONTINUE to retry opening this directory once again.
The base class version always returns ::wxDIR_IGNORE.
*/
virtual wxDirTraverseResult OnOpenError(const wxString& openerrorname);
};
/**
These flags define what kind of filenames are included in the list of files
enumerated by wxDir::GetFirst() and wxDir::GetNext().
*/
enum
{
wxDIR_FILES = 0x0001, ///< Includes files.
wxDIR_DIRS = 0x0002, ///< Includes directories.
wxDIR_HIDDEN = 0x0004, ///< Includes hidden files.
wxDIR_DOTDOT = 0x0008, ///< Includes "." and "..".
wxDIR_DEFAULT = wxDIR_FILES | wxDIR_DIRS | wxDIR_HIDDEN
};
/**
@class wxDir
@wxheader{dir.h}
wxDir is a portable equivalent of Unix open/read/closedir functions which
allow enumerating of the files in a directory. wxDir allows to enumerate
files as well as directories.
wxDir also provides a flexible way to enumerate files recursively using
Traverse() or a simpler GetAllFiles() function.
Example of use:
@code
wxDir dir(wxGetCwd());
if ( !dir.IsOpened() )
{
// deal with the error here - wxDir would already log an error message
// explaining the exact reason of the failure
return;
}
puts("Enumerating object files in current directory:");
wxString filename;
bool cont = dir.GetFirst(&filename, filespec, flags);
while ( cont )
{
printf("%s\n", filename.c_str());
cont = dir.GetNext(&filename);
}
@endcode
@library{wxbase}
@category{file}
*/
class wxDir
{
public:
/**
Default constructor, use Open() afterwards.
*/
wxDir();
/**
Opens the directory for enumeration, use IsOpened() to test for errors.
*/
wxDir(const wxString& dir);
/**
Destructor cleans up the associated resources. It is not virtual and so
this class is not meant to be used polymorphically.
*/
~wxDir();
/**
Test for existence of a directory with the given name.
*/
static bool Exists(const wxString& dir);
/**
The function returns the path of the first file matching the given
@a filespec or an empty string if there are no files matching it.
The @a flags parameter may or may not include ::wxDIR_FILES, the
function always behaves as if it were specified. By default, @a flags
includes ::wxDIR_DIRS and so the function recurses into the
subdirectories but if this flag is not specified, the function
restricts the search only to the directory @a dirname itself.
@see Traverse()
*/
static wxString FindFirst(const wxString& dirname,
const wxString& filespec,
int flags = wxDIR_DEFAULT);
/**
The function appends the names of all the files under directory
@a dirname to the array @a files (note that its old content is
preserved). Only files matching the @a filespec are taken, with empty
spec matching all the files.
The @a flags parameter should always include ::wxDIR_FILES or the array
would be unchanged and should include ::wxDIR_DIRS flag to recurse into
subdirectories (both flags are included in the value by default).
@see Traverse()
*/
static size_t GetAllFiles(const wxString& dirname, wxArrayString* files,
const wxString& filespec = wxEmptyString,
int flags = wxDIR_DEFAULT);
/**
Start enumerating all files matching @a filespec (or all files if it is
empty) and @e flags, return @true on success.
*/
bool GetFirst(wxString* filename,
const wxString& filespec = wxEmptyString,
int flags = wxDIR_DEFAULT) const;
/**
Returns the name of the directory itself. The returned string does not
have the trailing path separator (slash or backslash).
*/
wxString GetName() const;
/**
Continue enumerating files which satisfy the criteria specified by the
last call to GetFirst().
*/
bool GetNext(wxString* filename) const;
/**
Returns the size (in bytes) of all files recursively found in @c dir or
@c wxInvalidSize in case of error.
In case it happens that while traversing folders a file's size can not
be read, that file is added to the @a filesSkipped array, if not @NULL,
and then skipped. This usually happens with some special folders which
are locked by the operating system or by another process. Remember that
when the size of @a filesSkipped is not zero, then the returned value
is not 100% accurate and, if the skipped files were big, it could be
far from real size of the directory.
@see wxFileName::GetHumanReadableSize(), wxGetDiskSpace()
*/
static wxULongLong GetTotalSize(const wxString& dir,
wxArrayString* filesSkipped = NULL);
/**
Returns @true if the directory contains any files matching the given
@a filespec. If @a filespec is empty, look for any files at all. In any
case, even hidden files are taken into account.
*/
bool HasFiles(const wxString& filespec = wxEmptyString) const;
/**
Returns @true if the directory contains any subdirectories (if a non
empty @a filespec is given, only check for directories matching it).
The hidden subdirectories are taken into account as well.
*/
bool HasSubDirs(const wxString& dirspec = wxEmptyString) const;
/**
Returns @true if the directory was successfully opened by a previous
call to Open().
*/
bool IsOpened() const;
/**
Open the directory for enumerating, returns @true on success or @false
if an error occurred.
*/
bool Open(const wxString& dir);
/**
Enumerate all files and directories under the given directory
recursively calling the element of the provided wxDirTraverser object
for each of them.
More precisely, the function will really recurse into subdirectories if
@a flags contains ::wxDIR_DIRS flag. It will ignore the files (but
still possibly recurse into subdirectories) if ::wxDIR_FILES flag is
given.
For each found directory, @ref wxDirTraverser::OnDir() "sink.OnDir()"
is called and @ref wxDirTraverser::OnFile() "sink.OnFile()" is called
for every file. Depending on the return value, the enumeration may
continue or stop.
The function returns the total number of files found or @c "(size_t)-1"
on error.
@see GetAllFiles()
*/
size_t Traverse(wxDirTraverser& sink,
const wxString& filespec = wxEmptyString,
int flags = wxDIR_DEFAULT);
};

190
interface/wx/dirctrl.h Normal file
View File

@@ -0,0 +1,190 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dirctrl.h
// Purpose: interface of wxGenericDirCtrl
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxGenericDirCtrl
@wxheader{dirctrl.h}
This control can be used to place a directory listing (with optional
files) on an arbitrary window.
The control contains a wxTreeCtrl window representing the directory
hierarchy, and optionally, a wxChoice window containing a list of filters.
@beginStyleTable
@style{wxDIRCTRL_DIR_ONLY}
Only show directories, and not files.
@style{wxDIRCTRL_3D_INTERNAL}
Use 3D borders for internal controls.
@style{wxDIRCTRL_SELECT_FIRST}
When setting the default path, select the first file in the
directory.
@style{wxDIRCTRL_EDIT_LABELS}
Allow the folder and file labels to be editable.
@endStyleTable
@library{wxbase}
@category{ctrl}
<!-- @appearance{genericdirctrl.png} -->
*/
class wxGenericDirCtrl : public wxControl
{
public:
/**
Default constructor.
*/
wxGenericDirCtrl();
/**
Main constructor.
@param parent
Parent window.
@param id
Window identifier.
@param dir
Initial folder.
@param pos
Position.
@param size
Size.
@param style
Window style. Please see wxGenericDirCtrl for a list of possible
styles.
@param filter
A filter string, using the same syntax as that for wxFileDialog.
This may be empty if filters are not being used. Example:
@c "All files (*.*)|*.*|JPEG files (*.jpg)|*.jpg"
@param defaultFilter
The zero-indexed default filter setting.
@param name
The window name.
*/
wxGenericDirCtrl(wxWindow* parent, const wxWindowID id = -1,
const wxString& dir = wxDirDialogDefaultFolderStr,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDIRCTRL_3D_INTERNAL|wxBORDER_SUNKEN,
const wxString& filter = wxEmptyString,
int defaultFilter = 0,
const wxString& name = wxTreeCtrlNameStr);
/**
Destructor.
*/
~wxGenericDirCtrl();
/**
Collapse the given @a path.
*/
bool CollapsePath(const wxString& path);
/**
Collapses the entire tree.
*/
void CollapseTree();
/**
Create function for two-step construction. See wxGenericDirCtrl() for
details.
*/
bool Create(wxWindow* parent, const wxWindowID id = -1,
const wxString& dir = wxDirDialogDefaultFolderStr,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDIRCTRL_3D_INTERNAL|wxBORDER_SUNKEN,
const wxString& filter = wxEmptyString,
int defaultFilter = 0,
const wxString& name = wxTreeCtrlNameStr);
/**
Tries to expand as much of the given @a path as possible, so that the
filename or directory is visible in the tree control.
*/
bool ExpandPath(const wxString& path);
/**
Gets the default path.
*/
wxString GetDefaultPath() const;
/**
Gets selected filename path only (else empty string).
This function doesn't count a directory as a selection.
*/
wxString GetFilePath() const;
/**
Returns the filter string.
*/
wxString GetFilter() const;
/**
Returns the current filter index (zero-based).
*/
int GetFilterIndex() const;
/**
Returns a pointer to the filter list control (if present).
*/
wxDirFilterListCtrl* GetFilterListCtrl() const;
/**
Gets the currently-selected directory or filename.
*/
wxString GetPath() const;
/**
Returns the root id for the tree control.
*/
wxTreeItemId GetRootId();
/**
Returns a pointer to the tree control.
*/
wxTreeCtrl* GetTreeCtrl() const;
/**
Initializes variables.
*/
void Init();
/**
Collapse and expand the tree, thus re-creating it from scratch. May be
used to update the displayed directory content.
*/
void ReCreateTree();
/**
Sets the default path.
*/
void SetDefaultPath(const wxString& path);
/**
Sets the filter string.
*/
void SetFilter(const wxString& filter);
/**
Sets the current filter index (zero-based).
*/
void SetFilterIndex(int n);
/**
Sets the current path.
*/
void SetPath(const wxString& path);
/**
@param show
If @true, hidden folders and files will be displayed by the
control. If @false, they will not be displayed.
*/
void ShowHidden(bool show);
};

132
interface/wx/dirdlg.h Normal file
View File

@@ -0,0 +1,132 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dirdlg.h
// Purpose: interface of wxDirDialog
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxDirDialog
@wxheader{dirdlg.h}
This class represents the directory chooser dialog.
@beginStyleTable
@style{wxDD_DEFAULT_STYLE}
Equivalent to a combination of wxDEFAULT_DIALOG_STYLE and
wxRESIZE_BORDER (the last one is not used under wxWinCE).
@style{wxDD_DIR_MUST_EXIST}
The dialog will allow the user to choose only an existing folder.
When this style is not given, a "Create new directory" button is
added to the dialog (on Windows) or some other way is provided to
the user to type the name of a new folder.
@style{wxDD_CHANGE_DIR}
Change the current working directory to the directory chosen by the
user.
@endStyleTable
@note On Windows the new directory button is only available with recent
versions of the common dialogs.
@library{wxcore}
@category{cmndlg}
@see @ref overview_cmndlg_dir, wxFileDialog
*/
class wxDirDialog : public wxDialog
{
public:
/**
Constructor. Use ShowModal() to show the dialog.
@param parent
Parent window.
@param message
Message to show on the dialog.
@param defaultPath
The default path, or the empty string.
@param style
The dialog style. See wxDirDialog
@param pos
Dialog position. Ignored under Windows.
@param size
Dialog size. Ignored under Windows.
@param name
The dialog name, not used.
*/
wxDirDialog(wxWindow* parent,
const wxString& message = "Choose a directory",
const wxString& defaultPath = "",
long style = wxDD_DEFAULT_STYLE,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
const wxString& name = "wxDirCtrl");
/**
Destructor.
*/
~wxDirDialog();
/**
Returns the message that will be displayed on the dialog.
*/
wxString GetMessage() const;
/**
Returns the default or user-selected path.
*/
wxString GetPath() const;
/**
Sets the message that will be displayed on the dialog.
*/
void SetMessage(const wxString& message);
/**
Sets the default path.
*/
void SetPath(const wxString& path);
/**
Shows the dialog, returning wxID_OK if the user pressed OK, and
wxID_CANCEL otherwise.
*/
int ShowModal();
};
// ============================================================================
// Global functions/macros
// ============================================================================
/** @ingroup group_funcmacro_dialog */
//@{
/**
Pops up a directory selector dialog. The arguments have the same meaning
as those of wxDirDialog::wxDirDialog(). The message is displayed at the
top, and the default_path, if specified, is set as the initial selection.
The application must check for an empty return value (if the user pressed
Cancel). For example:
@code
const wxString& dir = wxDirSelector("Choose a folder");
if ( !dir.empty() )
{
...
}
@endcode
@header{wx/dirdlg.h}
*/
wxString wxDirSelector(const wxString& message = wxDirSelectorPromptStr,
const wxString& default_path = "",
long style = 0,
const wxPoint& pos = wxDefaultPosition,
wxWindow* parent = NULL);
//@}

128
interface/wx/display.h Normal file
View File

@@ -0,0 +1,128 @@
/////////////////////////////////////////////////////////////////////////////
// Name: display.h
// Purpose: interface of wxDisplay
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxDisplay
@wxheader{display.h}
Determines the sizes and locations of displays connected to the system.
@library{wxcore}
@category{misc}
@see wxClientDisplayRect(), wxDisplaySize(), wxDisplaySizeMM()
*/
class wxDisplay
{
public:
/**
Constructor, setting up a wxDisplay instance with the specified
display.
@param index
The index of the display to use. This must be non-negative and
lower than the value returned by GetCount().
*/
wxDisplay(unsigned index = 0);
/**
Destructor.
*/
~wxDisplay();
/**
Changes the video mode of this display to the mode specified in the
mode parameter.
If wxDefaultVideoMode is passed in as the mode parameter, the defined
behaviour is that wxDisplay will reset the video mode to the default
mode used by the display. On Windows, the behavior is normal. However,
there are differences on other platforms. On Unix variations using X11
extensions it should behave as defined, but some irregularities may
occur.
On wxMac passing in wxDefaultVideoMode as the mode parameter does
nothing. This happens because carbon no longer has access to
@c DMUseScreenPrefs(), an undocumented function that changed the video
mode to the system default by using the system's "scrn" resource.
*/
bool ChangeMode(const wxVideoMode& mode = wxDefaultVideoMode);
/**
Returns the client area of the display. The client area is the part of
the display available for the normal (non full screen) windows, usually
it is the same as GetGeometry() but it could be less if there is a
taskbar (or equivalent) on this display.
*/
wxRect GetClientArea() const;
/**
Returns the number of connected displays.
*/
static unsigned GetCount();
/**
Returns the current video mode that this display is in.
*/
wxVideoMode GetCurrentMode() const;
/**
Returns the bit depth of the display whose index was passed to the
constructor.
*/
int GetDepth() const;
/**
Returns the index of the display on which the given point lies, or
@c wxNOT_FOUND if the point is not on any connected display.
@param pt
The point to locate.
*/
static int GetFromPoint(const wxPoint& pt);
/**
Returns the index of the display on which the given window lies.
If the window is on more than one display it gets the display that
overlaps the window the most.
Returns @c wxNOT_FOUND if the window is not on any connected display.
@param win
The window to locate.
*/
static int GetFromWindow(const wxWindow* win);
/**
Returns the bounding rectangle of the display whose index was passed to
the constructor.
@see GetClientArea(), wxDisplaySize()
*/
wxRect GetGeometry() const;
/**
Fills and returns an array with all the video modes that are supported
by this display, or video modes that are supported by this display and
match the mode parameter (if mode is not wxDefaultVideoMode).
*/
wxArrayVideoModes GetModes(const wxVideoMode& mode = wxDefaultVideoMode) const;
/**
Returns the display's name. A name is not available on all platforms.
*/
wxString GetName() const;
/**
Returns @true if the display is the primary display. The primary
display is the one whose index is 0.
*/
bool IsPrimary();
};

359
interface/wx/dnd.h Normal file
View File

@@ -0,0 +1,359 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dnd.h
// Purpose: interface of wxDropSource and wx*DropTarget
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxTextDropTarget
@wxheader{dnd.h}
A predefined drop target for dealing with text data.
@library{wxcore}
@category{dnd}
@see @ref overview_dnd, wxDropSource, wxDropTarget, wxFileDropTarget
*/
class wxTextDropTarget : public wxDropTarget
{
public:
/**
Constructor.
*/
wxTextDropTarget();
/**
See wxDropTarget::OnDrop(). This function is implemented appropriately
for text, and calls OnDropText().
*/
virtual bool OnDrop(long x, long y, const void data, size_t size);
/**
Override this function to receive dropped text.
@param x
The x coordinate of the mouse.
@param y
The y coordinate of the mouse.
@param data
The data being dropped: a wxString.
Return @true to accept the data, or @false to veto the operation.
*/
virtual bool OnDropText(wxCoord x, wxCoord y, const wxString& data);
};
/**
Result returned from a 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).
};
/**
@class wxDropTarget
@wxheader{dnd.h}
This class represents a target for a drag and drop operation. A
wxDataObject can be associated with it and by default, this object will be
filled with the data from the drag source, if the data formats supported by
the data object match the drag source data format.
There are various virtual handler functions defined in this class which may
be overridden to give visual feedback or react in a more fine-tuned way,
e.g. by not accepting data on the whole window area, but only a small
portion of it. The normal sequence of calls is OnEnter(), OnDragOver()
possibly many times, OnDrop() and finally OnData().
@library{wxcore}
@category{dnd}
@see @ref overview_dnd, @ref overview_dataobject, wxDropSource,
wxTextDropTarget, wxFileDropTarget, wxDataFormat, wxDataObject
*/
class wxDropTarget
{
public:
/**
Constructor. @a data is the data to be associated with the drop target.
*/
wxDropTarget(wxDataObject* data = NULL);
/**
Destructor. Deletes the associated data object, if any.
*/
~wxDropTarget();
/**
This method may only be called from within OnData(). By default, this
method copies the data from the drop source to the wxDataObject
associated with this drop target, calling its wxDataObject::SetData()
method.
*/
virtual void GetData();
/**
Called after OnDrop() returns @true. By default this will usually
GetData() and will return the suggested default value @a def.
*/
virtual wxDragResult OnData(wxCoord x, wxCoord y, wxDragResult def);
/**
Called when the mouse is being dragged over the drop target. By
default, this calls functions return the suggested return value @a def.
@param x
The x coordinate of the mouse.
@param y
The y coordinate of the mouse.
@param def
Suggested value for return value. Determined by SHIFT or CONTROL
key states.
@return The desired operation or wxDragNone. This is used for optical
feedback from the side of the drop source, typically in form
of changing the icon.
*/
virtual wxDragResult OnDragOver(wxCoord x, wxCoord y, wxDragResult def);
/**
Called when the user drops a data object on the target. Return @false
to veto the operation.
@param x
The x coordinate of the mouse.
@param y
The y coordinate of the mouse.
@return @true to accept the data, or @false to veto the operation.
*/
virtual bool OnDrop(wxCoord x, wxCoord y);
/**
Called when the mouse enters the drop target. By default, this calls
OnDragOver().
@param x
The x coordinate of the mouse.
@param y
The y coordinate of the mouse.
@param def
Suggested default for return value. Determined by SHIFT or CONTROL
key states.
@return The desired operation or wxDragNone. This is used for optical
feedback from the side of the drop source, typically in form
of changing the icon.
*/
virtual wxDragResult OnEnter(wxCoord x, wxCoord y, wxDragResult def);
/**
Called when the mouse leaves the drop target.
*/
virtual void OnLeave();
/**
Sets the data wxDataObject associated with the drop target and deletes
any previously associated data object.
*/
void SetDataObject(wxDataObject* data);
};
/**
@class wxDropSource
@wxheader{dnd.h}
This class represents a source for a drag and drop operation.
@library{wxcore}
@category{dnd}
@see @ref overview_dnd, @ref overview_dataobject, wxDropTarget,
wxTextDropTarget, wxFileDropTarget
*/
class wxDropSource
{
public:
/**
This constructor requires that you must call SetData() later.
Note that the exact type of @a iconCopy and subsequent parameters
differs between wxMSW and wxGTK: these are cursors under Windows but
icons for GTK. You should use the macro wxDROP_ICON() in portable
programs instead of directly using either of these types.
@param win
The window which initiates the drag and drop operation.
@param iconCopy
The icon or cursor used for feedback for copy operation.
@param iconMove
The icon or cursor used for feedback for move operation.
@param iconNone
The icon or cursor used for feedback when operation can't be done.
*/
wxDropSource(wxWindow* win = NULL,
const wxIconOrCursor& iconCopy = wxNullIconOrCursor,
const wxIconOrCursor& iconMove = wxNullIconOrCursor,
const wxIconOrCursor& iconNone = wxNullIconOrCursor);
/**
Note that the exact type of @a iconCopy and subsequent parameters
differs between wxMSW and wxGTK: these are cursors under Windows but
icons for GTK. You should use the macro wxDROP_ICON() in portable
programs instead of directly using either of these types.
@param win
The window which initiates the drag and drop operation.
@param iconCopy
The icon or cursor used for feedback for copy operation.
@param iconMove
The icon or cursor used for feedback for move operation.
@param iconNone
The icon or cursor used for feedback when operation can't be done.
*/
wxDropSource(wxDataObject& data, wxWindow* win = NULL,
const wxIconOrCursor& iconCopy = wxNullIconOrCursor,
const wxIconOrCursor& iconMove = wxNullIconOrCursor,
const wxIconOrCursor& iconNone = wxNullIconOrCursor);
/**
Default constructor.
*/
~wxDropSource();
/**
Starts the drag-and-drop operation which will terminate when the user
releases the mouse. Call this in response to a mouse button press, for
example.
@param flags
If wxDrag_AllowMove is included in the flags, data may be moved and
not only copied (default). If wxDrag_DefaultMove is specified
(which includes the previous flag), this is even the default
operation.
@return The operation requested by the user, may be ::wxDragCopy,
::wxDragMove, ::wxDragLink, ::wxDragCancel or ::wxDragNone if
an error occurred.
*/
virtual wxDragResult DoDragDrop(int flags = wxDrag_CopyOnly);
/**
Returns the wxDataObject object that has been assigned previously.
*/
wxDataObject* GetDataObject();
/**
You may give some custom UI feedback during the drag and drop operation
by overriding this function. It is called on each mouse move, so your
implementation must not be too slow.
@param effect
The effect to implement. One of ::wxDragCopy, ::wxDragMove,
::wxDragLink and ::wxDragNone.
@param scrolling
@true if the window is scrolling. MSW only.
@return @false if you want default feedback, or @true if you implement
your own feedback. The return values is ignored under GTK.
*/
virtual bool GiveFeedback(wxDragResult effect);
/**
Set the icon to use for a certain drag result.
@param res
The drag result to set the icon for.
@param cursor
The ion to show when this drag result occurs.
*/
void SetCursor(wxDragResult res, const wxCursor& cursor);
/**
Sets the data wxDataObject associated with the drop source. This will
not delete any previously associated data.
*/
void SetData(wxDataObject& data);
};
/**
@class wxFileDropTarget
@wxheader{dnd.h}
This is a drop target which accepts files (dragged from File Manager or
Explorer).
@library{wxcore}
@category{dnd}
@see @ref overview_dnd, wxDropSource, wxDropTarget, wxTextDropTarget
*/
class wxFileDropTarget : public wxDropTarget
{
public:
/**
Constructor.
*/
wxFileDropTarget();
/**
See wxDropTarget::OnDrop(). This function is implemented appropriately
for files, and calls OnDropFiles().
*/
virtual bool OnDrop(long x, long y, const void data, size_t size);
/**
Override this function to receive dropped files.
@param x
The x coordinate of the mouse.
@param y
The y coordinate of the mouse.
@param filenames
An array of filenames.
Return @true to accept the data, or @false to veto the operation.
*/
virtual bool OnDropFiles(wxCoord x, wxCoord y,
const wxArrayString& filenames);
};
// ============================================================================
// Global functions/macros
// ============================================================================
/** @ingroup group_funcmacro_gdi */
//@{
/**
This macro creates either a cursor (MSW) or an icon (elsewhere) with the
given @a name (of type <tt>const char*</tt>). Under MSW, the cursor is
loaded from the resource file and the icon is loaded from XPM file under
other platforms.
This macro should be used with wxDropSource::wxDropSource().
@return wxCursor on MSW, otherwise returns a wxIcon
@header{wx/dnd.h}
*/
#define wxDROP_ICON(name)
//@}

149
interface/wx/docmdi.h Normal file
View File

@@ -0,0 +1,149 @@
/////////////////////////////////////////////////////////////////////////////
// Name: docmdi.h
// Purpose: interface of wxDocMDIParentFrame and wxDocMDIChildFrame
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxDocMDIParentFrame
@wxheader{docmdi.h}
The wxDocMDIParentFrame class provides a default top-level frame for
applications using the document/view framework. This class can only be used
for MDI parent frames.
It cooperates with the wxView, wxDocument, wxDocManager and wxDocTemplate
classes.
@library{wxcore}
@category{docview}
@see @ref overview_docview, @ref page_samples_docview, wxMDIParentFrame
*/
class wxDocMDIParentFrame : public wxMDIParentFrame
{
public:
//@{
/**
Constructor.
*/
wxDocMDIParentFrame();
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 = "frame");
//@}
/**
Destructor.
*/
~wxDocMDIParentFrame();
/**
Creates the window.
*/
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 = "frame");
/**
Deletes all views and documents. If no user input cancelled the
operation, the frame will be destroyed and the application will exit.
Since understanding how document/view clean-up takes place can be
difficult, the implementation of this function is shown below:
@code
void wxDocParentFrame::OnCloseWindow(wxCloseEvent& event)
{
if (m_docManager->Clear(!event.CanVeto()))
{
this->Destroy();
}
else
event.Veto();
}
@endcode
*/
void OnCloseWindow(wxCloseEvent& event);
};
/**
@class wxDocMDIChildFrame
@wxheader{docmdi.h}
The wxDocMDIChildFrame class provides a default frame for displaying
documents on separate windows. This class can only be used for MDI child
frames.
The class is part of the document/view framework supported by wxWidgets,
and cooperates with the wxView, wxDocument, wxDocManager and wxDocTemplate
classes.
@library{wxcore}
@category{docview}
@see @ref overview_docview, @ref page_samples_docview, wxMDIChildFrame
*/
class wxDocMDIChildFrame : public wxMDIChildFrame
{
public:
/**
Constructor.
*/
wxDocMDIChildFrame(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 = "frame");
/**
Destructor.
*/
~wxDocMDIChildFrame();
/**
Returns the document associated with this frame.
*/
wxDocument* GetDocument() const;
/**
Returns the view associated with this frame.
*/
wxView* GetView() const;
/**
Sets the currently active view to be the frame's view. You may need
to override (but still call) this function in order to set the keyboard
focus for your subwindow.
*/
void OnActivate(wxActivateEvent event);
/**
Closes and deletes the current view and document.
*/
void OnCloseWindow(wxCloseEvent& event);
/**
Sets the document for this frame.
*/
void SetDocument(wxDocument* doc);
/**
Sets the view for this frame.
*/
void SetView(wxView* view);
};

1475
interface/wx/docview.h Normal file

File diff suppressed because it is too large Load Diff

262
interface/wx/dragimag.h Normal file
View File

@@ -0,0 +1,262 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dragimag.h
// Purpose: interface of wxDragImage
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxDragImage
@wxheader{dragimag.h}
This class is used when you wish to drag an object on the screen, and a
simple cursor is not enough.
On Windows, the Win32 API is used to achieve smooth dragging. On other
platforms, wxGenericDragImage is used. Applications may also prefer to use
wxGenericDragImage on Windows, too.
@beginWxPythonOnly
wxPython uses wxGenericDragImage on all platforms, but uses the wxDragImage
name.
@endWxPythonOnly
To use this class, when you wish to start dragging an image, create a
wxDragImage object and store it somewhere you can access it as the drag
progresses. Call BeginDrag() to start, and EndDrag() to stop the drag. To
move the image, initially call Show() and then Move(). If you wish to
update the screen contents during the drag (for example, highlight an item
as in the dragimag sample), first call Hide(), update the screen, call
Move(), and then call Show().
You can drag within one window, or you can use full-screen dragging either
across the whole screen, or just restricted to one area of the screen to
save resources. If you want the user to drag between two windows, then you
will need to use full-screen dragging.
If you wish to draw the image yourself, use wxGenericDragImage and override
DoDrawImage() and GetImageRect().
@library{wxcore}
@category{dnd}
@see @ref page_samples_dragimag
*/
class wxDragImage : public wxObject
{
public:
/**
Default constructor.
*/
wxDragImage();
/**
Constructs a drag image from a bitmap and optional cursor.
@param image
Bitmap to be used as the drag image. The bitmap can have a mask.
@param cursor
Optional cursor to combine with the image.
@param cursorHotspot
This parameter is deprecated.
*/
wxDragImage(const wxBitmap& image, const wxCursor& cursor = wxNullCursor,
const wxPoint& cursorHotspot = wxPoint(0, 0));
/**
Constructs a drag image from an icon and optional cursor.
@param image
Icon to be used as the drag image.
@param cursor
Optional cursor to combine with the image.
@param cursorHotspot
This parameter is deprecated.
@beginWxPythonOnly
This constructor is called wxDragIcon in wxPython.
@endWxPythonOnly
*/
wxDragImage(const wxIcon& image, const wxCursor& cursor = wxNullCursor,
const wxPoint& cursorHotspot = wxPoint(0, 0));
/**
Constructs a drag image from a text string and optional cursor.
@param text
Text used to construct a drag image.
@param cursor
Optional cursor to combine with the image.
@param cursorHotspot
This parameter is deprecated.
@beginWxPythonOnly
This constructor is called wxDragString in wxPython.
@endWxPythonOnly
*/
wxDragImage(const wxString& text, const wxCursor& cursor = wxNullCursor,
const wxPoint& cursorHotspot = wxPoint(0, 0));
/**
Constructs a drag image from the text in the given tree control item,
and optional cursor.
@param treeCtrl
Tree control for constructing a tree drag image.
@param id
Tree control item id.
@beginWxPythonOnly
This constructor is called wxDragTreeItem in wxPython.
@endWxPythonOnly
*/
wxDragImage(const wxTreeCtrl& treeCtrl, wxTreeItemId& id);
/**
Constructs a drag image from the text in the given list control item,
and optional cursor.
@param listCtrl
List control for constructing a list drag image.
@param id
List control item id.
@beginWxPythonOnly
This constructor is called wxDragListItem in wxPython.
@endWxPythonOnly
*/
wxDragImage(const wxListCtrl& listCtrl, long id);
/**
Constructs a drag image an optional cursor. This constructor is only
available for wxGenericDragImage, and can be used when the application
supplies DoDrawImage() and GetImageRect().
@param cursor
Optional cursor to combine with the image.
@param cursorHotspot
This parameter is deprecated.
*/
wxDragImage(const wxCursor& cursor = wxNullCursor,
const wxPoint& cursorHotspot = wxPoint(0, 0));
/**
Start dragging the image, in a window or full screen.
You need to then call Show() and Move() to show the image on the
screen. Call EndDrag() when the drag has finished.
Note that this call automatically calls CaptureMouse().
@param hotspot
The location of the drag position relative to the upper-left corner
of the image.
@param window
The window that captures the mouse, and within which the dragging
is limited unless fullScreen is @true.
@param fullScreen
If @true, specifies that the drag will be visible over the full
screen, or over as much of the screen as is specified by rect. Note
that the mouse will still be captured in window.
@param rect
If non-@NULL, specifies the rectangle (in screen coordinates) that
bounds the dragging operation. Specifying this can make the
operation more efficient by cutting down on the area under
consideration, and it can also make a visual difference since the
drag is clipped to this area.
*/
bool BeginDrag(const wxPoint& hotspot, wxWindow* window,
bool fullScreen = false, wxRect* rect = NULL);
/**
Start dragging the image, using the first window to capture the mouse
and the second to specify the bounding area. This form is equivalent to
using the first form, but more convenient than working out the bounding
rectangle explicitly.
You need to then call Show() and Move() to show the image on the
screen. Call EndDrag() when the drag has finished.
Note that this call automatically calls CaptureMouse().
@param hotspot
The location of the drag position relative to the upper-left corner
of the image.
@param window
The window that captures the mouse, and within which the dragging
is limited.
@param boundingWindow
Specifies the area within which the drag occurs.
*/
bool BeginDrag(const wxPoint& hotspot, wxWindow* window,
wxWindow* boundingWindow);
/**
Draws the image on the device context with top-left corner at the given
position.
This function is only available with wxGenericDragImage, to allow
applications to draw their own image instead of using an actual bitmap.
If you override this function, you must also override GetImageRect().
*/
virtual bool DoDrawImage(wxDC& dc, const wxPoint& pos);
/**
Call this when the drag has finished.
@note This function automatically releases mouse capture.
*/
bool EndDrag();
/**
Returns the rectangle enclosing the image, assuming that the image is
drawn with its top-left corner at the given point.
This function is available in wxGenericDragImage only, and may be
overridden (together with DoDrawImage()) to provide a virtual drawing
capability.
*/
virtual wxRect GetImageRect(const wxPoint& pos) const;
/**
Hides the image. You may wish to call this before updating the window
contents (perhaps highlighting an item). Then call Move() and Show().
*/
bool Hide();
/**
Call this to move the image to a new position. The image will only be
shown if Show() has been called previously (for example at the start of
the drag).
@param pt
The position in client coordinates (relative to the window
specified in BeginDrag()).
You can move the image either when the image is hidden or shown, but in
general dragging will be smoother if you move the image when it is
shown.
*/
bool Move(const wxPoint& pt);
/**
Shows the image. Call this at least once when dragging.
*/
bool Show();
/**
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 updated window itself just before dragging,
which can cause a flicker just as the drag starts. Instead, paint the
drag image's backing bitmap to show the appropriate graphic @e minus
the objects to be dragged, and leave the window itself to be updated by
the drag image. This can provide eerily smooth, flicker-free drag
behaviour.
The default implementation copies the window contents to the backing
bitmap. A new implementation will normally copy information from
another source, such as from its own backing bitmap if it has one, or
directly from internal data structures.
This function is available in wxGenericDragImage only.
*/
bool UpdateBackingFromWindow(wxDC& windowDC, wxMemoryDC& destDC,
const wxRect& sourceRect,
const wxRect& destRect) const;
};

772
interface/wx/dynarray.h Normal file
View File

@@ -0,0 +1,772 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dynarray.h
// Purpose: interface of wxArray<T>
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@wxheader{dynarray.h}
This section describes the so called @e "dynamic arrays". This is a C
array-like type safe data structure i.e. the member access time is constant
(and not linear according to the number of container elements as for linked
lists). However, these arrays are dynamic in the sense that they will
automatically allocate more memory if there is not enough of it for adding
a new element. They also perform range checking on the index values but in
debug mode only, so please be sure to compile your application in debug
mode to use it (see @ref overview_debugging for details). So, unlike the
arrays in some other languages, attempt to access an element beyond the
arrays bound doesn't automatically expand the array but provokes an
assertion failure instead in debug build and does nothing (except possibly
crashing your program) in the release build.
The array classes were designed to be reasonably efficient, both in terms
of run-time speed and memory consumption and the executable size. The speed
of array item access is, of course, constant (independent of the number of
elements) making them much more efficient than linked lists (wxList).
Adding items to the arrays is also implemented in more or less constant
time, but the price is preallocating the memory in advance. In the
"memory management" function section, you may find some useful hints about
optimizing wxArray memory usage. As for executable size, all wxArray
functions are inline, so they do not take @e any space at all.
wxWidgets has three different kinds of array. All of them derive from
wxBaseArray class which works with untyped data and can not be used
directly. The standard macros WX_DEFINE_ARRAY(), WX_DEFINE_SORTED_ARRAY()
and WX_DEFINE_OBJARRAY() are used to define a new class deriving from it.
The classes declared will be called in this documentation wxArray,
wxSortedArray and wxObjArray but you should keep in mind that no classes
with such names actually exist, each time you use one of the
WX_DEFINE_XXXARRAY() macros, you define a class with a new name. In fact,
these names are "template" names and each usage of one of the macros
mentioned above creates a template specialization for the given element
type.
wxArray is suitable for storing integer types and pointers which it does
not treat as objects in any way, i.e. the element pointed to by the pointer
is not deleted when the element is removed from the array. It should be
noted that all of wxArray's functions are inline, so it costs strictly
nothing to define as many array types as you want (either in terms of the
executable size or the speed) as long as at least one of them is defined
and this is always the case because wxArrays are used by wxWidgets
internally. This class has one serious limitation: it can only be used for
storing integral types (bool, char, short, int, long and their unsigned
variants) or pointers (of any kind). An attempt to use with objects of
@c sizeof() greater than @c sizeof(long) will provoke a runtime assertion
failure, however declaring a wxArray of floats will not (on the machines
where @c "sizeof(float) <= sizeof(long)"), yet it will @b not work, please
use wxObjArray for storing floats and doubles.
wxSortedArray is a wxArray variant which should be used when searching in
the array is a frequently used operation. It requires you to define an
additional function for comparing two elements of the array element type
and always stores its items in the sorted order (according to this
function). Thus, its Index() function execution time is @c "O(log(N))"
instead of @c "O(N)" for the usual arrays but the Add() method is slower:
it is @c "O(log(N))" instead of constant time (neglecting time spent in
memory allocation routine). However, in a usual situation elements are
added to an array much less often than searched inside it, so wxSortedArray
may lead to huge performance improvements compared to wxArray. Finally, it
should be noticed that, as wxArray, wxSortedArray can be only used for
storing integral types or pointers.
wxObjArray class treats its elements like "objects". It may delete them
when they are removed from the array (invoking the correct destructor) and
copies them using the objects copy constructor. In order to implement this
behaviour the definition of the wxObjArray arrays is split in two parts:
first, you should declare the new wxObjArray class using the
WX_DECLARE_OBJARRAY() macro and then you must include the file defining the
implementation of template type: @<wx/arrimpl.cpp@> and define the array
class with the WX_DEFINE_OBJARRAY() macro from a point where the full (as
opposed to 'forward') declaration of the array elements class is in scope.
As it probably sounds very complicated here is an example:
@code
#include <wx/dynarray.h>
// We must forward declare the array because it is used
// inside the class declaration.
class MyDirectory;
class MyFile;
// This defines two new types: ArrayOfDirectories and ArrayOfFiles which
// can be now used as shown below.
WX_DECLARE_OBJARRAY(MyDirectory, ArrayOfDirectories);
WX_DECLARE_OBJARRAY(MyFile, ArrayOfFiles);
class MyDirectory
{
// ...
ArrayOfDirectories m_subdirectories; // All subdirectories
ArrayOfFiles m_files; // All files in this directory
};
// ...
// Now that we have MyDirectory declaration in scope we may finish the
// definition of ArrayOfDirectories -- note that this expands into some C++
// code and so should only be compiled once (i.e., don't put this in the
// header, but into a source file or you will get linking errors)
#include <wx/arrimpl.cpp> // This is a magic incantation which must be done!
WX_DEFINE_OBJARRAY(ArrayOfDirectories);
// that's all!
@endcode
It is not as elegant as writing this:
@code
typedef std::vector<MyDirectory> ArrayOfDirectories;
@endcode
But is not that complicated and allows the code to be compiled with any,
however dumb, C++ compiler in the world.
Remember to include @<wx/arrimpl.cpp@> just before each
WX_DEFINE_OBJARRAY() ocurrence in your code, even if you have several in
the same file.
Things are much simpler for wxArray and wxSortedArray however: it is enough
just to write:
@code
WX_DEFINE_ARRAY_INT(int, ArrayOfInts);
WX_DEFINE_SORTED_ARRAY_INT(int, ArrayOfSortedInts);
@endcode
There is only one @c DEFINE macro and no need for separate @c DECLARE one.
For the arrays of the primitive types, the macros
@c WX_DEFINE_ARRAY_CHAR/SHORT/INT/SIZE_T/LONG/DOUBLE should be used
depending on the sizeof of the values (notice that storing values of
smaller type, e.g. shorts, in an array of larger one, e.g. @c ARRAY_INT,
does not work on all architectures!).
@section array_macros Macros for Template Array Definition
To use an array you must first define the array class. This is done with
the help of the macros in this section. The class of array elements must be
(at least) forward declared for WX_DEFINE_ARRAY(), WX_DEFINE_SORTED_ARRAY()
and WX_DECLARE_OBJARRAY() macros and must be fully declared before you use
WX_DEFINE_OBJARRAY() macro.
- WX_DEFINE_ARRAY()
- WX_DEFINE_EXPORTED_ARRAY()
- WX_DEFINE_USER_EXPORTED_ARRAY()
- WX_DEFINE_SORTED_ARRAY()
- WX_DEFINE_SORTED_EXPORTED_ARRAY()
- WX_DEFINE_SORTED_USER_EXPORTED_ARRAY()
- WX_DECLARE_EXPORTED_OBJARRAY()
- WX_DECLARE_USER_EXPORTED_OBJARRAY()
- WX_DEFINE_OBJARRAY()
- WX_DEFINE_EXPORTED_OBJARRAY()
- WX_DEFINE_USER_EXPORTED_OBJARRAY()
To slightly complicate the matters even further, the operator "->" defined
by default for the array iterators by these macros only makes sense if the
array element type is not a pointer itself and, although it still works,
this provokes warnings from some compilers and to avoid them you should use
the @c _PTR versions of the macros above. For example, to define an array
of pointers to @c double you should use:
@code
WX_DEFINE_ARRAY_PTR(double *, MyArrayOfDoublePointers);
@endcode
Note that the above macros are generally only useful for wxObject types.
There are separate macros for declaring an array of a simple type, such as
an int.
The following simple types are supported:
- @c int
- @c long
- @c size_t
- @c double
To create an array of a simple type, simply append the type you want in
CAPS to the array definition.
For example, you'd use one of the following variants for an integer array:
- WX_DEFINE_ARRAY_INT()
- WX_DEFINE_EXPORTED_ARRAY_INT()
- WX_DEFINE_USER_EXPORTED_ARRAY_INT()
- WX_DEFINE_SORTED_ARRAY_INT()
- WX_DEFINE_SORTED_EXPORTED_ARRAY_INT()
- WX_DEFINE_SORTED_USER_EXPORTED_ARRAY_INT()
@library{wxbase}
@category{containers}
@see @ref overview_container, wxList<T>, wxVector<T>
*/
class wxArray<T>
{
public:
/**
@name Constructors and Destructors
Array classes are 100% C++ objects and as such they have the
appropriate copy constructors and assignment operators. Copying wxArray
just copies the elements but copying wxObjArray copies the arrays
items. However, for memory-efficiency sake, neither of these classes
has virtual destructor. It is not very important for wxArray which has
trivial destructor anyhow, but it does mean that you should avoid
deleting wxObjArray through a wxBaseArray pointer (as you would never
use wxBaseArray anyhow it shouldn't be a problem) and that you should
not derive your own classes from the array classes.
*/
//@{
/**
Default constructor.
*/
wxArray();
/**
Default constructor initializes an empty array object.
*/
wxObjArray();
/**
There is no default constructor for wxSortedArray classes - you must
initialize it with a function to use for item comparison. It is a
function which is passed two arguments of type @c T where @c T is the
array element type and which should return a negative, zero or positive
value according to whether the first element passed to it is less than,
equal to or greater than the second one.
*/
wxSortedArray(int (*)(T first, T second)compareFunction);
/**
Performs a shallow array copy (i.e. doesn't copy the objects pointed to
even if the source array contains the items of pointer type).
*/
wxArray(const wxArray& array);
/**
Performs a shallow array copy (i.e. doesn't copy the objects pointed to
even if the source array contains the items of pointer type).
*/
wxSortedArray(const wxSortedArray& array);
/**
Performs a deep copy (i.e. the array element are copied too).
*/
wxObjArray(const wxObjArray& array);
/**
Performs a shallow array copy (i.e. doesn't copy the objects pointed to
even if the source array contains the items of pointer type).
*/
wxArray& operator=(const wxArray& array);
/**
Performs a shallow array copy (i.e. doesn't copy the objects pointed to
even if the source array contains the items of pointer type).
*/
wxSortedArray& operator=(const wxSortedArray& array);
/**
Performs a deep copy (i.e. the array element are copied too).
*/
wxObjArray& operator=(const wxObjArray& array);
/**
This destructor does not delete all the items owned by the array, you
may use the WX_CLEAR_ARRAY() macro for this.
*/
~wxArray();
/**
This destructor does not delete all the items owned by the array, you
may use the WX_CLEAR_ARRAY() macro for this.
*/
~wxSortedArray();
/**
This destructor deletes all the items owned by the array.
*/
~wxObjArray();
//@}
/**
@name Memory Management
Automatic array memory management is quite trivial: the array starts by
preallocating some minimal amount of memory (defined by
@c WX_ARRAY_DEFAULT_INITIAL_SIZE) and when further new items exhaust
already allocated memory it reallocates it adding 50% of the currently
allocated amount, but no more than some maximal number which is defined
by the @c ARRAY_MAXSIZE_INCREMENT constant. Of course, this may lead to
some memory being wasted (@c ARRAY_MAXSIZE_INCREMENT in the worst case,
i.e. 4Kb in the current implementation), so the Shrink() function is
provided to deallocate the extra memory. The Alloc() function can also
be quite useful if you know in advance how many items you are going to
put in the array and will prevent the array code from reallocating the
memory more times than needed.
*/
//@{
/**
Preallocates memory for a given number of array elements. It is worth
calling when the number of items which are going to be added to the
array is known in advance because it will save unneeded memory
reallocation. If the array already has enough memory for the given
number of items, nothing happens. In any case, the existing contents of
the array is not modified.
*/
void Alloc(size_t count);
/**
Frees all memory unused by the array. If the program knows that no new
items will be added to the array it may call Shrink() to reduce its
memory usage. However, if a new item is added to the array, some extra
memory will be allocated again.
*/
void Shrink();
//@}
/**
@name Number of Elements and Simple Item Access
Functions in this section return the total number of array elements and
allow to retrieve them - possibly using just the C array indexing []
operator which does exactly the same as the Item() method.
*/
//@{
/**
Return the number of items in the array.
*/
size_t GetCount() const;
/**
Returns @true if the array is empty, @false otherwise.
*/
bool IsEmpty() const;
/**
Returns the item at the given position in the array. If @a index is out
of bounds, an assert failure is raised in the debug builds but nothing
special is done in the release build.
The returned value is of type "reference to the array element type" for
all of the array classes.
*/
T& Item(size_t index) const;
/**
Returns the last element in the array, i.e. is the same as calling
"Item(GetCount() - 1)". An assert failure is raised in the debug mode
if the array is empty.
The returned value is of type "reference to the array element type" for
all of the array classes.
*/
T& Last() const;
//@}
/**
@name Adding Items
*/
//@{
/**
Appends the given number of @a copies of the @a item to the array
consisting of the elements of type @c T.
This version is used with wxArray.
You may also use WX_APPEND_ARRAY() macro to append all elements of one
array to another one but it is more efficient to use the @a copies
parameter and modify the elements in place later if you plan to append
a lot of items.
*/
void Add(T item, size_t copies = 1);
/**
Appends the @a item to the array consisting of the elements of type
@c T.
This version is used with wxSortedArray, returning the index where
@a item is stored.
*/
size_t Add(T item);
/**
Appends the @a item to the array consisting of the elements of type
@c T.
This version is used with wxObjArray. The array will take ownership of
the @item, deleting it when the item is deleted from the array. Note
that you cannot append more than one pointer as reusing it would lead
to deleting it twice (or more) resulting in a crash.
You may also use WX_APPEND_ARRAY() macro to append all elements of one
array to another one but it is more efficient to use the @a copies
parameter and modify the elements in place later if you plan to append
a lot of items.
*/
void Add(T* item);
/**
Appends the given number of @a copies of the @a item to the array
consisting of the elements of type @c T.
This version is used with wxObjArray. The array will make a copy of the
item and will not take ownership of the original item.
You may also use WX_APPEND_ARRAY() macro to append all elements of one
array to another one but it is more efficient to use the @a copies
parameter and modify the elements in place later if you plan to append
a lot of items.
*/
void Add(T& item, size_t copies = 1);
/**
Inserts the given @a item into the array in the specified @e index
position.
Be aware that you will set out the order of the array if you give a
wrong position.
This function is useful in conjunction with IndexForInsert() for a
common operation of "insert only if not found".
*/
void AddAt(T item, size_t index);
/**
Insert the given number of @a copies of the @a item into the array
before the existing item @a n - thus, @e Insert(something, 0u) will
insert an item in such way that it will become the first array element.
wxSortedArray doesn't have this function because inserting in wrong
place would break its sorted condition.
Please see Add() for an explanation of the differences between the
overloaded versions of this function.
*/
void Insert(T item, size_t n, size_t copies = 1);
/**
Insert the @a item into the array before the existing item @a n - thus,
@e Insert(something, 0u) will insert an item in such way that it will
become the first array element.
wxSortedArray doesn't have this function because inserting in wrong
place would break its sorted condition.
Please see Add() for an explanation of the differences between the
overloaded versions of this function.
*/
void Insert(T* item, size_t n);
/**
Insert the given number of @a copies of the @a item into the array
before the existing item @a n - thus, @e Insert(something, 0u) will
insert an item in such way that it will become the first array element.
wxSortedArray doesn't have this function because inserting in wrong
place would break its sorted condition.
Please see Add() for an explanation of the differences between the
overloaded versions of this function.
*/
void Insert(T& item, size_t n, size_t copies = 1);
/**
This function ensures that the number of array elements is at least
@a count. If the array has already @a count or more items, nothing is
done. Otherwise, @a count - GetCount() elements are added and
initialized to the value @a defval.
@see GetCount()
*/
void SetCount(size_t count, T defval = T(0));
//@}
/**
@name Removing Items
*/
//@{
/**
This function does the same as Empty() and additionally frees the
memory allocated to the array.
*/
void Clear();
/**
Removes the element from the array, but unlike Remove(), it doesn't
delete it. The function returns the pointer to the removed element.
*/
T* Detach(size_t index);
/**
Empties the array. For wxObjArray classes, this destroys all of the
array elements. For wxArray and wxSortedArray this does nothing except
marking the array of being empty - this function does not free the
allocated memory, use Clear() for this.
*/
void Empty();
/**
Removes an element from the array by value: the first item of the array
equal to @a item is removed, an assert failure will result from an
attempt to remove an item which doesn't exist in the array.
When an element is removed from wxObjArray it is deleted by the array -
use Detach() if you don't want this to happen. On the other hand, when
an object is removed from a wxArray nothing happens - you should delete
it manually if required:
@code
T *item = array[n];
delete item;
array.Remove(n);
@endcode
See also WX_CLEAR_ARRAY() macro which deletes all elements of a wxArray
(supposed to contain pointers).
*/
Remove(T item);
/**
Removes @a count elements starting at @a index from the array. When an
element is removed from wxObjArray it is deleted by the array - use
Detach() if you don't want this to happen. On the other hand, when an
object is removed from a wxArray nothing happens - you should delete it
manually if required:
@code
T *item = array[n];
delete item;
array.RemoveAt(n);
@endcode
See also WX_CLEAR_ARRAY() macro which deletes all elements of a wxArray
(supposed to contain pointers).
*/
RemoveAt(size_t index, size_t count = 1);
//@}
/**
@name Searching and Sorting
*/
//@{
/**
This version of Index() is for wxArray and wxObjArray only.
Searches the element in the array, starting from either beginning or
the end depending on the value of @a searchFromEnd parameter.
@c wxNOT_FOUND is returned if the element is not found, otherwise the
index of the element is returned.
@note Even for wxObjArray classes, the operator "==" of the elements in
the array is @b not used by this function. It searches exactly
the given element in the array and so will only succeed if this
element had been previously added to the array, but fail even if
another, identical, element is in the array.
*/
int Index(T& item, bool searchFromEnd = false) const;
/**
This version of Index() is for wxSortedArray only.
Searches the element in the array, starting from either beginning or
the end depending on the value of @a searchFromEnd parameter.
@c wxNOT_FOUND is returned if the element is not found, otherwise the
index of the element is returned.
*/
const int Index(T& item) const;
/**
Search for a place to insert @a item into the sorted array (binary
search). The index returned is just before the first existing item that
is greater or equal (according to the compare function) to the given
@a item.
You have to do extra work to know if the @a item already exists in
array.
This function is useful in conjunction with AddAt() for a common
operation of "insert only if not found".
*/
size_t IndexForInsert(T item) const;
/**
The notation @c "CMPFUNCT<T>" should be read as if we had the following
declaration:
@code
template int CMPFUNC(T *first, T *second);
@endcode
Where @e T is the type of the array elements. I.e. it is a function
returning @e int which is passed two arguments of type @e T*.
Sorts the array using the specified compare function: this function
should return a negative, zero or positive value according to whether
the first element passed to it is less than, equal to or greater than
the second one.
wxSortedArray doesn't have this function because it is always sorted.
*/
void Sort(CMPFUNC<T> compareFunction);
//@}
};
/**
This macro may be used to append all elements of the @a other array to the
@a array. The two arrays must be of the same type.
*/
#define WX_APPEND_ARRAY(wxArray& array, wxArray& other)
/**
This macro may be used to delete all elements of the array before emptying
it. It can not be used with wxObjArrays - but they will delete their
elements anyway when you call Empty().
*/
#define WX_CLEAR_ARRAY(wxArray& array)
//@{
/**
This macro declares a new object array class named @a name and containing
the elements of type @e T.
An exported array is used when compiling wxWidgets as a DLL under Windows
and the array needs to be visible outside the DLL. An user exported array
needed for exporting an array from a user DLL.
Example:
@code
class MyClass;
WX_DECLARE_OBJARRAY(MyClass, wxArrayOfMyClass); // note: not "MyClass *"!
@endcode
You must use WX_DEFINE_OBJARRAY() macro to define the array class,
otherwise you would get link errors.
*/
#define WX_DECLARE_OBJARRAY(T, name)
#define WX_DECLARE_EXPORTED_OBJARRAY(T, name)
#define WX_DECLARE_USER_EXPORTED_OBJARRAY(T, name)
//@}
//@{
/**
This macro defines a new array class named @a name and containing the
elements of type @a T.
An exported array is used when compiling wxWidgets as a DLL under Windows
and the array needs to be visible outside the DLL. An user exported array
needed for exporting an array from a user DLL.
Example:
@code
WX_DEFINE_ARRAY_INT(int, MyArrayInt);
class MyClass;
WX_DEFINE_ARRAY(MyClass *, ArrayOfMyClass);
@endcode
Note that wxWidgets predefines the following standard array classes:
@b wxArrayInt, @b wxArrayLong, @b wxArrayShort, @b wxArrayDouble,
@b wxArrayPtrVoid.
*/
#define WX_DEFINE_ARRAY(T, name)
#define WX_DEFINE_EXPORTED_ARRAY(T, name)
#define WX_DEFINE_USER_EXPORTED_ARRAY(T, name, exportspec)
//@}
//@{
/**
This macro defines the methods of the array class @a name not defined by
the WX_DECLARE_OBJARRAY() macro. You must include the file
@<wx/arrimpl.cpp@> before using this macro and you must have the full
declaration of the class of array elements in scope! If you forget to do
the first, the error will be caught by the compiler, but, unfortunately,
many compilers will not give any warnings if you forget to do the second -
but the objects of the class will not be copied correctly and their real
destructor will not be called.
An exported array is used when compiling wxWidgets as a DLL under Windows
and the array needs to be visible outside the DLL. An user exported array
needed for exporting an array from a user DLL.
Example of usage:
@code
// first declare the class!
class MyClass
{
public:
MyClass(const MyClass&);
// ...
virtual ~MyClass();
};
#include <wx/arrimpl.cpp>
WX_DEFINE_OBJARRAY(wxArrayOfMyClass);
@endcode
*/
#define WX_DEFINE_OBJARRAY(name)
#define WX_DEFINE_EXPORTED_OBJARRAY(name)
#define WX_DEFINE_USER_EXPORTED_OBJARRAY(name)
//@}
//@{
/**
This macro defines a new sorted array class named @a name and containing
the elements of type @e T.
An exported array is used when compiling wxWidgets as a DLL under Windows
and the array needs to be visible outside the DLL. An user exported array
needed for exporting an array from a user DLL.
Example:
@code
WX_DEFINE_SORTED_ARRAY_INT(int, MySortedArrayInt);
class MyClass;
WX_DEFINE_SORTED_ARRAY(MyClass *, ArrayOfMyClass);
@endcode
You will have to initialize the objects of this class by passing a
comparison function to the array object constructor like this:
@code
int CompareInts(int n1, int n2)
{
return n1 - n2;
}
MySortedArrayInt sorted(CompareInts);
int CompareMyClassObjects(MyClass *item1, MyClass *item2)
{
// sort the items by their address...
return Stricmp(item1->GetAddress(), item2->GetAddress());
}
ArrayOfMyClass another(CompareMyClassObjects);
@endcode
*/
#define WX_DEFINE_SORTED_ARRAY(T, name)
#define WX_DEFINE_SORTED_EXPORTED_ARRAY(T, name)
#define WX_DEFINE_SORTED_USER_EXPORTED_ARRAY(T, name)
//@}
/**
This macro may be used to prepend all elements of the @a other array to the
@a array. The two arrays must be of the same type.
*/
#define WX_PREPEND_ARRAY(wxArray& array, wxArray& other)

259
interface/wx/dynlib.h Normal file
View File

@@ -0,0 +1,259 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dynlib.h
// Purpose: interface of wxDynamicLibrary and wxDynamicLibraryDetails
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxDynamicLibraryDetails
@wxheader{dynlib.h}
This class is used for the objects returned by the
wxDynamicLibrary::ListLoaded() method and contains the information about a
single module loaded into the address space of the current process. A
module in this context may be either a dynamic library or the main program
itself.
@library{wxbase}
@category{appmanagement}
*/
class wxDynamicLibraryDetails
{
public:
/**
Retrieves the load address and the size of this module.
@param addr
The pointer to the location to return load address in, may be
@NULL.
@param len
Pointer to the location to return the size of this module in
memory in, may be @NULL.
@return @true if the load address and module size were retrieved,
@false if this information is not available.
*/
bool GetAddress(void** addr, size_t len) const;
/**
Returns the base name of this module, e.g. @c "kernel32.dll" or
@c "libc-2.3.2.so".
*/
wxString GetName() const;
/**
Returns the full path of this module if available, e.g.
@c "c:\windows\system32\kernel32.dll" or @c "/lib/libc-2.3.2.so".
*/
wxString GetPath() const;
/**
Returns the version of this module, e.g. @c "5.2.3790.0" or @c "2.3.2".
The returned string is empty if the version information is not
available.
*/
wxString GetVersion() const;
};
/**
Dynamic library category used with wxDynamicLibrary::CanonicalizeName().
*/
enum wxDynamicLibraryCategory
{
wxDL_LIBRARY, ///< Standard library.
wxDL_MODULE ///< Loadable module/plugin.
};
/**
Dynamic library plugin category used with
wxDynamicLibrary::CanonicalizePluginName().
*/
enum wxPluginCategory
{
wxDL_PLUGIN_GUI, ///< Plugin that uses GUI classes.
wxDL_PLUGIN_BASE ///< wxBase-only plugin.
};
/**
@class wxDynamicLibrary
@wxheader{dynlib.h}
wxDynamicLibrary is a class representing dynamically loadable library
(Windows DLL, shared library under Unix etc.). Just create an object of
this class to load a library and don't worry about unloading it -- it will
be done in the objects destructor automatically.
The following flags can be used with wxDynamicLibrary() or Load():
@beginStyleTable
@style{wxDL_LAZY}
Equivalent of RTLD_LAZY under Unix, ignored elsewhere.
@style{wxDL_NOW}
Equivalent of RTLD_NOW under Unix, ignored elsewhere.
@style{wxDL_GLOBAL}
Equivalent of RTLD_GLOBAL under Unix, ignored elsewhere.
@style{wxDL_VERBATIM}
Don't try to append the appropriate extension to the library name
(this is done by default).
@style{wxDL_DEFAULT}
Default flags, same as wxDL_NOW currently.
@style{wxDL_QUIET}
Don't log an error message if the library couldn't be loaded.
@endStyleTable
@library{wxbase}
@category{appmanagement}
*/
class wxDynamicLibrary
{
public:
/**
Default constructor.
*/
wxDynamicLibrary();
/**
Constructor. Calls Load() with the given @a name.
*/
wxDynamicLibrary(const wxString& name, int flags = wxDL_DEFAULT);
/**
Returns the platform-specific full name for the library called @a name.
E.g. it adds a @c ".dll" extension under Windows and @c "lib" prefix
and @c ".so", @c ".sl" or @c ".dylib" extension under Unix.
@see CanonicalizePluginName()
*/
static wxString CanonicalizeName(const wxString& name,
wxDynamicLibraryCategory cat = wxDL_LIBRARY);
/**
This function does the same thing as CanonicalizeName() but for
wxWidgets plugins. The only difference is that compiler and version
information are added to the name to ensure that the plugin which is
going to be loaded will be compatible with the main program.
*/
static wxString CanonicalizePluginName(const wxString& name,
wxPluginCategory cat = wxDL_PLUGIN_GUI);
/**
Detaches this object from its library handle, i.e. the object will not
unload the library any longer in its destructor but it is now the
callers responsibility to do this using Unload().
*/
wxDllType Detach();
/**
Return a valid handle for the main program itself or @NULL if symbols
from the main program can't be loaded on this platform.
*/
static wxDllType GetProgramHandle();
/**
Returns pointer to symbol @a name in the library or @NULL if the
library contains no such symbol.
@see wxDYNLIB_FUNCTION()
*/
void* GetSymbol(const wxString& name) const;
/**
This function is available only under Windows as it is only useful when
dynamically loading symbols from standard Windows DLLs. Such functions
have either @c 'A' (in ANSI build) or @c 'W' (in Unicode, or wide
character build) suffix if they take string parameters. Using this
function, you can use just the base name of the function and the
correct suffix is appended automatically depending on the current
build. Otherwise, this method is identical to GetSymbol().
*/
void* GetSymbolAorW(const wxString& name) const;
/**
Returns @true if the symbol with the given @a name is present in the
dynamic library, @false otherwise. Unlike GetSymbol(), this function
doesn't log an error message if the symbol is not found.
@since 2.5.4
*/
bool HasSymbol(const wxString& name) const;
/**
Returns @true if the library was successfully loaded, @false otherwise.
*/
bool IsLoaded() const;
/**
This static method returns a wxArray containing the details of all
modules loaded into the address space of the current project. The array
elements are objects of the type: wxDynamicLibraryDetails. The array
will be empty if an error occurred.
This method is currently implemented only under Win32 and Linux and is
useful mostly for diagnostics purposes.
*/
static wxDynamicLibraryDetailsArray ListLoaded();
/**
Loads DLL with the given @a name into memory. The @a flags argument can
be a combination of the styles outlined in the class description.
Returns @true if the library was successfully loaded, @false otherwise.
*/
bool Load(const wxString& name, int flags = wxDL_DEFAULT);
/**
Unloads the library from memory. wxDynamicLibrary object automatically
calls this method from its destructor if it had been successfully
loaded.
*/
void Unload();
/**
Unloads the library from memory. wxDynamicLibrary object automatically
calls this method from its destructor if it had been successfully
loaded.
This version of Unload() is only used if you need to keep the library
in memory during a longer period of time than the scope of the
wxDynamicLibrary object. In this case you may call Detach() and store
the handle somewhere and call this static method later to unload it.
*/
static void Unload(wxDllType handle);
};
// ============================================================================
// Global functions/macros
// ============================================================================
/** @ingroup group_funcmacro_misc */
//@{
/**
When loading a function from a DLL you always have to cast the returned
<tt>void *</tt> 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 named after the function but with @c pfn prefix and initialized with
the function @a name from the wxDynamicLibrary @a dynlib.
@param type
The type of the function.
@param name
The name of the function to load, not a string (without quotes, it is
quoted automatically by the macro).
@param dynlib
The library to load the function from.
@header{wx/dynlib.h}
*/
#define wxDYNLIB_FUNCTION(type, name, dynlib)
//@}

98
interface/wx/editlbox.h Normal file
View File

@@ -0,0 +1,98 @@
/////////////////////////////////////////////////////////////////////////////
// Name: editlbox.h
// Purpose: interface of wxEditableListBox
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxEditableListBox
@wxheader{editlbox.h}
An editable listbox is composite control that lets the user easily enter,
delete and reorder a list of strings.
@beginStyleTable
@style{wxEL_ALLOW_NEW}
Allows the user to enter new strings.
@style{wxEL_ALLOW_EDIT}
Allows the user to edit existing strings.
@style{wxEL_ALLOW_DELETE}
Allows the user to delete existing strings.
@style{wxEL_NO_REORDER}
Does not allow the user to reorder the strings.
@style{wxEL_DEFAULT_STYLE}
Default style: wxEL_ALLOW_NEW|wxEL_ALLOW_EDIT|wxEL_ALLOW_DELETE.
@endStyleTable
@library{wxadv}
@category{ctrl}
@see wxListBox
*/
class wxEditableListBox : public wxPanel
{
public:
/**
Default ctor.
*/
wxEditableListBox();
/**
Constructor, creating and showing a list box.
@param parent
Parent window. Must not be @NULL.
@param id
Window identifier. The value wxID_ANY indicates a default value.
@param label
The text shown just before the list control.
@param pos
Window position.
@param size
Window size. If wxDefaultSize is specified then the window is sized
appropriately.
@param style
Window style. See wxEditableListBox.
@param name
Window name.
@see Create()
*/
wxEditableListBox(wxWindow* parent, wxWindowID id,
const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxEL_DEFAULT_STYLE,
const wxString& name = "editableListBox");
/**
Destructor, destroying the list box.
*/
~wxEditableListBox();
/**
Creates the editable listbox for two-step construction.
See wxEditableListBox() for further details.
*/
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 = "editableListBox");
/**
Replaces current contents with given strings.
*/
void SetStrings(const wxArrayString& strings);
/**
Returns in the given array the current contents of the control
(the array will be erased before control's contents are appended).
*/
void GetSelections(wxArrayString& strings) const;
};

187
interface/wx/encconv.h Normal file
View File

@@ -0,0 +1,187 @@
/////////////////////////////////////////////////////////////////////////////
// Name: encconv.h
// Purpose: interface of wxEncodingConverter
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxEncodingConverter
@wxheader{encconv.h}
This class is capable of converting strings between two 8-bit encodings/charsets.
It can also convert from/to Unicode (but only if you compiled wxWidgets
with wxUSE_WCHAR_T set to 1).
Only a limited subset of encodings is supported by wxEncodingConverter:
@c wxFONTENCODING_ISO8859_1..15, @c wxFONTENCODING_CP1250..1257 and
@c wxFONTENCODING_KOI8.
@note
Please use wxMBConv classes instead if possible. wxCSConv has much better
support for various encodings than wxEncodingConverter.
wxEncodingConverter is useful only if you rely on wxCONVERT_SUBSTITUTE mode
of operation (see wxEncodingConverter::Init()).
@library{wxbase}
@category{misc}
@see wxFontMapper, wxMBConv, @ref overview_nonenglish
*/
class wxEncodingConverter : public wxObject
{
public:
/**
Constructor.
*/
wxEncodingConverter();
/**
Return @true if (any text in) multibyte encoding @a encIn can be converted to
another one (@a encOut) losslessly.
Do not call this method with @c wxFONTENCODING_UNICODE as either parameter,
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);
/**
@name Conversion functions
@{
*/
/**
Convert input string according to settings passed to Init() and writes
the result to output.
All the Convert() function overloads return @true if the conversion was
lossless and @false if at least one of the characters couldn't be converted
was and replaced with '?' in the output.
Note that if @c wxCONVERT_SUBSTITUTE was passed to Init(), substitution is
considered a lossless operation.
@note You must call Init() before using this method!
@note wchar_t versions of the method are not available if wxWidgets was
compiled with @c wxUSE_WCHAR_T set to 0.
*/
bool Convert(const char* input, char* output) const;
bool Convert(const wchar_t* input, wchar_t* output) const;
bool Convert(const char* input, wchar_t* output) const;
bool Convert(const wchar_t* input, char* output) const;
/**
Convert input string according to settings passed to Init() in-place,
i.e. write the result to the same memory area.
See the Convert(const char*,char*) const overload for more info.
*/
bool Convert(char* str) const;
bool Convert(wchar_t* str) const;
/**
Convert a wxString and return a new wxString object.
See the Convert(const char*,char*) const overload for more info.
*/
wxString Convert(const wxString& input) const;
//@}
/**
Similar to GetPlatformEquivalents(), but this one will return ALL
equivalent encodings, regardless of the platform, and including itself.
This platform's encodings are before others in the array.
And again, if @a enc is in the array, it is the very first item in it.
*/
static wxFontEncodingArray GetAllEquivalents(wxFontEncoding enc);
/**
Return equivalents for given font that are used under given platform.
Supported platforms:
@li wxPLATFORM_UNIX
@li wxPLATFORM_WINDOWS
@li wxPLATFORM_OS2
@li wxPLATFORM_MAC
@li wxPLATFORM_CURRENT
wxPLATFORM_CURRENT means the platform this binary was compiled for.
Examples:
@verbatim
current platform enc returned value
----------------------------------------------
unix CP1250 {ISO8859_2}
unix ISO8859_2 {ISO8859_2}
windows ISO8859_2 {CP1250}
unix CP1252 {ISO8859_1,ISO8859_15}
@endverbatim
Equivalence is defined in terms of convertibility: two 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).
Remember that this function does @b NOT check for presence of
fonts in system. It only tells you what are most suitable
encodings. (It usually returns only one encoding.)
@note Note that argument enc itself may be present in the returned array,
so that you can, as a side-effect, detect whether the encoding is
native for this platform or not.
@note Convert() is not limited to converting between equivalent encodings,
it can convert between two arbitrary encodings.
@note If @a enc is present in the returned array, then it is always the first
item of it.
@note Please note that the returned array may contain no items at all.
*/
static wxFontEncodingArray GetPlatformEquivalents(wxFontEncoding enc,
int platform = wxPLATFORM_CURRENT);
/**
Initialize the conversion.
Both output or input encoding may be wxFONTENCODING_UNICODE, but only
if wxUSE_ENCODING is set to 1.
All subsequent calls to Convert() will interpret its argument
as a string in @a input_enc encoding and will output string in
@a 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.
@a method affects behaviour of Convert() in case input character
cannot be converted because it does not exist in output encoding:
@li @b wxCONVERT_STRICT: follow behaviour of GNU Recode - just copy
unconvertible characters to output and don't change them
(its integer value will stay the same)
@li @b wxCONVERT_SUBSTITUTE: try some (lossy) substitutions - e.g.
replace unconvertible 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.
@return @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);
};

3390
interface/wx/event.h Normal file

File diff suppressed because it is too large Load Diff

210
interface/wx/fdrepdlg.h Normal file
View File

@@ -0,0 +1,210 @@
/////////////////////////////////////////////////////////////////////////////
// Name: fdrepdlg.h
// Purpose: interface of wxFindDialogEvent, wxFindReplaceDialog
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
See 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
}
/**
@class wxFindDialogEvent
@wxheader{fdrepdlg.h}
wxFindReplaceDialog events
@beginEventTable{wxFindDialogEvent}
@event{EVT_FIND(id, func)}
Find button was pressed in the dialog.
@event{EVT_FIND_NEXT(id, func)}
Find next button was pressed in the dialog.
@event{EVT_FIND_REPLACE(id, func)}
Replace button was pressed in the dialog.
@event{EVT_FIND_REPLACE_ALL(id, func)}
Replace all button was pressed in the dialog.
@event{EVT_FIND_CLOSE(id, func)}
The dialog is being destroyed, any pointers to it cannot be used any longer.
@endEventTable
@library{wxcore}
@category{events}
*/
class wxFindDialogEvent : public wxCommandEvent
{
public:
/**
Constuctor used by wxWidgets only.
*/
wxFindDialogEvent(wxEventType commandType = wxEVT_NULL,
int id = 0);
/**
Return the pointer to the dialog which generated this event.
*/
wxFindReplaceDialog* GetDialog() const;
/**
Return the string to find (never empty).
*/
wxString GetFindString() const;
/**
Get the currently selected flags: this is the combination of
the ::wxFindReplaceFlags enumeration values.
*/
int GetFlags() const;
/**
Return the string to replace the search string with (only for replace and
replace all events).
*/
const wxString& GetReplaceString() const;
};
/**
@class wxFindReplaceData
@wxheader{fdrepdlg.h}
wxFindReplaceData holds the data for wxFindReplaceDialog.
It is used to initialize the dialog with the default values and will keep the
last values from the dialog when it is closed. It is also updated each time a
wxFindDialogEvent is generated so instead of using the wxFindDialogEvent
methods you can also directly query this object.
Note that all @c SetXXX() methods may only be called before showing the
dialog and calling them has no effect later.
@library{wxcore}
@category{data}
*/
class wxFindReplaceData : public wxObject
{
public:
/**
Constuctor initializes the flags to default value (0).
*/
wxFindReplaceData(wxUint32 flags = 0);
/**
Get the string to find.
*/
const wxString GetFindString();
/**
Get the combination of @c wxFindReplaceFlags values.
*/
int GetFlags() const;
/**
Get the replacement string.
*/
const wxString GetReplaceString();
/**
Set the string to find (used as initial value by the dialog).
*/
void SetFindString(const wxString& str);
/**
Set the flags to use to initialize the controls of the dialog.
*/
void SetFlags(wxUint32 flags);
/**
Set the replacement string (used as initial value by the dialog).
*/
void SetReplaceString(const wxString& str);
};
/**
@class wxFindReplaceDialog
@wxheader{fdrepdlg.h}
wxFindReplaceDialog is a standard modeless dialog which is used to allow the
user to search for some text (and possibly replace it with something else).
The actual searching is supposed to be done in the owner window which is the
parent of this dialog. Note that it means that unlike for the other standard
dialogs this one @b must have a parent window. Also note that there is no
way to use this dialog in a modal way; it is always, by design and
implementation, modeless.
Please see the @ref page_samples_dialogs sample for an example of using it.
@library{wxcore}
@category{cmndlg}
*/
class wxFindReplaceDialog : public wxDialog
{
public:
wxFindReplaceDialog();
/**
After using default constructor Create() must be called.
The @a parent and @a data parameters must be non-@NULL.
*/
wxFindReplaceDialog(wxWindow* parent,
wxFindReplaceData* data,
const wxString& title,
int style = 0);
/**
Destructor.
*/
~wxFindReplaceDialog();
/**
Creates the dialog; use wxWindow::Show to show it on screen.
The @a parent and @a data parameters must be non-@NULL.
*/
bool Create(wxWindow* parent, wxFindReplaceData* data,
const wxString& title, int style = 0);
/**
Get the wxFindReplaceData object used by this dialog.
*/
const wxFindReplaceData* GetData() const;
};

246
interface/wx/ffile.h Normal file
View File

@@ -0,0 +1,246 @@
/////////////////////////////////////////////////////////////////////////////
// Name: ffile.h
// Purpose: interface of wxFFile
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
Values used for both wxFile and wxFFile.
@todo make the value names uppercase
*/
enum wxSeekMode
{
wxFromStart,
wxFromCurrent,
wxFromEnd
};
/**
See wxFFile::GetKind().
*/
enum wxFileKind
{
wxFILE_KIND_UNKNOWN,
wxFILE_KIND_DISK, /**< A file supporting seeking to arbitrary offsets. */
wxFILE_KIND_TERMINAL, /**< A terminal. */
wxFILE_KIND_PIPE /**< A pipe. */
};
/**
@class wxFFile
@wxheader{ffile.h}
wxFFile implements buffered file I/O.
This is a very small class designed to minimize the overhead of using it - in fact,
there is hardly any overhead at all, but using it brings you automatic error checking
and hides differences between platforms and compilers.
It wraps inside it a @c FILE * handle used by standard C IO library (also known as @c stdio).
@library{wxbase}
@category{file}
@see wxFFile::IsOpened
*/
class wxFFile
{
public:
wxFFile();
/**
Opens a file with the given file pointer, which has already been opened.
@param fp
An existing file descriptor, such as stderr.
*/
wxFFile(FILE* fp);
/**
Opens a file with the given mode.
As there is no way to return whether the operation was successful or not from
the constructor you should test the return value of IsOpened() to check that it
didn't fail.
@param filename
The filename.
@param mode
The mode in which to open the file using standard C strings.
Note that you should use "b" flag if you use binary files under Windows
or the results might be unexpected due to automatic newline conversion done
for the text files.
*/
wxFFile(const wxString& filename, const wxString& mode = "r");
/**
Destructor will close the file.
@note it is not virtual so you should @e not derive from wxFFile!
*/
~wxFFile();
/**
Attaches an existing file pointer to the wxFFile object.
The descriptor should be already opened and it will be closed by wxFFile object.
*/
void Attach(FILE* fp);
/**
Closes the file and returns @true on success.
*/
bool Close();
/**
Get back a file pointer from wxFFile object -- the caller is responsible for
closing the file if this descriptor is opened.
IsOpened() will return @false after call to Detach().
*/
void Detach();
/**
Returns @true if the an attempt has been made to read @e past
the end of the file.
Note that the behaviour of the file descriptor based class wxFile is different as
wxFile::Eof() will return @true here as soon as the last byte of the file has been read.
Also note that this method may only be called for opened files and may crash if
the file is not opened.
@todo THIS METHOD MAY CRASH? DOESN'T SOUND GOOD
@see IsOpened()
*/
bool Eof() const;
/**
Returns @true if an error has occurred on this file, similar to the standard
@c ferror() function.
Please note that this method may only be called for opened files and may crash
if the file is not opened.
@todo THIS METHOD MAY CRASH? DOESN'T SOUND GOOD
@see IsOpened()
*/
bool Error() const;
/**
Flushes the file and returns @true on success.
*/
bool Flush();
/**
Returns the type of the file.
@see wxFileKind
*/
wxFileKind GetKind() const;
/**
Returns @true if the file is opened.
Most of the methods of this class may only be used for an opened file.
*/
bool IsOpened() const;
/**
Returns the length of the file.
*/
wxFileOffset Length() const;
/**
Opens the file, returning @true if successful.
@param filename
The filename.
@param mode
The mode in which to open the file.
*/
bool Open(const wxString& filename, const wxString& mode = "r");
/**
Reads the specified number of bytes into a buffer, returning the actual number read.
@param buffer
A buffer to receive the data.
@param count
The number of bytes to read.
@return The number of bytes read.
*/
size_t Read(void* buffer, size_t count);
/**
Reads the entire contents of the file into a string.
@param str
String to read data into.
@param conv
Conversion object to use in Unicode build; by default supposes
that file contents is encoded in UTF-8.
@return @true if file was read successfully, @false otherwise.
*/
bool ReadAll(wxString* str, const wxMBConv& conv = wxConvAuto());
/**
Seeks to the specified position and returns @true on success.
@param ofs
Offset to seek to.
@param mode
One of wxFromStart, wxFromEnd, wxFromCurrent.
*/
bool Seek(wxFileOffset ofs, wxSeekMode mode = wxFromStart);
/**
Moves the file pointer to the specified number of bytes before the end of the
file and returns @true on success.
@param ofs
Number of bytes before the end of the file.
*/
bool SeekEnd(wxFileOffset ofs = 0);
/**
Returns the current position.
*/
wxFileOffset Tell() const;
/**
Writes the contents of the string to the file, returns @true on success.
The second argument is only meaningful in Unicode build of wxWidgets when
@a conv is used to convert @a str to multibyte representation.
*/
bool Write(const wxString& str, const wxMBConv& conv = wxConvAuto());
/**
Writes the specified number of bytes from a buffer.
@param buffer
A buffer containing the data.
@param count
The number of bytes to write.
@return The number of bytes written.
*/
size_t Write(const void* buffer, size_t count);
/**
Returns the file pointer associated with the file.
*/
FILE* fp() const;
};

325
interface/wx/file.h Normal file
View File

@@ -0,0 +1,325 @@
/////////////////////////////////////////////////////////////////////////////
// Name: file.h
// Purpose: interface of wxTempFile
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxTempFile
@wxheader{file.h}
wxTempFile provides a relatively safe way to replace the contents of the
existing file. The name is explained by the fact that it may be also used as
just a temporary file if you don't replace the old file contents.
Usually, when a program replaces the contents of some file it first opens it for
writing, thus losing all of the old data and then starts recreating it. This
approach is not very safe because during the regeneration of the file bad things
may happen: the program may find that there is an internal error preventing it
from completing file generation, the user may interrupt it (especially if file
generation takes long time) and, finally, any other external interrupts (power
supply failure or a disk error) will leave you without either the original file
or the new one.
wxTempFile addresses this problem by creating a temporary file which is meant to
replace the original file - but only after it is fully written. So, if the user
interrupts the program during the file generation, the old file won't be lost.
Also, if the program discovers itself that it doesn't want to replace the old
file there is no problem - in fact, wxTempFile will @b not replace the old
file by default, you should explicitly call wxTempFile::Commit
to do it. Calling wxTempFile::Discard explicitly discards any
modifications: it closes and deletes the temporary file and leaves the original
file unchanged. If you don't call neither of Commit() and Discard(), the
destructor will call Discard() automatically.
To summarize: if you want to replace another file, create an instance of
wxTempFile passing the name of the file to be replaced to the constructor (you
may also use default constructor and pass the file name to
wxTempFile::Open). Then you can wxTempFile::write
to wxTempFile using wxFile-like functions and later call
Commit() to replace the old file (and close this one) or call Discard() to
cancel
the modifications.
@library{wxbase}
@category{file}
*/
class wxTempFile
{
public:
/**
Associates wxTempFile with the file to be replaced and opens it. You should use
IsOpened() to verify if the constructor succeeded.
*/
wxTempFile(const wxString& strName);
/**
Destructor calls Discard() if temporary file
is still opened.
*/
~wxTempFile();
/**
Validate changes: deletes the old file of name m_strName and renames the new
file to the old name. Returns @true if both actions succeeded. If @false is
returned it may unfortunately mean two quite different things: either that
either the old file couldn't be deleted or that the new file couldn't be renamed
to the old name.
*/
bool Commit();
/**
Discard changes: the old file contents is not changed, temporary file is
deleted.
*/
void Discard();
/**
Returns @true if the file was successfully opened.
*/
bool IsOpened() const;
/**
Returns the length of the file.
*/
wxFileOffset Length() const;
/**
Open the temporary file, returns @true on success, @false if an error
occurred.
@a strName is the name of file to be replaced. The temporary file is always
created in the directory where @a strName is. In particular, if
@a strName doesn't include the path, it is created in the current directory
and the program should have write access to it for the function to succeed.
*/
bool Open(const wxString& strName);
/**
Seeks to the specified position.
*/
wxFileOffset Seek(wxFileOffset ofs,
wxSeekMode mode = wxFromStart);
/**
Returns the current position or wxInvalidOffset if file is not opened or if
another
error occurred.
*/
wxFileOffset Tell() const;
/**
Write to the file, return @true on success, @false on failure.
The second argument is only meaningful in Unicode build of wxWidgets when
@a conv is used to convert @a str to multibyte representation.
*/
bool Write(const wxString& str,
const wxMBConv& conv = wxConvUTF8);
};
/**
@class wxFile
@wxheader{file.h}
A wxFile performs raw file I/O. This is a very small class designed to
minimize the overhead of using it - in fact, there is hardly any overhead at
all, but using it brings you automatic error checking and hides differences
between platforms and compilers. wxFile also automatically closes the file in
its destructor making it unnecessary to worry about forgetting to do it.
wxFile is a wrapper around @c file descriptor. - see also
wxFFile for a wrapper around @c FILE structure.
@c wxFileOffset is used by the wxFile functions which require offsets as
parameter or return them. If the platform supports it, wxFileOffset is a typedef
for a native 64 bit integer, otherwise a 32 bit integer is used for
wxFileOffset.
@library{wxbase}
@category{file}
*/
class wxFile
{
public:
//@{
/**
Associates the file with the given file descriptor, which has already been
opened.
@param filename
The filename.
@param mode
The mode in which to open the file. May be one of read(), write() and
wxFile::read_write.
@param fd
An existing file descriptor (see Attach() for the list of predefined
descriptors)
*/
wxFile();
wxFile(const wxString& filename,
wxFile::OpenMode mode = wxFile::read);
wxFile(int fd);
//@}
/**
Destructor will close the file.
@note it is not virtual so you should not use wxFile polymorphically.
*/
~wxFile();
/**
This function verifies if we may access the given file in specified mode. Only
values of read() or write() really make sense here.
*/
static bool Access(const wxString& name, OpenMode mode);
/**
Attaches an existing file descriptor to the wxFile object. Example of predefined
file descriptors are 0, 1 and 2 which correspond to stdin, stdout and stderr
(and
have symbolic names of @b wxFile::fd_stdin, @b wxFile::fd_stdout and @b
wxFile::fd_stderr).
The descriptor should be already opened and it will be closed by wxFile
object.
*/
void Attach(int fd);
/**
Closes the file.
*/
void Close();
/**
Creates a file for writing. If the file already exists, setting @b overwrite to
@true
will ensure it is overwritten.
*/
bool Create(const wxString& filename, bool overwrite = false,
int access = wxS_DEFAULT);
/**
Get back a file descriptor from wxFile object - the caller is responsible for
closing the file if this
descriptor is opened. IsOpened() will return @false after call to Detach().
*/
void Detach();
/**
Returns @true if the end of the file has been reached.
Note that the behaviour of the file pointer based class
wxFFile is different as wxFFile::Eof
will return @true here only if an attempt has been made to read
@e past the last byte of the file, while wxFile::Eof() will return @true
even before such attempt is made if the file pointer is at the last position
in the file.
Note also that this function doesn't work on unseekable file descriptors
(examples include pipes, terminals and sockets under Unix) and an attempt to
use it will result in an error message in such case. So, to read the entire
file into memory, you should write a loop which uses
Read() repeatedly and tests its return condition instead
of using Eof() as this will not work for special files under Unix.
*/
bool Eof() const;
/**
Returns @true if the given name specifies an existing regular file (not a
directory or a link)
*/
static bool Exists(const wxString& filename);
/**
Flushes the file descriptor.
Note that Flush() is not implemented on some Windows compilers
due to a missing fsync function, which reduces the usefulness of this function
(it can still be called but it will do nothing on unsupported compilers).
*/
bool Flush();
/**
Returns the type of the file. Possible return values are:
*/
wxFileKind GetKind() const;
/**
Returns @true if the file has been opened.
*/
bool IsOpened() const;
/**
Returns the length of the file.
*/
wxFileOffset Length() const;
/**
Opens the file, returning @true if successful.
@param filename
The filename.
@param mode
The mode in which to open the file. May be one of read(), write() and
wxFile::read_write.
*/
bool Open(const wxString& filename,
wxFile::OpenMode mode = wxFile::read);
//@{
/**
if there was an error.
*/
size_t Read(void* buffer, size_t count);
Parameters Return value
The number of bytes read, or the symbol wxInvalidOffset();
//@}
/**
Seeks to the specified position.
@param ofs
Offset to seek to.
@param mode
One of wxFromStart, wxFromEnd, wxFromCurrent.
@return The actual offset position achieved, or wxInvalidOffset on
failure.
*/
wxFileOffset Seek(wxFileOffset ofs,
wxSeekMode mode = wxFromStart);
/**
Moves the file pointer to the specified number of bytes relative to the end of
the file. For example, @c SeekEnd(-5) would position the pointer 5
bytes before the end.
@param ofs
Number of bytes before the end of the file.
@return The actual offset position achieved, or wxInvalidOffset on
failure.
*/
wxFileOffset SeekEnd(wxFileOffset ofs = 0);
/**
Returns the current position or wxInvalidOffset if file is not opened or if
another
error occurred.
*/
wxFileOffset Tell() const;
/**
Writes the contents of the string to the file, returns @true on success.
The second argument is only meaningful in Unicode build of wxWidgets when
@a conv is used to convert @a s to multibyte representation.
Note that this method only works with @c NUL-terminated strings, if you want
to write data with embedded @c NULs to the file you should use the other
@ref write() "Write() overload".
*/
bool Write(const wxString& s, const wxMBConv& conv = wxConvUTF8);
/**
Returns the file descriptor associated with the file.
*/
int fd() const;
};

86
interface/wx/fileconf.h Normal file
View File

@@ -0,0 +1,86 @@
/////////////////////////////////////////////////////////////////////////////
// Name: fileconf.h
// Purpose: interface of wxFileConfig
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxFileConfig
@wxheader{fileconf.h}
wxFileConfig implements wxConfigBase interface for
storing and retrieving configuration information using plain text files. The
files have a simple format reminiscent of Windows INI files with lines of the
form @c "key = value" defining the keys and lines of special form
@c "[group]" indicating the start of each group.
This class is used by default for wxConfig on Unix platforms but may also be
used explicitly if you want to use files and not the registry even under
Windows.
@library{wxbase}
@category{misc}
@see wxFileConfig::Save
*/
class wxFileConfig : public wxConfigBase
{
public:
/**
Read the config data from the specified stream instead of the associated file,
as usual.
@see Save()
*/
wxFileConfig(wxInputStream& is, const wxMBConv& conv = wxConvAuto());
/**
Return the full path to the file which would be used by wxFileConfig as global,
system-wide, file if it were constructed with @a basename as "global filename"
parameter in the constructor.
Notice that this function cannot be used if @a basename is already a full path name.
*/
static wxFileName GetGlobalFile(const wxString& basename);
/**
Return the full path to the file which would be used by wxFileConfig as local,
user-specific, file if it were constructed with @a basename as "local filename"
parameter in the constructor.
@a style has the same meaning as in @ref wxConfigBase::wxConfigBase "wxConfig constructor"
and can contain any combination of styles but only wxCONFIG_USE_SUBDIR bit is
examined by this function.
Notice that this function cannot be used if @a basename is already a full path name.
*/
static wxFileName GetLocalFile(const wxString& basename, int style = 0);
/**
Saves all config data to the given stream, returns @true if data was saved
successfully or @false on error.
Note the interaction of this function with the internal "dirty flag": the
data is saved unconditionally, i.e. even if the object is not dirty. However
after saving it successfully, the dirty flag is reset so no changes will be
written back to the file this object is associated with until you change its
contents again.
@see wxConfigBase::Flush
*/
bool Save(wxOutputStream& os, const wxMBConv& conv = wxConvAuto());
/**
Allows to set the mode to be used for the config file creation. For example, to
create a config file which is not readable by other users (useful if it stores
some sensitive information, such as passwords), you could use @c SetUmask(0077).
This function doesn't do anything on non-Unix platforms.
@see wxCHANGE_UMASK()
*/
void SetUmask(int mode);
};

246
interface/wx/filectrl.h Normal file
View File

@@ -0,0 +1,246 @@
/////////////////////////////////////////////////////////////////////////////
// Name: filectrl.h
// Purpose: interface of wxFileCtrl
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxFileCtrl
@wxheader{filectrl.h}
This control allows the user to select a file.
Two implemetations exist, one for Gtk and another generic one for anything
other than Gtk. It is only available if @c wxUSE_FILECTRL is set to 1.
@beginStyleTable
@style{wxFC_DEFAULT_STYLE}
The default style: wxFC_OPEN
@style{wxFC_OPEN}
Creates an file control suitable for opening files. Cannot be
combined with wxFC_SAVE.
@style{wxFC_SAVE}
Creates an file control suitable for saving files. Cannot be
combined with wxFC_OPEN.
@style{wxFC_MULTIPLE}
For open control only, Allows selecting multiple files. Cannot be
combined with wxFC_SAVE
@style{wxFC_NOSHOWHIDDEN}
Hides the "Show Hidden Files" checkbox (Generic only)
@endStyleTable
@beginEventTable{wxFileCtrlEvent}
@event{EVT_FILECTRL_FILEACTIVATED(id, func)}
The user activated a file(by double-clicking or pressing Enter)
@event{EVT_FILECTRL_SELECTIONCHANGED(id, func)}
The user changed the current selection(by selecting or deselecting a file)
@event{EVT_FILECTRL_FOLDERCHANGED(id, func)}
The current folder of the file control has been changed
@endEventTable
@nativeimpl{gtk}
@library{wxbase}
@category{miscwnd}
@see wxGenericDirCtrl
*/
class wxFileCtrl : public wxWindow
{
public:
wxFileCtrl();
/**
Constructs the window.
@param parent
Parent window, must not be non-@NULL.
@param id
The identifier for the control.
@param defaultDirectory
The initial directory shown in the control. Must be
a valid path to a directory or the empty string.
In case it is the empty string, the current working directory is used.
@param defaultFilename
The default filename, or the empty string.
@param wildcard
A wildcard specifying which files can be selected,
such as "*.*" or "BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif".
@param style
The window style, see wxFC_* flags.
@param pos
Initial position.
@param size
Initial size.
@param name
Control name.
@return @true if the control was successfully created or @false if
creation failed.
*/
wxFileCtrl(wxWindow* parent, wxWindowID id,
const wxString& defaultDirectory = wxEmptyString,
const wxString& defaultFilename = wxEmptyString,
const wxPoint& wildCard = wxFileSelectorDefaultWildcardStr,
long style = wxFC_DEFAULT_STYLE,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
const wxString& name = "filectrl");
/**
Create function for two-step construction. See wxFileCtrl() for details.
*/
bool Create(wxWindow* parent, wxWindowID id,
const wxString& defaultDirectory = wxEmptyString,
const wxString& defaultFilename = wxEmptyString,
const wxPoint& wildCard = wxFileSelectorDefaultWildcardStr,
long style = wxFC_DEFAULT_STYLE,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
const wxString& name = "filectrl");
/**
Returns the current directory of the file control (i.e. the directory shown by it).
*/
wxString GetDirectory() const;
/**
Returns the currently selected filename.
For the controls having the @c wxFC_MULTIPLE style, use GetFilenames() instead.
*/
wxString GetFilename() const;
/**
Fills the array @a filenames with the filenames only of selected items.
This function should only be used with the controls having the @c wxFC_MULTIPLE
style, use GetFilename() for the others.
@remarks filenames is emptied first.
*/
void GetFilenames(wxArrayString& filenames) const;
/**
Returns the zero-based index of the currently selected filter.
*/
int GetFilterIndex() const;
/**
Returns the full path (directory and filename) of the currently selected file.
For the controls having the @c wxFC_MULTIPLE style, use GetPaths() instead.
*/
wxString GetPath() const;
/**
Fills the array @a paths with the full paths of the files chosen.
This function should be used with the controls having the @c wxFC_MULTIPLE style,
use GetPath() otherwise.
@remarks paths is emptied first.
*/
void GetPaths(wxArrayString& paths) const;
/**
Returns the current wildcard.
*/
wxString GetWildcard() const;
/**
Sets(changes) the current directory displayed in the control.
@return Returns @true on success, @false otherwise.
*/
bool SetDirectory(const wxString& directory);
/**
Selects a certain file.
@return Returns @true on success, @false otherwise
*/
bool SetFilename(const wxString& filename);
/**
Sets the current filter index, starting from zero.
*/
void SetFilterIndex(int filterIndex);
/**
Sets the wildcard, which can contain multiple file types, for example:
"BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif"
*/
void SetWildcard(const wxString& wildCard);
/**
Sets whether hidden files and folders are shown or not.
*/
void ShowHidden(const bool show);
};
/**
@class wxFileCtrlEvent
@wxheader{filectrl.h}
A file control event holds information about events associated with
wxFileCtrl objects.
@beginEventTable{wxFileCtrlEvent}
@event{EVT_FILECTRL_FILEACTIVATED(id, func)}
The user activated a file(by double-clicking or pressing Enter)
@event{EVT_FILECTRL_SELECTIONCHANGED(id, func)}
The user changed the current selection(by selecting or deselecting a file)
@event{EVT_FILECTRL_FOLDERCHANGED(id, func)}
The current folder of the file control has been changed
@endEventTable
@library{wxbase}
@category{events}
*/
class wxFileCtrlEvent : public wxCommandEvent
{
public:
/**
Constructor.
*/
wxFileCtrlEvent(wxEventType type, wxObject evtObject, int id);
/**
Returns the current directory.
In case of a @b EVT_FILECTRL_FOLDERCHANGED, this method returns the new
directory.
*/
wxString GetDirectory() const;
/**
Returns the file selected (assuming it is only one file).
*/
wxString GetFile() const;
/**
Returns the files selected.
In case of a @b EVT_FILECTRL_SELECTIONCHANGED, this method returns the
files selected after the event.
*/
wxArrayString GetFiles() const;
/**
Sets the files changed by this event.
*/
void SetFiles(const wxArrayString files);
/**
Sets the directory of this event.
*/
void SetDirectory( const wxString &directory );
};

284
interface/wx/filedlg.h Normal file
View File

@@ -0,0 +1,284 @@
/////////////////////////////////////////////////////////////////////////////
// Name: filedlg.h
// Purpose: interface of wxFileDialog
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxFileDialog
@wxheader{filedlg.h}
This class represents the file chooser dialog.
It pops up a file selector box (native for Windows and GTK2.4+).
The path and filename are distinct elements of a full file pathname.
If path is "", the current directory will be used. If filename is "", no default
filename will be supplied. The wildcard determines what files are displayed in the
file selector, and file extension supplies a type extension for the required filename.
@remarks
All implementations of the wxFileDialog provide a wildcard filter. Typing a filename
containing wildcards (*, ?) in the filename text item, and clicking on Ok, will
result in only those files matching the pattern being displayed.
The wildcard may be a specification for multiple types of file with a description
for each, such as:
"BMP and GIF files (*.bmp;*.gif)|*.bmp;*.gif|PNG files (*.png)|*.png"
It must be noted that wildcard support in the native Motif file dialog is quite
limited: only one alternative is supported, and it is displayed without the
descriptive test; "BMP files (*.bmp)|*.bmp" is displayed as "*.bmp", and both
"BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif" and "Image files|*.bmp;*.gif"
are errors.
@beginStyleTable
@style{wxFD_DEFAULT_STYLE}
Equivalent to wxFD_OPEN.
@style{wxFD_OPEN}
This is an open dialog; usually this means that the default
button's label of the dialog is "Open". Cannot be combined with wxFD_SAVE.
@style{wxFD_SAVE}
This is a save dialog; usually this means that the default button's
label of the dialog is "Save". Cannot be combined with wxFD_OPEN.
@style{wxFD_OVERWRITE_PROMPT}
For save dialog only: prompt for a confirmation if a file will be
overwritten.
@style{wxFD_FILE_MUST_EXIST}
For open dialog only: the user may only select files that actually exist.
@style{wxFD_MULTIPLE}
For open dialog only: allows selecting multiple files.
@style{wxFD_CHANGE_DIR}
Change the current working directory to the directory where the
file(s) chosen by the user are.
@style{wxFD_PREVIEW}
Show the preview of the selected files (currently only supported by
wxGTK using GTK+ 2.4 or later).
@endStyleTable
@library{wxcore}
@category{cmndlg}
@see @ref overview_wxfiledialog, ::wxFileSelector()
*/
class wxFileDialog : public wxDialog
{
public:
/**
Constructor. Use ShowModal() to show the dialog.
@param parent
Parent window.
@param message
Message to show on the dialog.
@param defaultDir
The default directory, or the empty string.
@param defaultFile
The default filename, or the empty string.
@param wildcard
A wildcard, such as "*.*" or "BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif".
Note that the native Motif dialog has some limitations with respect to
wildcards; see the Remarks section above.
@param style
A dialog style. See wxFD_* styles for more info.
@param pos
Dialog position. Not implemented.
@param size
Dialog size. Not implemented.
@param name
Dialog name. Not implemented.
*/
wxFileDialog(wxWindow* parent,
const wxString& message = "Choose a file",
const wxString& defaultDir = "",
const wxString& defaultFile = "",
const wxString& wildcard = ".",
long style = wxFD_DEFAULT_STYLE,
const wxPoint& pos = wxDefaultPosition,
const wxSize& sz = wxDefaultSize,
const wxString& name = "filedlg");
/**
Destructor.
*/
~wxFileDialog();
/**
Returns the default directory.
*/
wxString GetDirectory() const;
/**
If functions SetExtraControlCreator() and ShowModal() were called,
returns the extra window. Otherwise returns @NULL.
*/
wxWindow* GetExtraControl() const;
/**
Returns the default filename.
*/
wxString GetFilename() const;
/**
Fills the array @a filenames with the names of the files chosen.
This function should only be used with the dialogs which have @c wxFD_MULTIPLE style,
use GetFilename() for the others.
Note that under Windows, if the user selects shortcuts, the filenames
include paths, since the application cannot determine the full path
of each referenced file by appending the directory containing the shortcuts
to the filename.
*/
void GetFilenames(wxArrayString& filenames) const;
/**
Returns the index into the list of filters supplied, optionally, in the
wildcard parameter.
Before the dialog is shown, this is the index which will be used when the
dialog is first displayed.
After the dialog is shown, this is the index selected by the user.
*/
int GetFilterIndex() const;
/**
Returns the message that will be displayed on the dialog.
*/
wxString GetMessage() const;
/**
Returns the full path (directory and filename) of the selected file.
*/
wxString GetPath() const;
/**
Fills the array @a paths with the full paths of the files chosen.
This function should only be used with the dialogs which have @c wxFD_MULTIPLE style,
use GetPath() for the others.
*/
void GetPaths(wxArrayString& paths) const;
/**
Returns the file dialog wildcard.
*/
wxString GetWildcard() const;
/**
Sets the default directory.
*/
void SetDirectory(const wxString& directory);
/**
Customize file dialog by adding extra window, which is typically placed
below the list of files and above the buttons.
SetExtraControlCreator() can be called only once, before calling ShowModal().
The @c creator function should take pointer to parent window (file dialog)
and should return a window allocated with operator new.
Supported platforms: wxGTK, wxUniv.
*/
bool SetExtraControlCreator(t_extraControlCreator creator);
/**
Sets the default filename.
*/
void SetFilename(const wxString& setfilename);
/**
Sets the default filter index, starting from zero.
*/
void SetFilterIndex(int filterIndex);
/**
Sets the message that will be displayed on the dialog.
*/
void SetMessage(const wxString& message);
/**
Sets the path (the combined directory and filename that will be returned when
the dialog is dismissed).
*/
void SetPath(const wxString& path);
/**
Sets the wildcard, which can contain multiple file types, for example:
"BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif".
Note that the native Motif dialog has some limitations with respect to
wildcards; see the Remarks section above.
*/
void SetWildcard(const wxString& wildCard);
/**
Shows the dialog, returning wxID_OK if the user pressed OK, and wxID_CANCEL
otherwise.
*/
int ShowModal();
};
// ============================================================================
// Global functions/macros
// ============================================================================
/** @ingroup group_funcmacro_dialog */
//@{
/**
Pops up a file selector box. In Windows, this is the common file selector
dialog. In X, this is a file selector box with the same functionality. The
path and filename are distinct elements of a full file pathname. If path
is empty, the current directory will be used. If filename is empty, no
default filename will be supplied. The wildcard determines what files are
displayed in the file selector, and file extension supplies a type
extension for the required filename. Flags may be a combination of
wxFD_OPEN, wxFD_SAVE, wxFD_OVERWRITE_PROMPT or wxFD_FILE_MUST_EXIST.
@note wxFD_MULTIPLE can only be used with wxFileDialog and not here since
this function only returns a single file name.
Both the Unix and Windows versions implement a wildcard filter. Typing a
filename containing wildcards (*, ?) in the filename text item, and
clicking on Ok, will result in only those files matching the pattern being
displayed.
The wildcard may be a specification for multiple types of file with a
description for each, such as:
@code
"BMP files (*.bmp)|*.bmp|GIF files (*.gif)|*.gif"
@endcode
The application must check for an empty return value (the user pressed
Cancel). For example:
@code
wxString filename = wxFileSelector("Choose a file to open");
if ( !filename.empty() )
{
// work with the file
...
}
//else: cancelled by user
@endcode
@header{wx/filedlg.h}
*/
wxString wxFileSelector(const wxString& message,
const wxString& default_path = "",
const wxString& default_filename = "",
const wxString& default_extension = "",
const wxString& wildcard = ".",
int flags = 0,
wxWindow* parent = NULL,
int x = -1,
int y = -1);
//@}

458
interface/wx/filefn.h Normal file
View File

@@ -0,0 +1,458 @@
/////////////////////////////////////////////////////////////////////////////
// Name: filefn.h
// Purpose: interface of wxPathList and file functions
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxPathList
@wxheader{filefn.h}
The path list is a convenient way of storing a number of directories, and
when presented with a filename without a directory, searching for an
existing file in those directories.
Be sure to look also at wxStandardPaths if you only want to search files in
some standard paths.
@library{wxbase}
@category{file}
@see wxArrayString, wxStandardPaths, wxFileName
*/
class wxPathList : public wxArrayString
{
public:
wxPathList();
/**
Constructs the object calling the Add() function.
*/
wxPathList(const wxArrayString& arr);
/**
Adds the given directory to the path list, if the @a path is not already in the list.
If the path cannot be normalized for some reason, it returns @false.
The @a path is always considered to be a directory but no existence checks will be
done on it (because if it doesn't exist, it could be created later and thus result a
valid path when FindValidPath() is called).
@note if the given path is relative, it won't be made absolute before adding it
(this is why FindValidPath() may return relative paths).
*/
bool Add(const wxString& path);
/**
Adds all elements of the given array as paths.
*/
void Add(const wxArrayString& arr);
/**
Finds the value of the given environment variable, and adds all paths
to the path list.
Useful for finding files in the @c PATH variable, for example.
*/
void AddEnvList(const wxString& env_variable);
/**
Given a full filename (with path), calls Add() with the path of the file.
*/
bool EnsureFileAccessible(const wxString& filename);
/**
Like FindValidPath() but this function always returns an absolute path
(eventually prepending the current working directory to the value returned
wxPathList::FindValidPath()) or an empty string.
*/
wxString FindAbsoluteValidPath(const wxString& file) const;
/**
Searches the given file in all paths stored in this class.
The first path which concatenated to the given string points to an existing
file (see wxFileExists()) is returned.
If the file wasn't found in any of the stored paths, an empty string is returned.
The given string must be a file name, eventually with a path prefix (if the path
prefix is absolute, only its name will be searched); i.e. it must not end with
a directory separator (see wxFileName::GetPathSeparator) otherwise an assertion
will fail.
The returned path may be relative to the current working directory.
Note in fact that wxPathList can be used to store both relative and absolute
paths so that if you added relative paths, then the current working directory
(see wxGetCwd() and wxSetWorkingDirectory()) may affect the value returned
by this function!
*/
wxString FindValidPath(const wxString& file) const;
};
// ============================================================================
// Global functions/macros
// ============================================================================
/** @ingroup group_funcmacro_file */
//@{
/**
Under Unix this macro changes the current process umask to the given value,
unless it is equal to -1 in which case nothing is done, and restores it to
the original value on scope exit. It works by declaring a variable which
sets umask to @a mask in its constructor and restores it in its destructor.
Under other platforms this macro expands to nothing.
@header{wx/filefn.h}
*/
#define wxCHANGE_UMASK(int mask)
/**
This function returns the total number of bytes and number of free bytes on
the disk containing the directory @a path (it should exist). Both @a total
and @a free parameters may be @NULL if the corresponding information is not
needed.
@since 2.3.2
@note The generic Unix implementation depends on the system having the
@c statfs() or @c statvfs() function.
@return @true on success, @false if an error occurred (for example, the
directory doesnt exist).
@header{wx/filefn.h}
*/
bool wxGetDiskSpace(const wxString& path,
wxLongLong total = NULL,
wxLongLong free = NULL);
/**
Returns the Windows directory under Windows; other platforms return an
empty string.
@header{wx/filefn.h}
*/
wxString wxGetOSDirectory();
/**
Parses the @a 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. On
platforms where native dialogs handle only one filter per entry, entries in
arrays are automatically adjusted. @a wildCard is in the form:
@code
"All files (*)|*|Image Files (*.jpeg *.png)|*.jpg;*.png"
@endcode
@header{wx/filefn.h}
*/
int wxParseCommonDialogsFilter(const wxString& wildCard,
wxArrayString& descriptions,
wxArrayString& filters);
/**
Converts a DOS to a Unix filename by replacing backslashes with forward
slashes.
@header{wx/filefn.h}
*/
void wxDos2UnixFilename(wxChar* s);
/**
@warning This function is deprecated, use wxFileName instead.
Converts a Unix to a DOS filename by replacing forward slashes with
backslashes.
@header{wx/filefn.h}
*/
void wxUnix2DosFilename(wxChar* s);
/**
Returns @true if @a dirname exists and is a directory.
@header{wx/filefn.h}
*/
bool wxDirExists(const wxString& dirname);
/**
@warning This function is obsolete, please use wxFileName::SplitPath()
instead.
This function splits a full file name into components: the path (including
possible disk/drive specification under Windows), the base name, and the
extension. Any of the output parameters (@a path, @a name or @a ext) may be
@NULL if you are not interested in the value of a particular component.
wxSplitPath() will correctly handle filenames with both DOS and Unix path
separators under Windows, however it will not consider backslashes as path
separators under Unix (where backslash is a valid character in a filename).
On entry, @a fullname should be non-@NULL (it may be empty though).
On return, @a path contains the file path (without the trailing separator),
@a name contains the file name and @c ext contains the file extension
without leading dot. All three of them may be empty if the corresponding
component is. The old contents of the strings pointed to by these
parameters will be overwritten in any case (if the pointers are not @NULL).
@header{wx/filefn.h}
*/
void wxSplitPath(const wxString& fullname,
wxString* path,
wxString* name,
wxString* ext);
/**
Returns time of last modification of given file.
The function returns <tt>(time_t)-1</tt> if an error occurred (e.g. file
not found).
@header{wx/filefn.h}
*/
time_t wxFileModificationTime(const wxString& filename);
/**
Renames @a file1 to @e file2, returning @true if successful.
If @a overwrite parameter is @true (default), the destination file is
overwritten if it exists, but if @a overwrite is @false, the functions
fails in this case.
@header{wx/filefn.h}
*/
bool wxRenameFile(const wxString& file1,
const wxString& file2,
bool overwrite = true);
/**
Copies @a file1 to @e file2, returning @true if successful. If @a overwrite
parameter is @true (default), the destination file is overwritten if it
exists, but if @a overwrite is @false, the functions fails in this case.
This function supports resources forks under Mac OS.
@header{wx/filefn.h}
*/
bool wxCopyFile(const wxString& file1,
const wxString& file2,
bool overwrite = true);
/**
Returns @true if the file exists and is a plain file.
@header{wx/filefn.h}
*/
bool wxFileExists(const wxString& filename);
/**
Returns @true if the @a pattern matches the @e text; if @a dot_special is
@true, filenames beginning with a dot are not matched with wildcard
characters.
@see wxIsWild()
@header{wx/filefn.h}
*/
bool wxMatchWild(const wxString& pattern,
const wxString& text,
bool dot_special);
/**
@warning This function is deprecated, use wxGetCwd() instead.
Copies the current working directory into the buffer if supplied, or copies
the working directory into new storage (which you must delete yourself) if
the buffer is @NULL.
@a sz is the size of the buffer if supplied.
@header{wx/filefn.h}
*/
wxString wxGetWorkingDirectory(char* buf = NULL, int sz = 1000);
/**
Returns the directory part of the filename.
@header{wx/filefn.h}
*/
wxString wxPathOnly(const wxString& path);
/**
Returns @true if the pattern contains wildcards.
@see wxMatchWild()
@header{wx/filefn.h}
*/
bool wxIsWild(const wxString& pattern);
/**
Returns @true if the argument is an absolute filename, i.e. with a slash
or drive name at the beginning.
@header{wx/filefn.h}
*/
bool wxIsAbsolutePath(const wxString& filename);
/**
Returns a string containing the current (or working) directory.
@header{wx/filefn.h}
*/
wxString wxGetCwd();
/**
Sets the current working directory, returning @true if the operation
succeeded. Under MS Windows, the current drive is also changed if @a dir
contains a drive specification.
@header{wx/filefn.h}
*/
bool wxSetWorkingDirectory(const wxString& dir);
/**
Concatenates @a file1 and @a file2 to @e file3, returning @true if
successful.
@header{wx/filefn.h}
*/
bool wxConcatFiles(const wxString& file1,
const wxString& file2,
const wxString& file3);
/**
Removes @e file, returning @true if successful.
@header{wx/filefn.h}
*/
bool wxRemoveFile(const wxString& file);
/**
Makes the directory @a dir, returning @true if successful.
@a perm is the access mask for the directory for the systems on which it is
supported (Unix) and doesn't have any effect on the other ones.
@header{wx/filefn.h}
*/
bool wxMkdir(const wxString& dir, int perm = 0777);
/**
Removes the directory @a dir, returning @true if successful. Does not work
under VMS.
The @a flags parameter is reserved for future use.
@note There is also a wxRmDir() function which simply wraps the standard
POSIX @c rmdir() function and so return an integer error code instead
of a boolean value (but otherwise is currently identical to
wxRmdir()), don't confuse these two functions.
@header{wx/filefn.h}
*/
bool wxRmdir(const wxString& dir, int flags = 0);
/**
Returns the next file that matches the path passed to wxFindFirstFile().
See wxFindFirstFile() for an example.
@header{wx/filefn.h}
*/
wxString wxFindNextFile();
/**
This function does directory searching; returns the first file that matches
the path @a spec, or the empty string. Use wxFindNextFile() to get the next
matching file. Neither will report the current directory "." or the parent
directory "..".
@warning As of 2.5.2, these functions are not thread-safe! (they use static
variables). You probably want to use wxDir::GetFirst() or
wxDirTraverser instead.
@a spec may contain wildcards.
@a flags may be wxDIR for restricting the query to directories, wxFILE for
files or zero for either.
For example:
@code
wxString f = wxFindFirstFile("/home/project/*.*");
while ( !f.empty() )
{
...
f = wxFindNextFile();
}
@endcode
@header{wx/filefn.h}
*/
wxString wxFindFirstFile(const wxString& spec, int flags = 0);
/**
File kind enumerations returned from wxGetFileKind().
@header{wx/filefn.h}
*/
enum wxFileKind
{
wxFILE_KIND_UNKNOWN, ///< Unknown file kind, or unable to determine
wxFILE_KIND_DISK, ///< A file supporting seeking to arbitrary offsets
wxFILE_KIND_TERMINAL, ///< A tty
wxFILE_KIND_PIPE ///< A pipe
};
//@}
/** @ingroup group_funcmacro_file */
//@{
/**
Returns the type of an open file. Possible return values are enumerations
of ::wxFileKind.
@header{wx/filefn.h}
*/
wxFileKind wxGetFileKind(int fd);
wxFileKind wxGetFileKind(FILE* fp);
//@}
/** @ingroup group_funcmacro_file */
//@{
/**
@warning This function is obsolete, please use wxFileName::SplitPath()
instead.
Returns the filename for a full path. The second form returns a pointer to
temporary storage that should not be deallocated.
@header{wx/filefn.h}
*/
wxString wxFileNameFromPath(const wxString& path);
char* wxFileNameFromPath(char* path);
//@}
/** @ingroup group_funcmacro_file */
//@{
/**
@warning This function is obsolete, please use
wxFileName::CreateTempFileName() instead.
@header{wx/filefn.h}
*/
char* wxGetTempFileName(const wxString& prefix, char* buf = NULL);
bool wxGetTempFileName(const wxString& prefix, wxString& buf);
//@}

1004
interface/wx/filename.h Normal file

File diff suppressed because it is too large Load Diff

277
interface/wx/filepicker.h Normal file
View File

@@ -0,0 +1,277 @@
/////////////////////////////////////////////////////////////////////////////
// Name: filepicker.h
// Purpose: interface of wxFilePickerCtrl
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxFilePickerCtrl
@wxheader{filepicker.h}
This control allows the user to select a file. The generic implementation is
a button which brings up a wxFileDialog when clicked. Native implementation
may differ but this is usually a (small) widget which give access to the
file-chooser
dialog.
It is only available if @c wxUSE_FILEPICKERCTRL is set to 1 (the default).
@beginStyleTable
@style{wxFLP_DEFAULT_STYLE}
The default style: includes wxFLP_OPEN | wxFLP_FILE_MUST_EXIST and,
under wxMSW only, wxFLP_USE_TEXTCTRL.
@style{wxFLP_USE_TEXTCTRL}
Creates a text control to the left of the picker button which is
completely managed by the wxFilePickerCtrl and which can be used by
the user to specify a path (see SetPath). The text control is
automatically synchronized with button's value. Use functions
defined in wxPickerBase to modify the text control.
@style{wxFLP_OPEN}
Creates a picker which allows the user to select a file to open.
@style{wxFLP_SAVE}
Creates a picker which allows the user to select a file to save.
@style{wxFLP_OVERWRITE_PROMPT}
Can be combined with wxFLP_SAVE only: ask confirmation to the user
before selecting a file.
@style{wxFLP_FILE_MUST_EXIST}
Can be combined with wxFLP_OPEN only: the selected file must be an
existing file.
@style{wxFLP_CHANGE_DIR}
Change current working directory on each user file selection change.
@endStyleTable
@library{wxcore}
@category{pickers}
<!-- @appearance{filepickerctrl.png} -->
@see wxFileDialog, wxFileDirPickerEvent
*/
class wxFilePickerCtrl : public wxPickerBase
{
public:
/**
Initializes the object and calls Create() with
all the parameters.
*/
wxFilePickerCtrl(wxWindow* parent, wxWindowID id,
const wxString& path = wxEmptyString,
const wxString& message = "Select a file",
const wxString& wildcard = ".",
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxFLP_DEFAULT_STYLE,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = "filepickerctrl");
/**
@param parent
Parent window, must not be non-@NULL.
@param id
The identifier for the control.
@param path
The initial file shown in the control. Must be a valid path to a file or
the empty string.
@param message
The message shown to the user in the wxFileDialog shown by the control.
@param wildcard
A wildcard which defines user-selectable files (use the same syntax as for
wxFileDialog's wildcards).
@param pos
Initial position.
@param size
Initial size.
@param style
The window style, see wxFLP_* flags.
@param validator
Validator which can be used for additional date checks.
@param name
Control name.
@return @true if the control was successfully created or @false if
creation failed.
*/
bool Create(wxWindow* parent, wxWindowID id,
const wxString& path = wxEmptyString,
const wxString& message = "Select a file",
const wxString& wildcard = ".",
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxFLP_DEFAULT_STYLE,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = "filepickerctrl");
/**
Similar to GetPath() but returns the path of
the currently selected file as a wxFileName object.
*/
wxFileName GetFileName() const;
/**
Returns the absolute path of the currently selected file.
*/
wxString GetPath() const;
/**
This method does the same thing as SetPath() but
takes a wxFileName object instead of a string.
*/
void SetFileName(const wxFileName& filename);
/**
Sets the absolute path of the currently selected file. This must be a valid
file if
the @c wxFLP_FILE_MUST_EXIST style was given.
*/
void SetPath(const wxString& filename);
};
/**
@class wxDirPickerCtrl
@wxheader{filepicker.h}
This control allows the user to select a directory. The generic implementation
is
a button which brings up a wxDirDialog when clicked. Native implementation
may differ but this is usually a (small) widget which give access to the
dir-chooser
dialog.
It is only available if @c wxUSE_DIRPICKERCTRL is set to 1 (the default).
@beginStyleTable
@style{wxDIRP_DEFAULT_STYLE}
The default style: includes wxDIRP_DIR_MUST_EXIST and, under wxMSW
only, wxDIRP_USE_TEXTCTRL.
@style{wxDIRP_USE_TEXTCTRL}
Creates a text control to the left of the picker button which is
completely managed by the wxDirPickerCtrl and which can be used by
the user to specify a path (see SetPath). The text control is
automatically synchronized with button's value. Use functions
defined in wxPickerBase to modify the text control.
@style{wxDIRP_DIR_MUST_EXIST}
Creates a picker which allows to select only existing directories.
wxGTK control always adds this flag internally as it does not
support its absence.
@style{wxDIRP_CHANGE_DIR}
Change current working directory on each user directory selection
change.
@endStyleTable
@library{wxcore}
@category{pickers}
<!-- @appearance{dirpickerctrl.png} -->
@see wxDirDialog, wxFileDirPickerEvent
*/
class wxDirPickerCtrl : public wxPickerBase
{
public:
/**
Initializes the object and calls Create() with
all the parameters.
*/
wxDirPickerCtrl(wxWindow* parent, wxWindowID id,
const wxString& path = wxEmptyString,
const wxString& message = "Select a folder",
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDIRP_DEFAULT_STYLE,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = "dirpickerctrl");
/**
@param parent
Parent window, must not be non-@NULL.
@param id
The identifier for the control.
@param path
The initial directory shown in the control. Must be a valid path to a
directory or the empty string.
@param message
The message shown to the user in the wxDirDialog shown by the control.
@param pos
Initial position.
@param size
Initial size.
@param style
The window style, see wxDIRP_* flags.
@param validator
Validator which can be used for additional date checks.
@param name
Control name.
@return @true if the control was successfully created or @false if
creation failed.
*/
bool Create(wxWindow* parent, wxWindowID id,
const wxString& path = wxEmptyString,
const wxString& message = "Select a folder",
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDIRP_DEFAULT_STYLE,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = "dirpickerctrl");
/**
Returns the absolute path of the currently selected directory as a wxFileName
object.
This function is equivalent to GetPath()
*/
wxFileName GetDirName() const;
/**
Returns the absolute path of the currently selected directory.
*/
wxString GetPath() const;
/**
Just like SetPath() but this function takes a
wxFileName object.
*/
void SetDirName(const wxFileName& dirname);
/**
Sets the absolute path of (the default converter uses current locale's
charset)the currently selected directory. This must be a valid directory if
@c wxDIRP_DIR_MUST_EXIST style was given.
*/
void SetPath(const wxString& dirname);
};
/**
@class wxFileDirPickerEvent
@wxheader{filepicker.h}
This event class is used for the events generated by
wxFilePickerCtrl and by wxDirPickerCtrl.
@library{wxcore}
@category{FIXME}
@see wxfilepickerctrl()
*/
class wxFileDirPickerEvent : public wxCommandEvent
{
public:
/**
The constructor is not normally used by the user code.
*/
wxFileDirPickerEvent(wxEventType type, wxObject* generator,
int id,
const wxString path);
/**
Retrieve the absolute path of the file/directory the user has just selected.
*/
wxString GetPath() const;
/**
Set the absolute path of the file/directory associated with the event.
*/
void SetPath(const wxString& path);
};

450
interface/wx/filesys.h Normal file
View File

@@ -0,0 +1,450 @@
/////////////////////////////////////////////////////////////////////////////
// Name: filesys.h
// Purpose: interface of wxFileSystem, wxFileSystemHandler, wxFSFile
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
Open Bit Flags
*/
enum wxFileSystemOpenFlags
{
wxFS_READ = 1, /**< Open for reading */
wxFS_SEEKABLE = 4 /**< Returned stream will be seekable */
};
/**
@class wxFileSystem
@wxheader{filesys.h}
This class provides an interface for opening files on different file systems.
It can handle absolute and/or local filenames.
It uses a system of handlers (see wxFileSystemHandler) to provide access to
user-defined virtual file systems.
@library{wxbase}
@category{vfs}
@see wxFileSystemHandler, wxFSFile, @ref overview_fs
*/
class wxFileSystem : public wxObject
{
public:
/**
Constructor.
*/
wxFileSystem();
/**
This static function adds new handler into the list of handlers
(see wxFileSystemHandler) which provide access to virtual FS.
Note that if two handlers for the same protocol are added, the last
added one takes precedence.
@note You can call:
@code
wxFileSystem::AddHandler(new My_FS_Handler);
@endcode
This is because (a) AddHandler is a static method, and (b) the
handlers are deleted in wxFileSystem's destructor so that you
don't have to care about it.
*/
static void AddHandler(wxFileSystemHandler handler);
/**
Sets the current location. @a location parameter passed to OpenFile() is
relative to this path.
@remarks Unless @a is_dir is @true the @a location parameter is not the
directory name but the name of the file in this directory.
All these commands change the path to "dir/subdir/":
@code
ChangePathTo("dir/subdir/xh.htm");
ChangePathTo("dir/subdir", true);
ChangePathTo("dir/subdir/", true);
@endcode
Example:
@code
f = fs->OpenFile("hello.htm"); // opens file 'hello.htm'
fs->ChangePathTo("subdir/folder", true);
f = fs->OpenFile("hello.htm"); // opens file 'subdir/folder/hello.htm' !!
@endcode
@param location
the new location. Its meaning depends on the value of is_dir
@param is_dir
if @true location is new directory.
If @false (the default) location is file in the new directory.
*/
void ChangePathTo(const wxString& location, bool is_dir = false);
/**
Converts a wxFileName into an URL.
@see URLToFileName(), wxFileName
*/
static wxString FileNameToURL(const wxFileName& filename);
/**
Looks for the file with the given name @a file in a colon or semi-colon
(depending on the current platform) separated list of directories in @a path.
If the file is found in any directory, returns @true and the full path
of the file in @a str, otherwise returns @false and doesn't modify @a str.
@param str
Receives the full path of the file, must not be @NULL
@param path
wxPATH_SEP-separated list of directories
@param file
the name of the file to look for
*/
bool FindFileInPath(wxString str, const wxString& path,
const wxString& file);
/**
Works like ::wxFindFirstFile().
Returns the name of the first filename (within filesystem's current path)
that matches @a wildcard.
@param wildcard
The wildcard that the filename must match
@param flags
One of wxFILE (only files), wxDIR (only directories) or 0 (both).
*/
wxString FindFirst(const wxString& wildcard, int flags = 0);
/**
Returns the next filename that matches the parameters passed to FindFirst().
*/
wxString FindNext();
/**
Returns the actual path (set by wxFileSystem::ChangePathTo).
*/
wxString GetPath();
/**
This static function returns @true if there is a registered handler which can
open the given location.
*/
static bool HasHandlerForPath(const wxString& location);
/**
Opens the file and returns a pointer to a wxFSFile object or @NULL if failed.
It first tries to open the file in relative scope (based on value passed to
ChangePathTo() method) and then as an absolute path.
Note that the user is responsible for deleting the returned wxFSFile.
@a flags can be one or more of the ::wxFileSystemOpenFlags values
combined together.
A stream opened with just the default @e wxFS_READ flag may
or may not be seekable depending on the underlying source.
Passing @e "wxFS_READ | wxFS_SEEKABLE" for @a flags will back
a stream that is not natively seekable with memory or a file
and return a stream that is always seekable.
*/
wxFSFile* OpenFile(const wxString& location,
int flags = wxFS_READ);
/**
Converts URL into a well-formed filename.
The URL must use the @c file protocol.
*/
static wxFileName URLToFileName(const wxString& url);
};
/**
@class wxFSFile
@wxheader{filesys.h}
This class represents a single file opened by wxFileSystem.
It provides more information than wxWindow's input stream
(stream, filename, mime type, anchor).
@note Any pointer returned by a method of wxFSFile is valid only as long as
the wxFSFile object exists. For example a call to GetStream()
doesn't @e create the stream but only returns the pointer to it.
In other words after 10 calls to GetStream() you will have obtained
ten identical pointers.
@library{wxbase}
@category{vfs}
@see wxFileSystemHandler, wxFileSystem, @ref overview_fs
*/
class wxFSFile : public wxObject
{
public:
/**
Constructor. You probably won't use it. See the Note for details.
It is seldom used by the application programmer but you will need it if
you are writing your own virtual FS. For example you may need something
similar to wxMemoryInputStream, but because wxMemoryInputStream doesn't
free the memory when destroyed and thus passing a memory stream pointer
into wxFSFile constructor would lead to memory leaks, you can write your
own class derived from wxFSFile:
@code
class wxMyFSFile : public wxFSFile
{
private:
void *m_Mem;
public:
wxMyFSFile(.....)
~wxMyFSFile() {free(m_Mem);}
// of course dtor is virtual ;-)
};
@endcode
If you are not sure of the meaning of these params, see the description
of the GetXXXX() functions.
@param stream
The input stream that will be used to access data
@param location
The full location (aka filename) of the file
@param mimetype
MIME type of this file. It may be left empty, in which
case the type will be determined from file's extension (location must
not be empty in this case).
@param anchor
Anchor. See GetAnchor() for details.
*/
wxFSFile(wxInputStream stream, const wxString& loc,
const wxString& mimetype,
const wxString& anchor, wxDateTime modif);
/**
Detaches the stream from the wxFSFile object. That is, the
stream obtained with GetStream() will continue its existance
after the wxFSFile object is deleted.
You will have to delete the stream yourself.
*/
void DetachStream();
/**
Returns anchor (if present). The term of @b anchor can be easily
explained using few examples:
@verbatim
index.htm#anchor // 'anchor' is anchor
index/wx001.htm // NO anchor here!
archive/main.zip#zip:index.htm#global // 'global'
archive/main.zip#zip:index.htm // NO anchor here!
@endverbatim
Usually an anchor is presented only if the MIME type is 'text/html'.
But it may have some meaning with other files; for example myanim.avi#200
may refer to position in animation or reality.wrl#MyView may refer
to a predefined view in VRML.
*/
const wxString& GetAnchor() const;
/**
Returns full location of the file, including path and protocol.
Examples:
@verbatim
http://www.wxwidgets.org
http://www.ms.mff.cuni.cz/~vsla8348/wxhtml/archive.zip#zip:info.txt
file:/home/vasek/index.htm
relative-file.htm
@endverbatim
*/
const wxString& GetLocation() const;
/**
Returns the MIME type of the content of this file.
It is either extension-based (see wxMimeTypesManager) or extracted from
HTTP protocol Content-Type header.
*/
const wxString& GetMimeType() const;
/**
Returns time when this file was modified.
*/
wxDateTime GetModificationTime() const;
/**
Returns pointer to the stream.
You can use the returned stream to directly access data.
You may suppose that the stream provide Seek and GetSize functionality
(even in the case of the HTTP protocol which doesn't provide
this by default. wxHtml uses local cache to work around
this and to speed up the connection).
*/
wxInputStream* GetStream() const;
};
/**
@class wxFileSystemHandler
@wxheader{filesys.h}
Classes derived from wxFileSystemHandler are used to access virtual file systems.
Its public interface consists of two methods: wxFileSystemHandler::CanOpen
and wxFileSystemHandler::OpenFile.
It provides additional protected methods to simplify the process
of opening the file: GetProtocol(), GetLeftLocation(), GetRightLocation(),
GetAnchor(), GetMimeTypeFromExt().
Please have a look at overview (see wxFileSystem) if you don't know how locations
are constructed.
Also consult the @ref overview_fs_wxhtmlfs "list of available handlers".
Note that the handlers are shared by all instances of wxFileSystem.
@remarks
wxHTML library provides handlers for local files and HTTP or FTP protocol.
@note
The location parameter passed to OpenFile() or CanOpen() methods is always an
absolute path. You don't need to check the FS's current path.
@beginWxPerlOnly
In wxPerl, you need to derive your file system handler class
from Wx::PlFileSystemHandler.
@endWxPerlOnly
@library{wxbase}
@category{vfs}
@see wxFileSystem, wxFSFile, @ref overview_fs
*/
class wxFileSystemHandler : public wxObject
{
public:
/**
Constructor.
*/
wxFileSystemHandler();
/**
Returns @true if the handler is able to open this file. This function doesn't
check whether the file exists or not, it only checks if it knows the protocol.
Example:
@code
bool MyHand::CanOpen(const wxString& location)
{
return (GetProtocol(location) == "http");
}
@endcode
Must be overridden in derived handlers.
*/
virtual bool CanOpen(const wxString& location);
/**
Works like ::wxFindFirstFile().
Returns the name of the first filename (within filesystem's current path)
that matches @e wildcard. @a flags may be one of wxFILE (only files),
wxDIR (only directories) or 0 (both).
This method is only called if CanOpen() returns @true.
*/
virtual wxString FindFirst(const wxString& wildcard,
int flags = 0);
/**
Returns next filename that matches parameters passed to wxFileSystem::FindFirst.
This method is only called if CanOpen() returns @true and FindFirst()
returned a non-empty string.
*/
virtual wxString FindNext();
/**
Returns the anchor if present in the location.
See wxFSFile::GetAnchor for details.
Example:
@code
GetAnchor("index.htm#chapter2") == "chapter2"
@endcode
@note the anchor is NOT part of the left location.
*/
wxString GetAnchor(const wxString& location) const;
/**
Returns the left location string extracted from @e location.
Example:
@code
GetLeftLocation("file:myzipfile.zip#zip:index.htm") == "file:myzipfile.zip"
@endcode
*/
wxString GetLeftLocation(const wxString& location) const;
/**
Returns the MIME type based on @b extension of @a location.
(While wxFSFile::GetMimeType() returns real MIME type - either
extension-based or queried from HTTP.)
Example:
@code
GetMimeTypeFromExt("index.htm") == "text/html"
@endcode
*/
wxString GetMimeTypeFromExt(const wxString& location);
/**
Returns the protocol string extracted from @a location.
Example:
@code
GetProtocol("file:myzipfile.zip#zip:index.htm") == "zip"
@endcode
*/
wxString GetProtocol(const wxString& location) const;
/**
Returns the right location string extracted from @a location.
Example:
@code
GetRightLocation("file:myzipfile.zip#zip:index.htm") == "index.htm"
@endcode
*/
wxString GetRightLocation(const wxString& location) const;
/**
Opens the file and returns wxFSFile pointer or @NULL if failed.
Must be overridden in derived handlers.
@param fs
Parent FS (the FS from that OpenFile was called).
See the ZIP handler for details of how to use it.
@param location
The absolute location of file.
*/
virtual wxFSFile* OpenFile(wxFileSystem& fs,
const wxString& location);
};

748
interface/wx/font.h Normal file
View File

@@ -0,0 +1,748 @@
/////////////////////////////////////////////////////////////////////////////
// Name: font.h
// Purpose: interface of wxFont
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxFont
@wxheader{font.h}
A font is an object which determines the appearance of text. Fonts are
used for drawing text to a device context, and setting the appearance of
a window's text.
This class uses @ref overview_trefcount "reference counting and copy-on-write"
internally so that assignments between two instances of this class are very
cheap. You can therefore use actual objects instead of pointers without
efficiency problems. If an instance of this class is changed it will create
its own data internally so that other instances, which previously shared the
data using the reference counting, are not affected.
You can retrieve the current system font settings with wxSystemSettings.
wxSystemSettings
@library{wxcore}
@category{gdi}
@stdobjects
::wxNullFont, ::wxNORMAL_FONT, ::wxSMALL_FONT, ::wxITALIC_FONT, ::wxSWISS_FONT
@see @ref overview_wxfontoverview, wxDC::SetFont, wxDC::DrawText,
wxDC::GetTextExtent, wxFontDialog, wxSystemSettings
*/
class wxFont : public wxGDIObject
{
public:
//@{
/**
Creates a font object with the specified attributes.
@param pointSize
Size in points.
@param pixelSize
Size in pixels: this is directly supported only under MSW
currently where this constructor can be used directly, under other
platforms a
font with the closest size to the given one is found using binary search and
the static New method must be used.
@param family
Font family, a generic way of referring to fonts without specifying actual
facename. One of:
wxFONTFAMILY_DEFAULT
Chooses a default font.
wxFONTFAMILY_DECORATIVE
A decorative font.
wxFONTFAMILY_ROMAN
A formal, serif font.
wxFONTFAMILY_SCRIPT
A handwriting font.
wxFONTFAMILY_SWISS
A sans-serif font.
wxFONTFAMILY_MODERN
A fixed pitch font.
wxFONTFAMILY_TELETYPE
A teletype font.
@param style
One of wxFONTSTYLE_NORMAL, wxFONTSTYLE_SLANT and wxFONTSTYLE_ITALIC.
@param weight
Font weight, sometimes also referred to as font boldness. One of:
wxFONTWEIGHT_NORMAL
Normal font.
wxFONTWEIGHT_LIGHT
Light font.
wxFONTWEIGHT_BOLD
Bold font.
@param underline
The value can be @true or @false. At present this has an effect on Windows
and Motif 2.x only.
@param faceName
An optional string specifying the actual typeface to be used. If it is an
empty string,
a default typeface will be chosen based on the family.
@param encoding
An encoding which may be one of
wxFONTENCODING_SYSTEM
Default system encoding.
wxFONTENCODING_DEFAULT
Default application encoding: this
is the encoding set by calls to
SetDefaultEncoding and which may be set to,
say, KOI8 to create all fonts by default with KOI8 encoding. Initially, the
default application encoding is the same as default system encoding.
wxFONTENCODING_ISO8859_1...15
ISO8859 encodings.
wxFONTENCODING_KOI8
The standard Russian encoding for Internet.
wxFONTENCODING_CP1250...1252
Windows encodings similar to ISO8859 (but not identical).
If the specified encoding isn't available, no font is created
(see also font encoding overview).
@remarks If the desired font does not exist, the closest match will be
chosen. Under Windows, only scalable TrueType fonts are
used.
*/
wxFont();
wxFont(const wxFont& font);
wxFont(int pointSize, wxFontFamily family, int style,
wxFontWeight weight,
const bool underline = false,
const wxString& faceName = "",
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
wxFont(const wxSize& pixelSize, wxFontFamily family,
int style, wxFontWeight weight,
const bool underline = false,
const wxString& faceName = "",
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
//@}
/**
Destructor.
See @ref overview_refcountdestruct "reference-counted object destruction" for
more info.
@remarks Although all remaining fonts are deleted when the application
exits, the application should try to clean up all fonts
itself. This is because wxWidgets cannot know if a
pointer to the font object is stored in an application
data structure, and there is a risk of double deletion.
*/
~wxFont();
/**
Returns the current application's default encoding.
@see @ref overview_wxfontencodingoverview, SetDefaultEncoding()
*/
static wxFontEncoding GetDefaultEncoding();
/**
Returns the typeface name associated with the font, or the empty string if
there is no
typeface information.
@see SetFaceName()
*/
wxString GetFaceName() const;
/**
Gets the font family. See SetFamily() for a list of valid
family identifiers.
@see SetFamily()
*/
wxFontFamily GetFamily() const;
/**
Returns the platform-dependent string completely describing this font.
Returned string is always non-empty.
Note that the returned string is not meant to be shown or edited by the user: a
typical
use of this function is for serializing in string-form a wxFont object.
@see SetNativeFontInfo(),GetNativeFontInfoUserDesc()
*/
wxString GetNativeFontInfoDesc() const;
/**
Returns a user-friendly string for this font object. Returned string is always
non-empty.
Some examples of the formats of returned strings (which are platform-dependent)
are in SetNativeFontInfoUserDesc().
@see GetNativeFontInfoDesc()
*/
wxString GetNativeFontInfoUserDesc();
/**
Gets the point size.
@see SetPointSize()
*/
int GetPointSize() const;
/**
Gets the font style. See wxFont() for a list of valid
styles.
@see SetStyle()
*/
int GetStyle() const;
/**
Returns @true if the font is underlined, @false otherwise.
@see SetUnderlined()
*/
bool GetUnderlined() const;
/**
Gets the font weight. See wxFont() for a list of valid
weight identifiers.
@see SetWeight()
*/
wxFontWeight GetWeight() const;
/**
Returns @true if the font is a fixed width (or monospaced) font,
@false if it is a proportional one or font is invalid.
*/
bool IsFixedWidth() const;
/**
Returns @true if this object is a valid font, @false otherwise.
*/
bool IsOk() const;
//@{
/**
These functions take the same parameters as @ref ctor() wxFont
constructor and return a new font object allocated on the heap.
Using @c New() is currently the only way to directly create a font with
the given size in pixels on platforms other than wxMSW.
*/
static wxFont* New(int pointSize, wxFontFamily family, int style,
wxFontWeight weight,
const bool underline = false,
const wxString& faceName = "",
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
static wxFont* New(int pointSize, wxFontFamily family,
int flags = wxFONTFLAG_DEFAULT,
const wxString& faceName = "",
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
static wxFont* New(const wxSize& pixelSize,
wxFontFamily family,
int style,
wxFontWeight weight,
const bool underline = false,
const wxString& faceName = "",
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
static wxFont* New(const wxSize& pixelSize,
wxFontFamily family,
int flags = wxFONTFLAG_DEFAULT,
const wxString& faceName = "",
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
//@}
/**
Sets the default font encoding.
@see @ref overview_wxfontencodingoverview, GetDefaultEncoding()
*/
static void SetDefaultEncoding(wxFontEncoding encoding);
/**
Sets the facename for the font.
Returns @true if the given face name exists; @false otherwise.
@param faceName
A valid facename, which should be on the end-user's system.
@remarks To avoid portability problems, don't rely on a specific face,
but specify the font family instead or as well. A
suitable font will be found on the end-user's system.
If both the family and the facename are specified,
wxWidgets will first search for the specific face, and
then for a font belonging to the same family.
@see GetFaceName(), SetFamily()
*/
bool SetFaceName(const wxString& faceName);
/**
Sets the font family.
@param family
One of:
wxFONTFAMILY_DEFAULT
Chooses a default font.
wxFONTFAMILY_DECORATIVE
A decorative font.
wxFONTFAMILY_ROMAN
A formal, serif font.
wxFONTFAMILY_SCRIPT
A handwriting font.
wxFONTFAMILY_SWISS
A sans-serif font.
wxFONTFAMILY_MODERN
A fixed pitch font.
wxFONTFAMILY_TELETYPE
A teletype font.
@see GetFamily(), SetFaceName()
*/
void SetFamily(wxFontFamily family);
/**
Creates the font corresponding to the given native font description string and
returns @true if
the creation was successful.
which must have been previously returned by
GetNativeFontInfoDesc(). If the string is
invalid, font is unchanged. This function is typically used for de-serializing
a wxFont
object previously saved in a string-form.
@see SetNativeFontInfoUserDesc()
*/
bool SetNativeFontInfo(const wxString& info);
/**
Creates the font corresponding to the given native font description string and
returns @true if
the creation was successful.
Unlike SetNativeFontInfo(), this function accepts
strings which are user-friendly.
Examples of accepted string formats are:
Generic syntax
Example
on @b wxGTK2: @c [FACE-NAME] [bold] [oblique|italic] [POINTSIZE]
Monospace bold 10
on @b wxMSW: @c [light|bold] [italic] [FACE-NAME] [POINTSIZE] [ENCODING]
Tahoma 10 WINDOWS-1252
on @b wxMac: FIXME
FIXME
For more detailed information about the allowed syntaxes you can look at the
documentation of the native API used for font-rendering (e.g. pango_font_description_from_string).
@see SetNativeFontInfo()
*/
bool SetNativeFontInfoUserDesc(const wxString& info);
/**
Sets the point size.
@param pointSize
Size in points.
@see GetPointSize()
*/
void SetPointSize(int pointSize);
/**
Sets the font style.
@param style
One of wxFONTSTYLE_NORMAL, wxFONTSTYLE_SLANT and wxFONTSTYLE_ITALIC.
@see GetStyle()
*/
void SetStyle(int style);
/**
Sets underlining.
@param underlining
@true to underline, @false otherwise.
@see GetUnderlined()
*/
void SetUnderlined(const bool underlined);
/**
Sets the font weight.
@param weight
One of:
wxFONTWEIGHT_NORMAL
Normal font.
wxFONTWEIGHT_LIGHT
Light font.
wxFONTWEIGHT_BOLD
Bold font.
@see GetWeight()
*/
void SetWeight(wxFontWeight weight);
/**
Inequality operator.
See @ref overview_refcountequality "reference-counted object comparison" for
more info.
*/
bool operator !=(const wxFont& font);
/**
Assignment operator, using @ref overview_trefcount "reference counting".
*/
wxFont operator =(const wxFont& font);
/**
Equality operator.
See @ref overview_refcountequality "reference-counted object comparison" for
more info.
*/
bool operator ==(const wxFont& font);
};
/**
An empty wxFont.
*/
wxFont wxNullFont;
/**
FIXME
*/
wxFont wxNORMAL_FONT;
/**
FIXME
*/
wxFont wxSMALL_FONT;
/**
FIXME
*/
wxFont wxITALIC_FONT;
/**
FIXME
*/
wxFont wxSWISS_FONT;
/**
@class wxFontList
@wxheader{gdicmn.h}
A font list is a list containing all fonts which have been created. There
is only one instance of this class: @b wxTheFontList. Use this object to search
for a previously created font of the desired type and create it if not already
found.
In some windowing systems, the font may be a scarce resource, so it is best to
reuse old resources if possible. When an application finishes, all fonts will
be
deleted and their resources freed, eliminating the possibility of 'memory
leaks'.
@library{wxcore}
@category{gdi}
@see wxFont
*/
class wxFontList : public wxList
{
public:
/**
Constructor. The application should not construct its own font list:
use the object pointer @b wxTheFontList.
*/
wxFontList();
/**
Finds a font of the given specification, or creates one and adds it to the
list. See the @ref wxFont::ctor "wxFont constructor" for
details of the arguments.
*/
wxFont* FindOrCreateFont(int point_size, int family, int style,
int weight,
bool underline = false,
const wxString& facename = NULL,
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
};
// ============================================================================
// Global functions/macros
// ============================================================================
/** @ingroup group_funcmacro_misc */
//@{
/**
Converts string to a wxFont best represented by the given string. Returns
@true on success.
@see wxToString(const wxFont&)
@header{wx/font.h}
*/
bool wxFromString(const wxString& string, wxFont* font);
/**
Converts the given wxFont into a string.
@see wxFromString(const wxString&, wxFont*)
@header{wx/font.h}
*/
wxString wxToString(const wxFont& font);
//@}

93
interface/wx/fontdlg.h Normal file
View File

@@ -0,0 +1,93 @@
/////////////////////////////////////////////////////////////////////////////
// Name: fontdlg.h
// Purpose: interface of wxFontDialog
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxFontDialog
@wxheader{fontdlg.h}
This class represents the font chooser dialog.
@library{wxcore}
@category{cmndlg}
@see Overview(), wxFontData, wxGetFontFromUser()
*/
class wxFontDialog : public wxDialog
{
public:
//@{
/**
Constructor. Pass a parent window, and optionally the
@ref overview_wxfontdata "font data" object to be used to initialize the dialog
controls. If the default constructor is used,
Create() must be called before the dialog can be
shown.
*/
wxFontDialog();
wxFontDialog(wxWindow* parent);
wxFontDialog(wxWindow* parent, const wxFontData& data);
//@}
//@{
/**
Creates the dialog if it the wxFontDialog object had been initialized using the
default constructor. Returns @true on success and @false if an error
occurred.
*/
bool Create(wxWindow* parent);
bool Create(wxWindow* parent, const wxFontData& data);
//@}
//@{
/**
Returns the @ref overview_wxfontdata "font data" associated with the font
dialog.
*/
const wxFontData GetFontData();
const wxFontData& GetFontData();
//@}
/**
Shows the dialog, returning @c wxID_OK if the user pressed Ok, and
@c wxID_CANCEL otherwise.
If the user cancels the dialog (ShowModal returns @c wxID_CANCEL), no font
will be created. If the user presses OK, a new wxFont will be created and
stored in the font dialog's wxFontData structure.
*/
int ShowModal();
};
// ============================================================================
// Global functions/macros
// ============================================================================
/** @ingroup group_funcmacro_dialog */
//@{
/**
Shows the font selection dialog and returns the font selected by user or
invalid font (use wxFont::IsOk() to test whether a font is valid) if the
dialog was cancelled.
@param parent
The parent window for the font selection dialog.
@param fontInit
If given, this will be the font initially selected in the dialog.
@param caption
If given, this will be used for the dialog caption.
@header{wx/fontdlg.h}
*/
wxFont wxGetFontFromUser(wxWindow* parent,
const wxFont& fontInit,
const wxString& caption = wxEmptyString);
//@}

85
interface/wx/fontenum.h Normal file
View File

@@ -0,0 +1,85 @@
/////////////////////////////////////////////////////////////////////////////
// Name: fontenum.h
// Purpose: interface of wxFontEnumerator
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxFontEnumerator
@wxheader{fontenum.h}
wxFontEnumerator enumerates either all available fonts on the system or only
the ones with given attributes - either only fixed-width (suited for use in
programs such as terminal emulators and the like) or the fonts available in
the given encoding().
To do this, you just have to call one of EnumerateXXX() functions - either
wxFontEnumerator::EnumerateFacenames or
wxFontEnumerator::EnumerateEncodings and the
corresponding callback (wxFontEnumerator::OnFacename or
wxFontEnumerator::OnFontEncoding) will be called
repeatedly until either all fonts satisfying the specified criteria are
exhausted or the callback returns @false.
@library{wxcore}
@category{FIXME}
@see @ref overview_wxfontencodingoverview, @ref overview_samplefont "Font
sample", wxFont, wxFontMapper
*/
class wxFontEnumerator
{
public:
/**
Call OnFontEncoding() for each
encoding supported by the given font - or for each encoding supported by at
least some font if @a font is not specified.
*/
virtual bool EnumerateEncodings(const wxString& font = "");
/**
Call OnFacename() for each font which
supports given encoding (only if it is not wxFONTENCODING_SYSTEM) and is of
fixed width (if @a fixedWidthOnly is @true).
Calling this function with default arguments will result in enumerating all
fonts available on the system.
*/
virtual bool EnumerateFacenames(wxFontEncoding encoding = wxFONTENCODING_SYSTEM,
bool fixedWidthOnly = false);
/**
Return array of strings containing all encodings found by
EnumerateEncodings().
*/
static wxArrayString GetEncodings(const wxString& facename = "");
/**
Return array of strings containing all facenames found by
EnumerateFacenames().
*/
static wxArrayString GetFacenames(wxFontEncoding encoding = wxFONTENCODING_SYSTEM,
bool fixedWidthOnly = false);
/**
Returns @true if the given string is valid face name, i.e. it's the face name
of an installed
font and it can safely be used with wxFont::SetFaceName.
*/
static bool IsValidFacename(const wxString& facename);
/**
Called by EnumerateFacenames() for
each match. Return @true to continue enumeration or @false to stop it.
*/
virtual bool OnFacename(const wxString& font);
/**
Called by EnumerateEncodings() for
each match. Return @true to continue enumeration or @false to stop it.
*/
virtual bool OnFontEncoding(const wxString& font,
const wxString& encoding);
};

176
interface/wx/fontmap.h Normal file
View File

@@ -0,0 +1,176 @@
/////////////////////////////////////////////////////////////////////////////
// Name: fontmap.h
// Purpose: interface of wxFontMapper
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxFontMapper
@wxheader{fontmap.h}
wxFontMapper manages user-definable correspondence between logical font
names and the fonts present on the machine.
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.
In case everything else fails (i.e. there is no record in config file
and "interactive" is @false or user denied to choose any replacement),
the class queries wxEncodingConverter
for "equivalent" encodings (e.g. iso8859-2 and cp1250) and tries them.
@library{wxcore}
@category{misc}
@see wxEncodingConverter, @ref overview_nonenglishoverview "Writing non-English
applications"
*/
class wxFontMapper
{
public:
/**
Default ctor.
*/
wxFontMapper();
/**
Virtual dtor for a base class.
*/
~wxFontMapper();
/**
Returns the encoding for the given charset (in the form of RFC 2046) or
@c wxFONTENCODING_SYSTEM if couldn't decode it.
Be careful when using this function with @a interactive set to @true
(default value) as the function then may show a dialog box to the user which
may lead to unexpected reentrancies and may also take a significantly longer
time than a simple function call. For these reasons, it is almost always a bad
idea to call this function from the event handlers for repeatedly generated
events such as @c EVT_PAINT.
*/
wxFontEncoding CharsetToEncoding(const wxString& charset,
bool interactive = true);
/**
Get the current font mapper object. If there is no current object, creates
one.
@see Set()
*/
static wxFontMapper* Get();
/**
Returns the array of all possible names for the given encoding. The array is
@NULL-terminated. IF it isn't empty, the first name in it is the canonical
encoding name, i.e. the same string as returned by
GetEncodingName().
*/
static const wxChar** GetAllEncodingNames(wxFontEncoding encoding);
//@{
/**
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.
The first form is for wxWidgets' internal use while the second one
is better suitable for general use -- it returns wxFontEncoding which
can consequently be passed to wxFont constructor.
*/
bool GetAltForEncoding(wxFontEncoding encoding,
wxNativeEncodingInfo* info,
const wxString& facename = wxEmptyString,
bool interactive = true);
bool GetAltForEncoding(wxFontEncoding encoding,
wxFontEncoding* alt_encoding,
const wxString& facename = wxEmptyString,
bool interactive = true);
//@}
/**
Returns the @e n-th supported encoding. Together with
GetSupportedEncodingsCount()
this method may be used to get all supported encodings.
*/
static wxFontEncoding GetEncoding(size_t n);
/**
Return user-readable string describing the given encoding.
*/
static wxString GetEncodingDescription(wxFontEncoding encoding);
/**
Return the encoding corresponding to the given internal name. This function is
the inverse of GetEncodingName() and is
intentionally less general than
CharsetToEncoding(), i.e. it doesn't
try to make any guesses nor ever asks the user. It is meant just as a way of
restoring objects previously serialized using
GetEncodingName().
*/
static wxFontEncoding GetEncodingFromName(const wxString& encoding);
/**
Return internal string identifier for the encoding (see also
wxFontMapper::GetEncodingDescription)
@see GetEncodingFromName()
*/
static wxString GetEncodingName(wxFontEncoding encoding);
/**
Returns the number of the font encodings supported by this class. Together with
GetEncoding() this method may be used to get
all supported encodings.
*/
static size_t GetSupportedEncodingsCount();
/**
Check whether given encoding is available in given face or not.
If no facename is given, find @e any font in this encoding.
*/
bool IsEncodingAvailable(wxFontEncoding encoding,
const wxString& facename = wxEmptyString);
/**
Set the current font mapper object and return previous one (may be @NULL).
This method is only useful if you want to plug-in an alternative font mapper
into wxWidgets.
@see Get()
*/
static wxFontMapper* Set(wxFontMapper* mapper);
/**
Set the config object to use (may be @NULL to use default).
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().
*/
void SetConfig(wxConfigBase* config);
/**
Set the root config path to use (should be an absolute path).
*/
void SetConfigPath(const wxString& prefix);
/**
The parent window for modal dialogs.
*/
void SetDialogParent(wxWindow* parent);
/**
The title for the dialogs (note that default is quite reasonable).
*/
void SetDialogTitle(const wxString& title);
};

153
interface/wx/fontpicker.h Normal file
View File

@@ -0,0 +1,153 @@
/////////////////////////////////////////////////////////////////////////////
// Name: fontpicker.h
// Purpose: interface of wxFontPickerCtrl
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxFontPickerCtrl
@wxheader{fontpicker.h}
This control allows the user to select a font. The generic implementation is
a button which brings up a wxFontDialog when clicked. Native implementation
may differ but this is usually a (small) widget which give access to the
font-chooser
dialog.
It is only available if @c wxUSE_FONTPICKERCTRL is set to 1 (the default).
@beginStyleTable
@style{wxFNTP_DEFAULT_STYLE}
The default style: wxFNTP_FONTDESC_AS_LABEL |
wxFNTP_USEFONT_FOR_LABEL.
@style{wxFNTP_USE_TEXTCTRL}
Creates a text control to the left of the picker button which is
completely managed by the wxFontPickerCtrl and which can be used by
the user to specify a font (see SetSelectedFont). The text control
is automatically synchronized with button's value. Use functions
defined in wxPickerBase to modify the text control.
@style{wxFNTP_FONTDESC_AS_LABEL}
Keeps the label of the button updated with the fontface name and
the font size. E.g. choosing "Times New Roman bold, italic with
size 10" from the fontdialog, will update the label (overwriting
any previous label) with the "Times New Roman, 10" text.
@style{wxFNTP_USEFONT_FOR_LABEL}
Uses the currently selected font to draw the label of the button.
@endStyleTable
@library{wxcore}
@category{pickers}
<!-- @appearance{fontpickerctrl.png} -->
@see wxFontDialog, wxFontPickerEvent
*/
class wxFontPickerCtrl : public wxPickerBase
{
public:
/**
Initializes the object and calls Create() with
all the parameters.
*/
wxFontPickerCtrl(wxWindow* parent, wxWindowID id,
const wxFont& font = wxNullFont,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxFNTP_DEFAULT_STYLE,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = "fontpickerctrl");
/**
@param parent
Parent window, must not be non-@NULL.
@param id
The identifier for the control.
@param font
The initial font shown in the control. If wxNullFont
is given, the default font is used.
@param pos
Initial position.
@param size
Initial size.
@param style
The window style, see wxFNTP_* flags.
@param validator
Validator which can be used for additional date checks.
@param name
Control name.
@return @true if the control was successfully created or @false if
creation failed.
*/
bool Create(wxWindow* parent, wxWindowID id,
const wxFont& font = wxNullFont,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxFNTP_DEFAULT_STYLE,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = "fontpickerctrl");
/**
Returns the maximum point size value allowed for the user-chosen font.
*/
unsigned int GetMaxPointSize() const;
/**
Returns the currently selected font.
Note that this function is completely different from wxWindow::GetFont.
*/
wxFont GetSelectedFont() const;
/**
Sets the maximum point size value allowed for the user-chosen font.
The default value is 100. Note that big fonts can require a lot of memory and
CPU time
both for creation and for rendering; thus, specially because the user has the
option to specify
the fontsize through a text control (see wxFNTP_USE_TEXTCTRL), it's a good idea
to put a limit
to the maximum font size when huge fonts do not make much sense.
*/
void GetMaxPointSize(unsigned int max);
/**
Sets the currently selected font.
Note that this function is completely different from wxWindow::SetFont.
*/
void SetSelectedFont(const wxFont& font);
};
/**
@class wxFontPickerEvent
@wxheader{fontpicker.h}
This event class is used for the events generated by
wxFontPickerCtrl.
@library{wxcore}
@category{FIXME}
@see wxFontPickerCtrl
*/
class wxFontPickerEvent : public wxCommandEvent
{
public:
/**
The constructor is not normally used by the user code.
*/
wxFontPickerEvent(wxObject* generator, int id,
const wxFont& font);
/**
Retrieve the font the user has just selected.
*/
wxFont GetFont() const;
/**
Set the font associated with the event.
*/
void SetFont(const wxFont& f);
};

410
interface/wx/frame.h Normal file
View File

@@ -0,0 +1,410 @@
/////////////////////////////////////////////////////////////////////////////
// Name: frame.h
// Purpose: interface of wxFrame
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxFrame
@wxheader{frame.h}
A frame is a window whose size and position can (usually) be changed by the user.
It usually has thick borders and a title bar, and can optionally contain a
menu bar, toolbar and status bar. A frame can contain any window that is not
a frame or dialog.
A frame that has a status bar and toolbar, created via the CreateStatusBar() and
CreateToolBar() functions, manages these windows and adjusts the value returned
by GetClientSize() to reflect the remaining size available to application windows.
@remarks An application should normally define an wxCloseEvent handler for the
frame to respond to system close events, for example so that related
data and subwindows can be cleaned up.
@section wxframe_defaultevent Default event processing
wxFrame processes the following events:
@li @c wxEVT_SIZE: if the frame has exactly one child window, not counting the
status and toolbar, this child is resized to take the entire frame client area.
If two or more windows are present, they should be laid out explicitly either
by manually handling wxEVT_SIZE or using sizers;
@li @c wxEVT_MENU_HIGHLIGHT: the default implementation displays the help string
associated with the selected item in the first pane of the status bar, if there is one.
@beginStyleTable
@style{wxDEFAULT_FRAME_STYLE}
Defined as wxMINIMIZE_BOX | wxMAXIMIZE_BOX | wxRESIZE_BORDER |
wxSYSTEM_MENU | wxCAPTION | wxCLOSE_BOX | wxCLIP_CHILDREN.
@style{wxICONIZE}
Display the frame iconized (minimized). Windows only.
@style{wxCAPTION}
Puts a caption on the frame.
@style{wxMINIMIZE}
Identical to wxICONIZE. Windows only.
@style{wxMINIMIZE_BOX}
Displays a minimize box on the frame.
@style{wxMAXIMIZE}
Displays the frame maximized. Windows only.
@style{wxMAXIMIZE_BOX}
Displays a maximize box on the frame.
@style{wxCLOSE_BOX}
Displays a close box on the frame.
@style{wxSTAY_ON_TOP}
Stay on top of all other windows, see also wxFRAME_FLOAT_ON_PARENT.
@style{wxSYSTEM_MENU}
Displays a system menu.
@style{wxRESIZE_BORDER}
Displays a resizeable border around the window.
@style{wxFRAME_TOOL_WINDOW}
Causes a frame with a small titlebar to be created; the frame does
not appear in the taskbar under Windows or GTK+.
@style{wxFRAME_NO_TASKBAR}
Creates an otherwise normal frame but it does not appear in the
taskbar under Windows or GTK+ (note that it will minimize to the
desktop window under Windows which may seem strange to the users
and thus it might be better to use this style only without
wxMINIMIZE_BOX style). In wxGTK, the flag is respected only if GTK+
is at least version 2.2 and the window manager supports
_NET_WM_STATE_SKIP_TASKBAR hint. Has no effect under other platforms.
@style{wxFRAME_FLOAT_ON_PARENT}
The frame will always be on top of its parent (unlike wxSTAY_ON_TOP).
A frame created with this style must have a non-@NULL parent.
@style{wxFRAME_SHAPED}
Windows with this style are allowed to have their shape changed
with the SetShape() method.
@endStyleTable
The default frame style is for normal, resizeable frames.
To create a frame which can not be resized by user, you may use the following
combination of styles:
@code
wxDEFAULT_FRAME_STYLE & ~(wxRESIZE_BORDER | wxRESIZE_BOX | wxMAXIMIZE_BOX)
@endcode
See also the @ref overview_windowstyles.
@beginExtraStyleTable
@style{wxFRAME_EX_CONTEXTHELP}
Under Windows, puts a query button on the caption. When pressed,
Windows will go into a context-sensitive help mode and wxWidgets
will send a wxEVT_HELP event if the user clicked on an application
window. Note that this is an extended style and must be set by
calling SetExtraStyle before Create is called (two-step
construction). You cannot use this style together with
wxMAXIMIZE_BOX or wxMINIMIZE_BOX, so you should use
wxDEFAULT_FRAME_STYLE ~ (wxMINIMIZE_BOX | wxMAXIMIZE_BOX) for the
frames having this style (the dialogs don't have a minimize or a
maximize box by default)
@style{wxFRAME_EX_METAL}
On Mac OS X, frames with this style will be shown with a metallic
look. This is an extra style.
@endExtraStyleTable
@library{wxcore}
@category{managedwnd}
@see wxMDIParentFrame, wxMDIChildFrame, wxMiniFrame, wxDialog
*/
class wxFrame : public wxTopLevelWindow
{
public:
//@{
/**
Constructor, creating the window.
@param parent
The window parent. This may be @NULL. If it is non-@NULL, the frame will
always be displayed on top of the parent window on Windows.
@param id
The window identifier. It may take a value of -1 to indicate a default
value.
@param title
The caption to be displayed on the frame's title bar.
@param pos
The window position. The value wxDefaultPosition indicates a default position,
chosen by
either the windowing system or wxWidgets, depending on platform.
@param size
The window size. The value wxDefaultSize indicates a default size, chosen by
either the windowing system or wxWidgets, depending on platform.
@param style
The window style. See wxFrame.
@param name
The name of the window. This parameter is used to associate a name with the
item,
allowing the application user to set Motif resource values for
individual windows.
@remarks For Motif, MWM (the Motif Window Manager) should be running for
any window styles to work (otherwise all styles take
effect).
@see Create()
*/
wxFrame();
wxFrame(wxWindow* parent, wxWindowID id,
const wxString& title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE,
const wxString& name = "frame");
//@}
/**
Destructor. Destroys all child windows and menu bar if present.
*/
~wxFrame();
/**
Centres the frame on the display.
@param direction
The parameter may be wxHORIZONTAL, wxVERTICAL or wxBOTH.
*/
void Centre(int direction = wxBOTH);
/**
Used in two-step frame construction. See wxFrame()
for further details.
*/
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 = "frame");
/**
Creates a status bar at the bottom of the frame.
@param number
The number of fields to create. Specify a
value greater than 1 to create a multi-field status bar.
@param style
The status bar style. See wxStatusBar for a list
of valid styles.
@param id
The status bar window identifier. If -1, an identifier will be chosen by
wxWidgets.
@param name
The status bar window name.
@return A pointer to the status bar if it was created successfully, @NULL
otherwise.
@remarks The width of the status bar is the whole width of the frame
(adjusted automatically when resizing), and the height
and text size are chosen by the host windowing system.
@see SetStatusText(), OnCreateStatusBar(), GetStatusBar()
*/
virtual wxStatusBar* CreateStatusBar(int number = 1,
long style = 0,
wxWindowID id = -1,
const wxString& name = "statusBar");
/**
Creates a toolbar at the top or left of the frame.
@param style
The toolbar style. See wxToolBar for a list
of valid styles.
@param id
The toolbar window identifier. If -1, an identifier will be chosen by
wxWidgets.
@param name
The toolbar window name.
@return A pointer to the toolbar if it was created successfully, @NULL
otherwise.
@remarks By default, the toolbar is an instance of wxToolBar (which is
defined to be a suitable toolbar class on each
platform, such as wxToolBar95). To use a different
class, override OnCreateToolBar().
@see CreateStatusBar(), OnCreateToolBar(), SetToolBar(),
GetToolBar()
*/
virtual wxToolBar* CreateToolBar(long style = wxBORDER_NONE | wxTB_HORIZONTAL,
wxWindowID id = -1,
const wxString& name = "toolBar");
/**
Returns the origin of the frame client area (in client coordinates). It may be
different from (0, 0) if the frame has a toolbar.
*/
wxPoint GetClientAreaOrigin() const;
/**
Returns a pointer to the menubar currently associated with the frame (if any).
@see SetMenuBar(), wxMenuBar, wxMenu
*/
wxMenuBar* GetMenuBar() const;
/**
Returns a pointer to the status bar currently associated with the frame (if
any).
@see CreateStatusBar(), wxStatusBar
*/
wxStatusBar* GetStatusBar() const;
/**
Returns the status bar pane used to display menu and toolbar help.
@see SetStatusBarPane()
*/
int GetStatusBarPane();
/**
Returns a pointer to the toolbar currently associated with the frame (if any).
@see CreateToolBar(), wxToolBar, SetToolBar()
*/
wxToolBar* GetToolBar() const;
/**
Virtual function called when a status bar is requested by CreateStatusBar().
@param number
The number of fields to create.
@param style
The window style. See wxStatusBar for a list
of valid styles.
@param id
The window identifier. If -1, an identifier will be chosen by
wxWidgets.
@param name
The window name.
@return A status bar object.
@remarks An application can override this function to return a different
kind of status bar. The default implementation returns
an instance of wxStatusBar.
@see CreateStatusBar(), wxStatusBar.
*/
virtual wxStatusBar* OnCreateStatusBar(int number, long style,
wxWindowID id,
const wxString& name);
/**
Virtual function called when a toolbar is requested by CreateToolBar().
@param style
The toolbar style. See wxToolBar for a list
of valid styles.
@param id
The toolbar window identifier. If -1, an identifier will be chosen by
wxWidgets.
@param name
The toolbar window name.
@return A toolbar object.
@remarks An application can override this function to return a different
kind of toolbar. The default implementation returns an
instance of wxToolBar.
@see CreateToolBar(), wxToolBar.
*/
virtual wxToolBar* OnCreateToolBar(long style, wxWindowID id,
const wxString& name);
/**
Simulate a menu command.
@param id
The identifier for a menu item.
*/
void ProcessCommand(int id);
/**
This function sends a dummy @ref overview_wxsizeevent "size event" to the frame
forcing it to reevaluate its children positions. It is sometimes useful to call
this function after adding or deleting a children after the frame creation or
if a child size changes.
Note that if the frame is using either sizers or constraints for the children
layout, it is enough to call wxWindow::Layout directly and
this function should not be used in this case.
*/
void SendSizeEvent();
/**
Tells the frame to show the given menu bar.
@param menuBar
The menu bar to associate with the frame.
@remarks If the frame is destroyed, the menu bar and its menus will be
destroyed also, so do not delete the menu bar
explicitly (except by resetting the frame's menu bar to
another frame or @NULL).
@see GetMenuBar(), wxMenuBar, wxMenu.
*/
void SetMenuBar(wxMenuBar* menuBar);
/**
Associates a status bar with the frame.
@see CreateStatusBar(), wxStatusBar, GetStatusBar()
*/
void SetStatusBar(wxStatusBar* statusBar);
/**
Set the status bar pane used to display menu and toolbar help.
Using -1 disables help display.
*/
void SetStatusBarPane(int n);
/**
Sets the status bar text and redraws the status bar.
@param text
The text for the status field.
@param number
The status field (starting from zero).
@remarks Use an empty string to clear the status bar.
@see CreateStatusBar(), wxStatusBar
*/
virtual void SetStatusText(const wxString& text, int number = 0);
/**
Sets the widths of the fields in the status bar.
@param n
The number of fields in the status bar. It must be the
same used in CreateStatusBar.
@param widths
Must contain an array of n integers, each of which is a status field width
in pixels. A value of -1 indicates that the field is variable width; at
least one
field must be -1. You should delete this array after calling
SetStatusWidths.
@remarks The widths of the variable fields are calculated from the total
width of all fields, minus the sum of widths of the
non-variable fields, divided by the number of variable
fields.
*/
virtual void SetStatusWidths(int n, int* widths);
/**
Associates a toolbar with the frame.
*/
void SetToolBar(wxToolBar* toolBar);
};

116
interface/wx/fs_mem.h Normal file
View File

@@ -0,0 +1,116 @@
/////////////////////////////////////////////////////////////////////////////
// Name: fs_mem.h
// Purpose: interface of wxMemoryFSHandler
// Author: wxWidgets team
// RCS-ID: $Id$
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
/**
@class wxMemoryFSHandler
@wxheader{fs_mem.h}
This wxFileSystem handler can store arbitrary data in memory stream and make
them accessible via an URL.
It is particularly suitable for storing bitmaps from resources or included XPM
files so that they can be used with wxHTML.
Filenames are prefixed with @c "memory:", e.g. @c "memory:myfile.html".
Example:
@code
#ifndef __WXMSW__
#include "logo.xpm"
#endif
void MyFrame::OnAbout(wxCommandEvent&)
{
wxBusyCursor bcur;
wxFileSystem::AddHandler(new wxMemoryFSHandler);
wxMemoryFSHandler::AddFile("logo.pcx", wxBITMAP(logo), wxBITMAP_TYPE_PCX);
wxMemoryFSHandler::AddFile("about.htm",
"<html><body>About: "
"<img src=\"memory:logo.pcx\"></body></html>");
wxDialog dlg(this, -1, wxString(_("About")));
wxBoxSizer *topsizer;
wxHtmlWindow *html;
topsizer = new wxBoxSizer(wxVERTICAL);
html = new wxHtmlWindow(&dlg, -1, wxDefaultPosition,
wxSize(380, 160), wxHW_SCROLLBAR_NEVER);
html->SetBorders(0);
html->LoadPage("memory:about.htm");
html->SetSize(html->GetInternalRepresentation()->GetWidth(),
html->GetInternalRepresentation()->GetHeight());
topsizer->Add(html, 1, wxALL, 10);
topsizer->Add(new wxStaticLine(&dlg, -1), 0, wxEXPAND | wxLEFT | wxRIGHT, 10);
topsizer->Add(new wxButton(&dlg, wxID_OK, "Ok"),
0, wxALL | wxALIGN_RIGHT, 15);
dlg.SetAutoLayout(true);
dlg.SetSizer(topsizer);
topsizer->Fit(&dlg);
dlg.Centre();
dlg.ShowModal();
wxMemoryFSHandler::RemoveFile("logo.pcx");
wxMemoryFSHandler::RemoveFile("about.htm");
}
@endcode
@library{wxbase}
@category{vfs}
@see wxMemoryFSHandler::AddFileWithMimeType
*/
class wxMemoryFSHandler : public wxFileSystemHandler
{
public:
/**
Constructor.
*/
wxMemoryFSHandler();
//@{
/**
Adds a file to the list of the files stored in memory.
Stored data (bitmap, text or raw data) will be copied into private memory
stream and available under name @c "memory:" + @e filename.
@note you must use a @a type value (aka image format) that wxWidgets
can save (e.g. JPG, PNG, see wxImage documentation)!
@see AddFileWithMimeType()
*/
static void AddFile(const wxString& filename, wxImage& image, wxBitmapType type);
static void AddFile(const wxString& filename, const wxBitmap& bitmap, wxBitmapType type);
//@}
//@{
/**
Like AddFile(), but lets you explicitly specify added file's MIME type.
This version should be used whenever you know the MIME type, because it
makes accessing the files faster.
@since 2.8.5
@see AddFile()
*/
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);
//@}
/**
Removes a file from memory FS and frees the occupied memory.
*/
static void RemoveFile(const wxString& filename);
};

Some files were not shown because too many files have changed in this diff Show More