initial commit
Signed-off-by: Peter Siegmund <mars3142@noreply.mars3142.dev>
This commit is contained in:
46
libs/wxWidgets-3.3.1/interface/wx/persist/bookctrl.h
Normal file
46
libs/wxWidgets-3.3.1/interface/wx/persist/bookctrl.h
Normal file
@@ -0,0 +1,46 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/persist/bookctrl.h
|
||||
// Purpose: interface of wxPersistentBookCtrl
|
||||
// Author: Vadim Zeitlin
|
||||
// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
Persistence adapter for wxBookCtrlBase.
|
||||
|
||||
This adapter handles the selected page of wxBookCtrlBase, i.e. it saves its
|
||||
value when the associated book control is destroyed and restores it when it
|
||||
is recreated.
|
||||
|
||||
@see wxPersistentTreeBookCtrl
|
||||
*/
|
||||
class wxPersistentBookCtrl : public wxPersistentWindow<wxBookCtrlBase>
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Constructor.
|
||||
|
||||
@param book
|
||||
The associated book control.
|
||||
*/
|
||||
wxPersistentBookCtrl(wxBookCtrlBase *book);
|
||||
|
||||
/**
|
||||
Save the currently selected page index.
|
||||
*/
|
||||
virtual void Save() const;
|
||||
|
||||
/**
|
||||
Restore the selected page index.
|
||||
|
||||
The book control must be initialized before calling this function, i.e.
|
||||
all of its pages should be already added to it -- otherwise restoring
|
||||
the selection has no effect.
|
||||
*/
|
||||
virtual bool Restore();
|
||||
};
|
||||
|
||||
/// Overload allowing persistence adapter creation for wxBookCtrlBase-derived
|
||||
/// objects.
|
||||
wxPersistentObject *wxCreatePersistentObject(wxBookCtrlBase *book);
|
||||
60
libs/wxWidgets-3.3.1/interface/wx/persist/checkbox.h
Normal file
60
libs/wxWidgets-3.3.1/interface/wx/persist/checkbox.h
Normal file
@@ -0,0 +1,60 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/persist/checkbox.h
|
||||
// Purpose: Interface of wxPersistentCheckBox
|
||||
// Author: Vadim Zeitlin
|
||||
// Created: 2025-06-15
|
||||
// Copyright: (c) 2025 Vadim Zeitlin <vadim@wxwidgets.org>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
Persistence adapter for wxCheckBox controls.
|
||||
|
||||
This adapter saves and restores the state of a wxCheckBox control,
|
||||
|
||||
Example of using it:
|
||||
@code
|
||||
auto* checkbox = new wxCheckBox(this, wxID_ANY, "&Remember me");
|
||||
|
||||
wxPersistentRegisterAndRestore(checkbox);
|
||||
@endcode
|
||||
|
||||
If the checkbox is checked, it will be checked again after the application
|
||||
restart.
|
||||
|
||||
@since 3.3.1
|
||||
*/
|
||||
class wxPersistentCheckBox : public wxPersistentWindow<wxCheckBox>
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Constructor.
|
||||
|
||||
Note that 3-state checkboxes are also supported.
|
||||
|
||||
@param checkbox
|
||||
The associated checkbox.
|
||||
*/
|
||||
explicit wxPersistentCheckBox(wxCheckBox *checkbox);
|
||||
|
||||
/**
|
||||
Save the current checkbox state.
|
||||
|
||||
The state is saved as an integer value corresponding to the numeric
|
||||
value returned by wxCheckBox::Get3StateValue(). For unchecked and
|
||||
checked checkboxes this value is 0 and 1 respectively, as is customary.
|
||||
*/
|
||||
virtual void Save() const;
|
||||
|
||||
/**
|
||||
Restore the previously saved checkbox state.
|
||||
|
||||
If the saved index is valid, i.e. is ::wxCHK_UNCHECKED, ::wxCHK_CHECKED
|
||||
or ::wxCHK_UNDETERMINED if checkbox supports 3rd state, the checkbox
|
||||
state is set to the previously saved value (otherwise it is ignored).
|
||||
*/
|
||||
virtual bool Restore();
|
||||
};
|
||||
|
||||
/// Overload allowing persistence adapter creation for wxCheckBox objects.
|
||||
wxPersistentObject *wxCreatePersistentObject(wxCheckBox *checkbox);
|
||||
77
libs/wxWidgets-3.3.1/interface/wx/persist/combobox.h
Normal file
77
libs/wxWidgets-3.3.1/interface/wx/persist/combobox.h
Normal file
@@ -0,0 +1,77 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/persist/combobox.h
|
||||
// Purpose: Interface of wxPersistentComboBox
|
||||
// Author: Vadim Zeitlin
|
||||
// Created: 2020-11-19
|
||||
// Copyright: (c) 2020 Vadim Zeitlin <vadim@wxwidgets.org>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
Persistence adapter for wxComboBox.
|
||||
|
||||
This adapter saves and restores the items of wxComboBox. A persistent
|
||||
combobox can be used to preserve history of user entries.
|
||||
|
||||
Example of using it:
|
||||
@code
|
||||
// Suppose you need to ask the user to select their favourite Linux
|
||||
// distribution, for some reason:
|
||||
wxComboBox* combo = new wxComboBox(this, wxID_ANY);
|
||||
if ( !wxPersistentRegisterAndRestore(combo, "distribution") )
|
||||
{
|
||||
// Seed it with some default contents.
|
||||
combo->Append("Debian");
|
||||
combo->Append("Fedora");
|
||||
combo->Append("Ubuntu");
|
||||
}
|
||||
|
||||
// Optionally, you might want to restore the last used entry:
|
||||
combo->SetSelection(0);
|
||||
|
||||
@endcode
|
||||
|
||||
@since 3.1.5
|
||||
*/
|
||||
class wxPersistentComboBox : public wxPersistentWindow<wxComboBox>
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Constructor.
|
||||
|
||||
@param combobox
|
||||
The associated combobox.
|
||||
*/
|
||||
explicit wxPersistentComboBox(wxComboBox *combobox);
|
||||
|
||||
/**
|
||||
Save the current items and value.
|
||||
|
||||
The current control value is saved as the first item, so that calling
|
||||
@c SetSelection(0) when the control is created the next time will
|
||||
restore the value which was last used. If the current value is the same
|
||||
as one of the existing items, this item is moved to the front of the
|
||||
list, instead of being added again.
|
||||
|
||||
If the current value is empty, it is not saved at all.
|
||||
|
||||
At most 10 items are saved, if the combobox has more than 10 items, or
|
||||
exactly 10 items and the current value is different from all of them,
|
||||
the items beyond the tenth one are discarded.
|
||||
*/
|
||||
virtual void Save() const;
|
||||
|
||||
/**
|
||||
Restore the combobox items.
|
||||
|
||||
This function doesn't change the current combobox value, you need to
|
||||
call @c SetSelection(0) explicitly, after verifying that the combobox
|
||||
is not empty using its IsListEmpty() method, if you want to restore the
|
||||
last used value automatically. Otherwise the user can always do it by
|
||||
opening the combobox and selecting it manually.
|
||||
*/
|
||||
virtual bool Restore();
|
||||
};
|
||||
|
||||
/// Overload allowing persistence adapter creation for wxComboBox objects.
|
||||
wxPersistentObject *wxCreatePersistentObject(wxComboBox *combobox);
|
||||
42
libs/wxWidgets-3.3.1/interface/wx/persist/dataview.h
Normal file
42
libs/wxWidgets-3.3.1/interface/wx/persist/dataview.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/persist/dataview.h
|
||||
// Purpose: interface of wxPersistentDataViewCtrl
|
||||
// Author: Vadim Zeitlin
|
||||
// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
Persistence adapter for wxDataViewCtrl.
|
||||
|
||||
This adapter handles wxDataViewCtrl column widths and sort order.
|
||||
|
||||
@since 3.1.1
|
||||
*/
|
||||
class wxPersistentDataViewCtrl : public wxPersistentWindow<wxDataViewCtrl>
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Constructor.
|
||||
|
||||
@param control The associated control.
|
||||
*/
|
||||
wxPersistentDataViewCtrl(wxDataViewCtrl* control);
|
||||
|
||||
/**
|
||||
Save the current column widths and sort order.
|
||||
*/
|
||||
void Save() const override;
|
||||
|
||||
/**
|
||||
Restore the column widths and sort order.
|
||||
|
||||
The wxDataViewCtrl must be initialized before calling this function, i.e.
|
||||
all of its columns should be already added to it -- otherwise restoring
|
||||
their width would have no effect.
|
||||
*/
|
||||
bool Restore() override;
|
||||
};
|
||||
|
||||
/// Overload allowing persistence adapter creation for wxDataViewCtrl objects.
|
||||
wxPersistentObject *wxCreatePersistentObject(wxDataViewCtrl *control);
|
||||
75
libs/wxWidgets-3.3.1/interface/wx/persist/radiobut.h
Normal file
75
libs/wxWidgets-3.3.1/interface/wx/persist/radiobut.h
Normal file
@@ -0,0 +1,75 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/persist/radiobutton.h
|
||||
// Purpose: Interface of wxPersistentRadioButton
|
||||
// Author: Vadim Zeitlin
|
||||
// Created: 2025-06-15
|
||||
// Copyright: (c) 2025 Vadim Zeitlin <vadim@wxwidgets.org>
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
Persistence adapter for wxRadioButton controls.
|
||||
|
||||
This adapter saves and restores the index of the selected wxRadioButton in
|
||||
a group of radio buttons, to allow to retain the selection across program
|
||||
executions.
|
||||
|
||||
Example of using it:
|
||||
@code
|
||||
// Assume that all these controls are added to some sizer elsewhere.
|
||||
auto* label = new wxStaticText(this, wxID_ANY, "Play with:");
|
||||
|
||||
auto* black = new wxRadioButton(this, wxID_ANY, "&Black",
|
||||
wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
wxRB_GROUP);
|
||||
auto* white = new wxRadioButton(this, wxID_ANY, "&White");
|
||||
|
||||
// We register the first radio button here, but all radio buttons in the
|
||||
// same group are potentially affected by this call.
|
||||
wxPersistentRegisterAndRestore(black);
|
||||
@endcode
|
||||
|
||||
During the first program execution, black colour will be selected, but if
|
||||
the user selects white pieces, this selection will be restored during the
|
||||
subsequent run.
|
||||
|
||||
@since 3.3.1
|
||||
*/
|
||||
class wxPersistentRadioButton : public wxPersistentWindow<wxRadioButton>
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Constructor.
|
||||
|
||||
Please note that the radio button must be the first one in the group,
|
||||
i.e. have ::wxRB_GROUP style set, otherwise an assertion will be
|
||||
triggered.
|
||||
|
||||
Also note that currently ::wxRB_SINGLE style is not supported.
|
||||
|
||||
@param radiobutton
|
||||
The associated radiobutton.
|
||||
*/
|
||||
explicit wxPersistentRadioButton(wxRadioButton *radiobutton);
|
||||
|
||||
/**
|
||||
Save the currently selected button index.
|
||||
|
||||
The 0-based index of the selected radio button in the group is saved as
|
||||
radio button value.
|
||||
*/
|
||||
virtual void Save() const;
|
||||
|
||||
/**
|
||||
Restore the previously saved selection.
|
||||
|
||||
If the saved index is valid, i.e. is positive and less than the number
|
||||
of radio buttons in the group, the radio button with the corresponding
|
||||
index will be selected.
|
||||
*/
|
||||
virtual bool Restore();
|
||||
};
|
||||
|
||||
/// Overload allowing persistence adapter creation for wxRadioButton objects.
|
||||
wxPersistentObject *wxCreatePersistentObject(wxRadioButton *radiobutton);
|
||||
42
libs/wxWidgets-3.3.1/interface/wx/persist/toplevel.h
Normal file
42
libs/wxWidgets-3.3.1/interface/wx/persist/toplevel.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/persist/toplevel.h
|
||||
// Purpose: interface of wxPersistentTLW
|
||||
// Author: Vadim Zeitlin
|
||||
// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
Persistence adapter for wxTopLevelWindow.
|
||||
|
||||
This adapter saves and restores the geometry (i.e. position and size) and
|
||||
the state (iconized, maximized or normal) of top level windows. It can be
|
||||
used with both wxFrame and wxDialog.
|
||||
|
||||
Note that it does @em not save nor restore the window visibility.
|
||||
*/
|
||||
class wxPersistentTLW : public wxPersistentWindow<wxTopLevelWindow>
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Constructor.
|
||||
|
||||
@param tlw
|
||||
The associated window.
|
||||
*/
|
||||
wxPersistentTLW(wxTopLevelWindow *tlw);
|
||||
|
||||
/**
|
||||
Save the current window geometry.
|
||||
*/
|
||||
virtual void Save() const;
|
||||
|
||||
/**
|
||||
Restore the window geometry.
|
||||
*/
|
||||
virtual bool Restore();
|
||||
};
|
||||
|
||||
/// Overload allowing persistence adapter creation for wxTopLevelWindow-derived
|
||||
/// objects.
|
||||
wxPersistentObject *wxCreatePersistentObject(wxTopLevelWindow *tlw);
|
||||
42
libs/wxWidgets-3.3.1/interface/wx/persist/treebook.h
Normal file
42
libs/wxWidgets-3.3.1/interface/wx/persist/treebook.h
Normal file
@@ -0,0 +1,42 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/persist/treebook.h
|
||||
// Purpose: interface of wxPersistentTreeBook
|
||||
// Author: Vadim Zeitlin
|
||||
// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
Persistence adapter for wxTreebook.
|
||||
|
||||
This adapter saves and restores the expanded branches of the wxTreeCtrl
|
||||
used by wxTreebook, in addition to saving and restoring the selection as
|
||||
implemented by the base wxPersistentBookCtrl class.
|
||||
*/
|
||||
class wxPersistentTreeBookCtrl : public wxPersistentBookCtrl
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Constructor.
|
||||
|
||||
@param book
|
||||
The associated tree book control.
|
||||
*/
|
||||
wxPersistentTreeBookCtrl(wxTreebook *book);
|
||||
|
||||
/**
|
||||
Save the currently opened branches.
|
||||
*/
|
||||
virtual void Save() const;
|
||||
|
||||
/**
|
||||
Restore the opened branches.
|
||||
|
||||
The book control must be initialized before calling this function, i.e.
|
||||
all of its pages should be already added to it.
|
||||
*/
|
||||
virtual bool Restore();
|
||||
};
|
||||
|
||||
/// Overload allowing persistence adapter creation for wxTreebook objects.
|
||||
wxPersistentObject *wxCreatePersistentObject(wxTreebook *book);
|
||||
50
libs/wxWidgets-3.3.1/interface/wx/persist/window.h
Normal file
50
libs/wxWidgets-3.3.1/interface/wx/persist/window.h
Normal file
@@ -0,0 +1,50 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/persist/window.h
|
||||
// Purpose: interface of wxPersistentWindow<>
|
||||
// Author: Vadim Zeitlin
|
||||
// Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
Base class for persistent windows.
|
||||
|
||||
Compared to wxPersistentObject this class does three things:
|
||||
- Most importantly, wxPersistentWindow catches wxWindowDestroyEvent
|
||||
generated when the window is destroyed and saves its properties
|
||||
automatically when it happens.
|
||||
- It implements GetName() using wxWindow::GetName() so that the derived
|
||||
classes don't need to do it.
|
||||
- It adds a convenient wxPersistentWindow::Get() accessor returning the
|
||||
window object of the correct type.
|
||||
*/
|
||||
template <class T>
|
||||
class wxPersistentWindow : public wxPersistentObject
|
||||
{
|
||||
public:
|
||||
/// The type of the associated window.
|
||||
typedef T WindowType;
|
||||
|
||||
/**
|
||||
Constructor for a persistent window object.
|
||||
|
||||
The constructor uses wxEvtHandler::Bind() to catch
|
||||
wxWindowDestroyEvent generated when the window is destroyed and call
|
||||
wxPersistenceManager::SaveAndUnregister() when this happens. This
|
||||
ensures that the window properties are saved and that this object
|
||||
itself is deleted when the window is.
|
||||
*/
|
||||
wxPersistentWindow(WindowType *win);
|
||||
|
||||
WindowType *Get() const { return static_cast<WindowType *>(GetWindow()); }
|
||||
/**
|
||||
Implements the base class pure virtual method using wxWindow::GetName().
|
||||
|
||||
Notice that window names are usually not unique while this function
|
||||
must return a unique (at least among the objects of this type) string.
|
||||
Because of this you need to specify a non-default window name in its
|
||||
constructor when creating it or explicitly call wxWindow::SetName()
|
||||
before saving or restoring persistent properties.
|
||||
*/
|
||||
virtual wxString GetName() const;
|
||||
};
|
||||
Reference in New Issue
Block a user