initial commit
Signed-off-by: Peter Siegmund <mars3142@noreply.mars3142.dev>
This commit is contained in:
6837
libs/wxWidgets-3.3.1/interface/wx/richtext/richtextbuffer.h
Normal file
6837
libs/wxWidgets-3.3.1/interface/wx/richtext/richtextbuffer.h
Normal file
File diff suppressed because it is too large
Load Diff
2528
libs/wxWidgets-3.3.1/interface/wx/richtext/richtextctrl.h
Normal file
2528
libs/wxWidgets-3.3.1/interface/wx/richtext/richtextctrl.h
Normal file
File diff suppressed because it is too large
Load Diff
325
libs/wxWidgets-3.3.1/interface/wx/richtext/richtextformatdlg.h
Normal file
325
libs/wxWidgets-3.3.1/interface/wx/richtext/richtextformatdlg.h
Normal file
@@ -0,0 +1,325 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: richtext/richtextformatdlg.h
|
||||
// Purpose: interface of wxRichTextFormattingDialog*
|
||||
// Author: wxWidgets team
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
@class wxRichTextFormattingDialogFactory
|
||||
|
||||
This class provides pages for wxRichTextFormattingDialog, and allows other
|
||||
customization of the dialog.
|
||||
|
||||
A default instance of this class is provided automatically.
|
||||
If you wish to change the behaviour of the formatting dialog (for example add
|
||||
or replace a page), you may derive from this class, override one or more
|
||||
functions, and call the static function
|
||||
wxRichTextFormattingDialog::SetFormattingDialogFactory.
|
||||
|
||||
@library{wxrichtext}
|
||||
@category{richtext}
|
||||
*/
|
||||
class wxRichTextFormattingDialogFactory : public wxObject
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Constructor.
|
||||
*/
|
||||
wxRichTextFormattingDialogFactory();
|
||||
|
||||
/**
|
||||
Destructor.
|
||||
*/
|
||||
virtual ~wxRichTextFormattingDialogFactory();
|
||||
|
||||
/**
|
||||
Creates the main dialog buttons.
|
||||
*/
|
||||
virtual bool CreateButtons(wxRichTextFormattingDialog* dialog);
|
||||
|
||||
/**
|
||||
Creates a page, given a page identifier.
|
||||
*/
|
||||
virtual wxPanel* CreatePage(int page, wxString& title,
|
||||
wxRichTextFormattingDialog* dialog);
|
||||
|
||||
/**
|
||||
Creates all pages under the dialog's book control, also calling AddPage().
|
||||
*/
|
||||
virtual bool CreatePages(long pages,
|
||||
wxRichTextFormattingDialog* dialog);
|
||||
|
||||
/**
|
||||
Enumerate all available page identifiers.
|
||||
*/
|
||||
virtual int GetPageId(int i) const;
|
||||
|
||||
/**
|
||||
Gets the number of available page identifiers.
|
||||
*/
|
||||
virtual int GetPageIdCount() const;
|
||||
|
||||
/**
|
||||
Gets the image index for the given page identifier.
|
||||
*/
|
||||
virtual int GetPageImage(int id) const;
|
||||
|
||||
/**
|
||||
Set the property sheet style, called at the start of
|
||||
wxRichTextFormattingDialog::Create.
|
||||
*/
|
||||
virtual bool SetSheetStyle(wxRichTextFormattingDialog* dialog);
|
||||
|
||||
/**
|
||||
Invokes help for the dialog.
|
||||
*/
|
||||
virtual bool ShowHelp(int page,
|
||||
wxRichTextFormattingDialog* dialog);
|
||||
};
|
||||
|
||||
|
||||
|
||||
#define wxRICHTEXT_FORMAT_STYLE_EDITOR 0x0001
|
||||
#define wxRICHTEXT_FORMAT_FONT 0x0002
|
||||
#define wxRICHTEXT_FORMAT_TABS 0x0004
|
||||
#define wxRICHTEXT_FORMAT_BULLETS 0x0008
|
||||
#define wxRICHTEXT_FORMAT_INDENTS_SPACING 0x0010
|
||||
|
||||
/**
|
||||
@class wxRichTextFormattingDialog
|
||||
|
||||
This dialog allows the user to edit a character and/or paragraph style.
|
||||
|
||||
In the constructor, specify the pages that will be created.
|
||||
Use wxRichTextFormattingDialog::GetStyle() to retrieve the common style
|
||||
for a given range, and then use wxRichTextFormattingDialog::ApplyStyle()
|
||||
to apply the user-selected formatting to a control.
|
||||
|
||||
For example:
|
||||
@code
|
||||
wxRichTextRange range;
|
||||
if (m_richTextCtrl->HasSelection())
|
||||
range = m_richTextCtrl->GetSelectionRange();
|
||||
else
|
||||
range = wxRichTextRange(0, m_richTextCtrl->GetLastPosition()+1);
|
||||
|
||||
int pages = wxRICHTEXT_FORMAT_FONT|wxRICHTEXT_FORMAT_INDENTS_SPACING| \
|
||||
wxRICHTEXT_FORMAT_TABS|wxRICHTEXT_FORMAT_BULLETS;
|
||||
|
||||
wxRichTextFormattingDialog formatDlg(pages, this);
|
||||
formatDlg.GetStyle(m_richTextCtrl, range);
|
||||
|
||||
if (formatDlg.ShowModal() == wxID_OK)
|
||||
{
|
||||
formatDlg.ApplyStyle(m_richTextCtrl, range);
|
||||
}
|
||||
@endcode
|
||||
|
||||
@library{wxrichtext}
|
||||
@category{richtext}
|
||||
*/
|
||||
class wxRichTextFormattingDialog : public wxPropertySheetDialog
|
||||
{
|
||||
public:
|
||||
enum { Option_AllowPixelFontSize = 0x0001 };
|
||||
|
||||
/**
|
||||
Default ctor.
|
||||
*/
|
||||
wxRichTextFormattingDialog();
|
||||
|
||||
/**
|
||||
Constructors.
|
||||
|
||||
@param flags
|
||||
The pages to show.
|
||||
@param parent
|
||||
The dialog's parent.
|
||||
@param title
|
||||
The dialog's title.
|
||||
@param id
|
||||
The dialog's ID.
|
||||
@param pos
|
||||
The dialog's position.
|
||||
@param sz
|
||||
The dialog's size.
|
||||
@param style
|
||||
The dialog's window style.
|
||||
*/
|
||||
wxRichTextFormattingDialog(long flags, wxWindow* parent, const wxString& title = "Formatting",
|
||||
wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& sz = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE);
|
||||
|
||||
/**
|
||||
Destructor.
|
||||
*/
|
||||
virtual ~wxRichTextFormattingDialog();
|
||||
|
||||
/**
|
||||
Apply attributes to the given range, only changing attributes that
|
||||
need to be changed.
|
||||
*/
|
||||
virtual bool ApplyStyle(wxRichTextCtrl* ctrl, const wxRichTextRange& range,
|
||||
int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO|wxRICHTEXT_SETSTYLE_OPTIMIZE);
|
||||
|
||||
/**
|
||||
Apply attributes to the object being edited, if any.
|
||||
*/
|
||||
virtual bool ApplyStyle(wxRichTextCtrl* ctrl, int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO);
|
||||
|
||||
/**
|
||||
Creation: see wxRichTextFormattingDialog() "the constructor" for
|
||||
details about the parameters.
|
||||
*/
|
||||
bool Create(long flags, wxWindow* parent,
|
||||
const wxString& title = wxGetTranslation("Formatting"), wxWindowID id = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition, const wxSize& sz = wxDefaultSize,
|
||||
long style = wxDEFAULT_DIALOG_STYLE);
|
||||
|
||||
//@{
|
||||
/**
|
||||
Gets the attributes being edited.
|
||||
*/
|
||||
const wxTextAttr& GetAttributes() const;
|
||||
wxTextAttr& GetAttributes();
|
||||
//@}
|
||||
|
||||
/**
|
||||
Helper for pages to get the top-level dialog.
|
||||
*/
|
||||
static wxRichTextFormattingDialog* GetDialog(wxWindow* win);
|
||||
|
||||
/**
|
||||
Helper for pages to get the attributes.
|
||||
*/
|
||||
static wxTextAttr* GetDialogAttributes(wxWindow* win);
|
||||
|
||||
/**
|
||||
Helper for pages to get the style.
|
||||
*/
|
||||
static wxRichTextStyleDefinition* GetDialogStyleDefinition(wxWindow* win);
|
||||
|
||||
/**
|
||||
Returns the object to be used to customize the dialog and provide pages.
|
||||
*/
|
||||
static wxRichTextFormattingDialogFactory* GetFormattingDialogFactory();
|
||||
|
||||
/**
|
||||
Returns the image list associated with the dialog, used for example if showing
|
||||
the dialog as a toolbook.
|
||||
*/
|
||||
wxImageList* GetImageList() const;
|
||||
|
||||
/**
|
||||
Gets common attributes from the given range and calls SetAttributes().
|
||||
Attributes that do not have common values in the given range
|
||||
will be omitted from the style's flags.
|
||||
*/
|
||||
virtual bool GetStyle(wxRichTextCtrl* ctrl, const wxRichTextRange& range);
|
||||
|
||||
/**
|
||||
Gets the associated style definition, if any.
|
||||
*/
|
||||
virtual wxRichTextStyleDefinition* GetStyleDefinition() const;
|
||||
|
||||
/**
|
||||
Gets the associated style sheet, if any.
|
||||
*/
|
||||
virtual wxRichTextStyleSheet* GetStyleSheet() const;
|
||||
|
||||
/**
|
||||
Sets the attributes to be edited.
|
||||
*/
|
||||
void SetAttributes(const wxTextAttr& attr);
|
||||
|
||||
/**
|
||||
Sets the dialog options, determining what the interface presents to the user.
|
||||
Currently the only option is Option_AllowPixelFontSize.
|
||||
*/
|
||||
void SetOptions(int options) { m_options = options; }
|
||||
|
||||
/**
|
||||
Gets the dialog options, determining what the interface presents to the user.
|
||||
Currently the only option is Option_AllowPixelFontSize.
|
||||
*/
|
||||
int GetOptions() const { return m_options; }
|
||||
|
||||
/**
|
||||
If editing the attributes for a particular object, such as an image,
|
||||
set the object so the code can initialize attributes such as size correctly.
|
||||
*/
|
||||
void SetObject(wxRichTextObject* obj) { m_object = obj; }
|
||||
|
||||
/**
|
||||
Returns the object of which the attributes are to edited (if any).
|
||||
*/
|
||||
wxRichTextObject* GetObject() const;
|
||||
|
||||
/**
|
||||
Returns @true if the given option is present.
|
||||
*/
|
||||
bool HasOption(int option) const { return (m_options & option) != 0; }
|
||||
|
||||
/**
|
||||
Sets the formatting factory object to be used for customization and page
|
||||
creation.
|
||||
|
||||
It deletes the existing factory object.
|
||||
*/
|
||||
static void SetFormattingDialogFactory(wxRichTextFormattingDialogFactory* factory);
|
||||
|
||||
/**
|
||||
Sets the image list associated with the dialog's property sheet.
|
||||
*/
|
||||
void SetImageList(wxImageList* imageList);
|
||||
|
||||
/**
|
||||
Sets the attributes and optionally updates the display, if @a update is @true.
|
||||
*/
|
||||
virtual bool SetStyle(const wxTextAttr& style, bool update = true);
|
||||
|
||||
/**
|
||||
Sets the style definition and optionally update the display,
|
||||
if @a update is @true.
|
||||
*/
|
||||
virtual bool SetStyleDefinition(const wxRichTextStyleDefinition& styleDef,
|
||||
wxRichTextStyleSheet* sheet,
|
||||
bool update = true);
|
||||
|
||||
/**
|
||||
Updates the display.
|
||||
*/
|
||||
virtual bool UpdateDisplay();
|
||||
|
||||
/**
|
||||
Returns @true if the dialog will restore the last-selected page.
|
||||
*/
|
||||
static bool GetRestoreLastPage();
|
||||
|
||||
/**
|
||||
Pass @true if the dialog should restore the last-selected page.
|
||||
*/
|
||||
static void SetRestoreLastPage(bool b);
|
||||
|
||||
/**
|
||||
Returns the page identifier of the last page selected (not the control id).
|
||||
*/
|
||||
static int GetLastPage();
|
||||
|
||||
/**
|
||||
Sets the page identifier of the last page selected (not the control id).
|
||||
*/
|
||||
static void SetLastPage(int lastPage);
|
||||
|
||||
/**
|
||||
Sets the custom colour data for use by the colour dialog.
|
||||
*/
|
||||
static void SetColourData(const wxColourData& colourData);
|
||||
|
||||
/**
|
||||
Returns the custom colour data for use by the colour dialog.
|
||||
*/
|
||||
static wxColourData GetColourData();
|
||||
};
|
||||
|
||||
144
libs/wxWidgets-3.3.1/interface/wx/richtext/richtexthtml.h
Normal file
144
libs/wxWidgets-3.3.1/interface/wx/richtext/richtexthtml.h
Normal file
@@ -0,0 +1,144 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: richtext/richtexthtml.h
|
||||
// Purpose: interface of wxRichTextHTMLHandler
|
||||
// Author: wxWidgets team
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
@class wxRichTextHTMLHandler
|
||||
|
||||
Handles HTML output (only) for wxRichTextCtrl content.
|
||||
|
||||
The most flexible way to use this class is to create a temporary object and call
|
||||
its functions directly, rather than use wxRichTextBuffer::SaveFile or
|
||||
wxRichTextCtrl::SaveFile.
|
||||
|
||||
Image handling requires a little extra work from the application, to choose an
|
||||
appropriate image format for the target HTML viewer and to clean up the temporary
|
||||
images later.
|
||||
If you are planning to load the HTML into a standard web browser, you can
|
||||
specify the handler flag wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_BASE64 (the default)
|
||||
and no extra work is required: the images will be written with the HTML.
|
||||
|
||||
However, if you want wxHTML compatibility, you will need to use
|
||||
@c wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_MEMORY or
|
||||
@c wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_FILES.
|
||||
|
||||
In this case, you must either call wxRichTextHTMLHandler::DeleteTemporaryImages
|
||||
before the next load operation, or you must store the image locations and
|
||||
delete them yourself when appropriate.
|
||||
|
||||
You can call wxRichTextHTMLHandler::GetTemporaryImageLocations to
|
||||
get the array of temporary image names.
|
||||
|
||||
|
||||
@section richtexthtmlhandler_flags Handler flags
|
||||
|
||||
The following flags can be used with this handler, via the handler's SetFlags()
|
||||
function or the buffer or control's SetHandlerFlags() function:
|
||||
|
||||
- wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_MEMORY
|
||||
Images are saved to the memory filesystem: suitable for showing wxHTML windows.
|
||||
- wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_FILES
|
||||
Images are saved to temporary files: suitable for showing in wxHTML windows.
|
||||
- wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_BASE64
|
||||
Images are written with the HTML files in Base 64 format: suitable for showing
|
||||
in web browsers.
|
||||
- wxRICHTEXT_HANDLER_NO_HEADER_FOOTER
|
||||
Don't include header and footer tags (HTML, HEAD, BODY), so that the HTML
|
||||
can be used as part of a larger document.
|
||||
- wxRICHTEXT_HANDLER_USE_CSS
|
||||
Use CSS where possible, otherwise use workarounds that will show in wxHtmlWindow.
|
||||
|
||||
@library{wxrichtext}
|
||||
@category{richtext}
|
||||
*/
|
||||
class wxRichTextHTMLHandler : public wxRichTextFileHandler
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Constructor.
|
||||
*/
|
||||
wxRichTextHTMLHandler(const wxString& name = "HTML",
|
||||
const wxString& ext = "html",
|
||||
int type = wxRICHTEXT_TYPE_HTML);
|
||||
|
||||
/**
|
||||
Clears the image locations generated by the last operation.
|
||||
*/
|
||||
void ClearTemporaryImageLocations();
|
||||
|
||||
/**
|
||||
Deletes the in-memory or temporary files generated by the last operation.
|
||||
*/
|
||||
bool DeleteTemporaryImages();
|
||||
|
||||
/**
|
||||
Delete the in-memory or temporary files generated by the last operation.
|
||||
This is a static function that can be used to delete the saved locations
|
||||
from an earlier operation, for example after the user has viewed the HTML file.
|
||||
*/
|
||||
static bool DeleteTemporaryImages(int flags,
|
||||
const wxArrayString& imageLocations);
|
||||
|
||||
/**
|
||||
Returns the mapping for converting point sizes to HTML font sizes.
|
||||
*/
|
||||
wxArrayInt GetFontSizeMapping() const;
|
||||
|
||||
/**
|
||||
Returns the directory used to store temporary image files.
|
||||
*/
|
||||
const wxString& GetTempDir() const;
|
||||
|
||||
/**
|
||||
Returns the image locations for the last operation.
|
||||
*/
|
||||
const wxArrayString& GetTemporaryImageLocations() const;
|
||||
|
||||
/**
|
||||
Reset the file counter, in case, for example, the same names are required each
|
||||
time.
|
||||
*/
|
||||
static void SetFileCounter(int counter);
|
||||
|
||||
/**
|
||||
Sets the mapping for converting point sizes to HTML font sizes.
|
||||
|
||||
There should be 7 elements, one for each HTML font size, each element
|
||||
specifying the maximum point size for that HTML font size.
|
||||
For example:
|
||||
@code
|
||||
wxArrayInt fontSizeMapping;
|
||||
fontSizeMapping.Add(7);
|
||||
fontSizeMapping.Add(9);
|
||||
fontSizeMapping.Add(11);
|
||||
fontSizeMapping.Add(12);
|
||||
fontSizeMapping.Add(14);
|
||||
fontSizeMapping.Add(22);
|
||||
fontSizeMapping.Add(100);
|
||||
|
||||
htmlHandler.SetFontSizeMapping(fontSizeMapping);
|
||||
@endcode
|
||||
*/
|
||||
void SetFontSizeMapping(const wxArrayInt& fontSizeMapping);
|
||||
|
||||
/**
|
||||
Sets the directory for storing temporary files.
|
||||
If empty, the system temporary directory will be used.
|
||||
*/
|
||||
void SetTempDir(const wxString& tempDir);
|
||||
|
||||
/**
|
||||
Sets the list of image locations generated by the last operation.
|
||||
*/
|
||||
void SetTemporaryImageLocations(const wxArrayString& locations);
|
||||
|
||||
protected:
|
||||
/**
|
||||
Saves the buffer content to the HTML stream.
|
||||
*/
|
||||
virtual bool DoSaveFile(wxRichTextBuffer* buffer, wxOutputStream& stream);
|
||||
};
|
||||
|
||||
418
libs/wxWidgets-3.3.1/interface/wx/richtext/richtextprint.h
Normal file
418
libs/wxWidgets-3.3.1/interface/wx/richtext/richtextprint.h
Normal file
@@ -0,0 +1,418 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: richtext/richtextprint.h
|
||||
// Purpose: interface of wxRichTextHeaderFooterData
|
||||
// Author: wxWidgets team
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/**
|
||||
These are the header and footer page identifiers, passed to functions such
|
||||
as wxRichTextHeaderFooterData::SetFooterText to specify the odd or even page
|
||||
for the text.
|
||||
*/
|
||||
enum wxRichTextOddEvenPage {
|
||||
wxRICHTEXT_PAGE_ODD,
|
||||
wxRICHTEXT_PAGE_EVEN,
|
||||
wxRICHTEXT_PAGE_ALL,
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
These are the location identifiers for passing to functions such as
|
||||
wxRichTextHeaderFooterData::SetFooterText(), to specify whether the text
|
||||
is on the left, centre or right of the page.
|
||||
*/
|
||||
enum wxRichTextPageLocation {
|
||||
wxRICHTEXT_PAGE_LEFT,
|
||||
wxRICHTEXT_PAGE_CENTRE,
|
||||
wxRICHTEXT_PAGE_RIGHT
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
@class wxRichTextHeaderFooterData
|
||||
|
||||
|
||||
This class represents header and footer data to be passed to the
|
||||
wxRichTextPrinting and wxRichTextPrintout classes.
|
||||
|
||||
Headers and footers can be specified independently for odd, even or both page
|
||||
sides. Different text can be specified for left, centre and right locations
|
||||
on the page, and the font and text colour can also be specified.
|
||||
|
||||
You can specify the following keywords in header and footer text, which will
|
||||
be substituted for the actual values during printing and preview.
|
||||
|
||||
- @@DATE@@: the current date.
|
||||
- @@PAGESCNT@@: the total number of pages.
|
||||
- @@PAGENUM@@: the current page number.
|
||||
- @@TIME@@: the current time.
|
||||
- @@TITLE@@: the title of the document, as passed to the wxRichTextPrinting or
|
||||
wxRichTextLayout constructor.
|
||||
- @@USER@@: the user's name (support for this macro was added in wxWidgets
|
||||
3.2.8)
|
||||
|
||||
@library{wxrichtext}
|
||||
@category{richtext}
|
||||
*/
|
||||
class wxRichTextHeaderFooterData : public wxObject
|
||||
{
|
||||
public:
|
||||
//@{
|
||||
/**
|
||||
Constructors.
|
||||
*/
|
||||
wxRichTextHeaderFooterData();
|
||||
wxRichTextHeaderFooterData(const wxRichTextHeaderFooterData& data);
|
||||
//@}
|
||||
|
||||
/**
|
||||
Clears all text.
|
||||
*/
|
||||
void Clear();
|
||||
|
||||
/**
|
||||
Copies the data.
|
||||
*/
|
||||
void Copy(const wxRichTextHeaderFooterData& data);
|
||||
|
||||
/**
|
||||
Returns the font specified for printing the header and footer.
|
||||
*/
|
||||
const wxFont& GetFont() const;
|
||||
|
||||
/**
|
||||
Returns the margin between the text and the footer.
|
||||
*/
|
||||
int GetFooterMargin() const;
|
||||
|
||||
/**
|
||||
Returns the footer text on odd or even pages, and at a given position on the
|
||||
page (left, centre or right).
|
||||
*/
|
||||
wxString GetFooterText(wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_EVEN,
|
||||
wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE) const;
|
||||
|
||||
/**
|
||||
Returns the margin between the text and the header.
|
||||
*/
|
||||
int GetHeaderMargin() const;
|
||||
|
||||
/**
|
||||
Returns the header text on odd or even pages, and at a given position on the
|
||||
page (left, centre or right).
|
||||
*/
|
||||
wxString GetHeaderText(wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_EVEN,
|
||||
wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE) const;
|
||||
|
||||
/**
|
||||
Returns @true if the header and footer will be shown on the first page.
|
||||
*/
|
||||
bool GetShowOnFirstPage() const;
|
||||
|
||||
/**
|
||||
Helper function for getting the header or footer text, odd or even pages, and
|
||||
at a given position on the page (left, centre or right).
|
||||
*/
|
||||
wxString GetText(int headerFooter, wxRichTextOddEvenPage page,
|
||||
wxRichTextPageLocation location) const;
|
||||
|
||||
/**
|
||||
Returns the text colour for drawing the header and footer.
|
||||
*/
|
||||
const wxColour& GetTextColour() const;
|
||||
|
||||
/**
|
||||
Initialises the object.
|
||||
*/
|
||||
void Init();
|
||||
|
||||
/**
|
||||
Sets the font for drawing the header and footer.
|
||||
*/
|
||||
void SetFont(const wxFont& font);
|
||||
|
||||
/**
|
||||
Sets the footer text on odd or even pages, and at a given position on the page
|
||||
(left, centre or right).
|
||||
*/
|
||||
void SetFooterText(const wxString& text,
|
||||
wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_ALL,
|
||||
wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE);
|
||||
|
||||
/**
|
||||
Sets the header text on odd or even pages, and at a given position on the page
|
||||
(left, centre or right).
|
||||
*/
|
||||
void SetHeaderText(const wxString& text,
|
||||
wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_ALL,
|
||||
wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE);
|
||||
|
||||
/**
|
||||
Sets the margins between text and header or footer, in tenths of a millimeter.
|
||||
*/
|
||||
void SetMargins(int headerMargin, int footerMargin);
|
||||
|
||||
/**
|
||||
Pass @true to show the header or footer on first page (the default).
|
||||
*/
|
||||
void SetShowOnFirstPage(bool showOnFirstPage);
|
||||
|
||||
/**
|
||||
Helper function for setting the header or footer text, odd or even pages, and
|
||||
at a given position on the page (left, centre or right).
|
||||
*/
|
||||
void SetText(const wxString& text, int headerFooter,
|
||||
wxRichTextOddEvenPage page,
|
||||
wxRichTextPageLocation location);
|
||||
|
||||
/**
|
||||
Sets the text colour for drawing the header and footer.
|
||||
*/
|
||||
void SetTextColour(const wxColour& col);
|
||||
|
||||
/**
|
||||
Assignment operator.
|
||||
*/
|
||||
void operator=(const wxRichTextHeaderFooterData& data);
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@class wxRichTextPrintout
|
||||
|
||||
This class implements print layout for wxRichTextBuffer.
|
||||
Instead of using it directly, you should normally use the wxRichTextPrinting class.
|
||||
|
||||
@library{wxrichtext}
|
||||
@category{richtext}
|
||||
*/
|
||||
class wxRichTextPrintout : public wxPrintout
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Constructor.
|
||||
*/
|
||||
wxRichTextPrintout(const wxString& title = "Printout");
|
||||
|
||||
/**
|
||||
Calculates scaling and text, header and footer rectangles.
|
||||
*/
|
||||
void CalculateScaling(wxDC* dc, wxRect& textRect,
|
||||
wxRect& headerRect,
|
||||
wxRect& footerRect);
|
||||
|
||||
/**
|
||||
Returns the header and footer data associated with the printout.
|
||||
*/
|
||||
const wxRichTextHeaderFooterData& GetHeaderFooterData() const;
|
||||
|
||||
/**
|
||||
Gets the page information.
|
||||
*/
|
||||
virtual void GetPageInfo(int* minPage, int* maxPage, int* selPageFrom,
|
||||
int* selPageTo);
|
||||
|
||||
/**
|
||||
Returns a pointer to the buffer being rendered.
|
||||
*/
|
||||
wxRichTextBuffer* GetRichTextBuffer() const;
|
||||
|
||||
/**
|
||||
Returns @true if the given page exists in the printout.
|
||||
*/
|
||||
virtual bool HasPage(int page);
|
||||
|
||||
/**
|
||||
Prepares for printing, laying out the buffer and calculating pagination.
|
||||
*/
|
||||
virtual void OnPreparePrinting();
|
||||
|
||||
/**
|
||||
Does the actual printing for this page.
|
||||
*/
|
||||
virtual bool OnPrintPage(int page);
|
||||
|
||||
/**
|
||||
Sets the header and footer data associated with the printout.
|
||||
*/
|
||||
void SetHeaderFooterData(const wxRichTextHeaderFooterData& data);
|
||||
|
||||
/**
|
||||
Sets margins in 10ths of millimetre. Defaults to 1 inch for margins.
|
||||
*/
|
||||
void SetMargins(int top = 254, int bottom = 254, int left = 254,
|
||||
int right = 254);
|
||||
|
||||
/**
|
||||
Sets the buffer to print. wxRichTextPrintout does not manage this pointer;
|
||||
it should be managed by the calling code, such as wxRichTextPrinting.
|
||||
*/
|
||||
void SetRichTextBuffer(wxRichTextBuffer* buffer);
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@class wxRichTextPrinting
|
||||
|
||||
This class provides a simple interface for performing wxRichTextBuffer printing
|
||||
and previewing. It uses wxRichTextPrintout for layout and rendering.
|
||||
|
||||
@library{wxrichtext}
|
||||
@category{richtext}
|
||||
*/
|
||||
class wxRichTextPrinting : public wxObject
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Constructor.
|
||||
|
||||
Optionally pass a title to be used in the preview frame and printing wait
|
||||
dialog, and also a parent window for these windows.
|
||||
*/
|
||||
wxRichTextPrinting(const wxString& name = "Printing",
|
||||
wxWindow* parentWindow = nullptr);
|
||||
|
||||
/**
|
||||
A convenience function to get the footer text.
|
||||
See wxRichTextHeaderFooterData for details.
|
||||
*/
|
||||
wxString GetFooterText(wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_EVEN,
|
||||
wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE) const;
|
||||
|
||||
/**
|
||||
Returns the internal wxRichTextHeaderFooterData object.
|
||||
*/
|
||||
const wxRichTextHeaderFooterData& GetHeaderFooterData() const;
|
||||
|
||||
/**
|
||||
A convenience function to get the header text.
|
||||
See wxRichTextHeaderFooterData for details.
|
||||
*/
|
||||
wxString GetHeaderText(wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_EVEN,
|
||||
wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE) const;
|
||||
|
||||
/**
|
||||
Returns a pointer to the internal page setup data.
|
||||
*/
|
||||
wxPageSetupDialogData* GetPageSetupData();
|
||||
|
||||
/**
|
||||
Returns the parent window to be used for the preview window and printing
|
||||
wait dialog.
|
||||
*/
|
||||
wxWindow* GetParentWindow() const;
|
||||
|
||||
/**
|
||||
Returns the dimensions to be used for the preview window.
|
||||
*/
|
||||
const wxRect& GetPreviewRect() const;
|
||||
|
||||
/**
|
||||
Returns a pointer to the internal print data.
|
||||
*/
|
||||
wxPrintData* GetPrintData();
|
||||
|
||||
/**
|
||||
Returns the title of the preview window or printing wait caption.
|
||||
*/
|
||||
const wxString& GetTitle() const;
|
||||
|
||||
/**
|
||||
Shows the page setup dialog.
|
||||
*/
|
||||
void PageSetup();
|
||||
|
||||
/**
|
||||
Shows a preview window for the given buffer.
|
||||
The function takes its own copy of @a buffer.
|
||||
*/
|
||||
bool PreviewBuffer(const wxRichTextBuffer& buffer);
|
||||
|
||||
/**
|
||||
Shows a preview window for the given file.
|
||||
|
||||
@a richTextFile can be a text file or XML file, or other file
|
||||
depending on the available file handlers.
|
||||
*/
|
||||
bool PreviewFile(const wxString& richTextFile);
|
||||
|
||||
/**
|
||||
Prints the given buffer. The function takes its own copy of @a buffer.
|
||||
@a showPrintDialog can be @true to show the print dialog, or @false to print quietly.
|
||||
*/
|
||||
bool PrintBuffer(const wxRichTextBuffer& buffer, bool showPrintDialog = true);
|
||||
|
||||
/**
|
||||
Prints the given file. @a richTextFile can be a text file or XML file,
|
||||
or other file depending on the available file handlers. @a showPrintDialog
|
||||
can be @true to show the print dialog, or @false to print quietly.
|
||||
*/
|
||||
bool PrintFile(const wxString& richTextFile, bool showPrintDialog = true);
|
||||
|
||||
/**
|
||||
A convenience function to set the footer text.
|
||||
See wxRichTextHeaderFooterData for details.
|
||||
*/
|
||||
void SetFooterText(const wxString& text,
|
||||
wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_ALL,
|
||||
wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE);
|
||||
|
||||
/**
|
||||
Sets the internal wxRichTextHeaderFooterData object.
|
||||
*/
|
||||
void SetHeaderFooterData(const wxRichTextHeaderFooterData& data);
|
||||
|
||||
/**
|
||||
Sets the wxRichTextHeaderFooterData font.
|
||||
*/
|
||||
void SetHeaderFooterFont(const wxFont& font);
|
||||
|
||||
/**
|
||||
Sets the wxRichTextHeaderFooterData text colour.
|
||||
*/
|
||||
void SetHeaderFooterTextColour(const wxColour& colour);
|
||||
|
||||
/**
|
||||
A convenience function to set the header text.
|
||||
See wxRichTextHeaderFooterData for details.
|
||||
*/
|
||||
void SetHeaderText(const wxString& text,
|
||||
wxRichTextOddEvenPage page = wxRICHTEXT_PAGE_ALL,
|
||||
wxRichTextPageLocation location = wxRICHTEXT_PAGE_CENTRE);
|
||||
|
||||
/**
|
||||
Sets the page setup data.
|
||||
*/
|
||||
void SetPageSetupData(const wxPageSetupDialogData& pageSetupData);
|
||||
|
||||
/**
|
||||
Sets the parent window to be used for the preview window and printing
|
||||
wait dialog.
|
||||
*/
|
||||
void SetParentWindow(wxWindow* parent);
|
||||
|
||||
/**
|
||||
Sets the dimensions to be used for the preview window.
|
||||
*/
|
||||
void SetPreviewRect(const wxRect& rect);
|
||||
|
||||
/**
|
||||
Sets the print data.
|
||||
*/
|
||||
void SetPrintData(const wxPrintData& printData);
|
||||
|
||||
/**
|
||||
Pass @true to show the header and footer on the first page.
|
||||
*/
|
||||
void SetShowOnFirstPage(bool show);
|
||||
|
||||
/**
|
||||
Pass the title of the preview window or printing wait caption.
|
||||
*/
|
||||
void SetTitle(const wxString& title);
|
||||
};
|
||||
|
||||
171
libs/wxWidgets-3.3.1/interface/wx/richtext/richtextstyledlg.h
Normal file
171
libs/wxWidgets-3.3.1/interface/wx/richtext/richtextstyledlg.h
Normal file
@@ -0,0 +1,171 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: richtext/richtextstyledlg.h
|
||||
// Purpose: interface of wxRichTextStyleOrganiserDialog
|
||||
// Author: wxWidgets team
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/*!
|
||||
* Flags for specifying permitted operations
|
||||
*/
|
||||
|
||||
#define wxRICHTEXT_ORGANISER_DELETE_STYLES 0x0001
|
||||
#define wxRICHTEXT_ORGANISER_CREATE_STYLES 0x0002
|
||||
#define wxRICHTEXT_ORGANISER_APPLY_STYLES 0x0004
|
||||
#define wxRICHTEXT_ORGANISER_EDIT_STYLES 0x0008
|
||||
#define wxRICHTEXT_ORGANISER_RENAME_STYLES 0x0010
|
||||
#define wxRICHTEXT_ORGANISER_OK_CANCEL 0x0020
|
||||
#define wxRICHTEXT_ORGANISER_RENUMBER 0x0040
|
||||
|
||||
// The permitted style types to show
|
||||
#define wxRICHTEXT_ORGANISER_SHOW_CHARACTER 0x0100
|
||||
#define wxRICHTEXT_ORGANISER_SHOW_PARAGRAPH 0x0200
|
||||
#define wxRICHTEXT_ORGANISER_SHOW_LIST 0x0400
|
||||
#define wxRICHTEXT_ORGANISER_SHOW_BOX 0x0800
|
||||
#define wxRICHTEXT_ORGANISER_SHOW_ALL 0x1000
|
||||
|
||||
// Common combinations
|
||||
#define wxRICHTEXT_ORGANISER_ORGANISE (wxRICHTEXT_ORGANISER_SHOW_ALL|wxRICHTEXT_ORGANISER_DELETE_STYLES|wxRICHTEXT_ORGANISER_CREATE_STYLES|wxRICHTEXT_ORGANISER_APPLY_STYLES|wxRICHTEXT_ORGANISER_EDIT_STYLES|wxRICHTEXT_ORGANISER_RENAME_STYLES)
|
||||
#define wxRICHTEXT_ORGANISER_BROWSE (wxRICHTEXT_ORGANISER_SHOW_ALL|wxRICHTEXT_ORGANISER_OK_CANCEL)
|
||||
#define wxRICHTEXT_ORGANISER_BROWSE_NUMBERING (wxRICHTEXT_ORGANISER_SHOW_LIST|wxRICHTEXT_ORGANISER_OK_CANCEL|wxRICHTEXT_ORGANISER_RENUMBER)
|
||||
|
||||
|
||||
/**
|
||||
@class wxRichTextStyleOrganiserDialog
|
||||
|
||||
This class shows a style sheet and allows the user to edit, add and remove styles.
|
||||
|
||||
It can also be used as a style browser, for example if the application is not
|
||||
using a permanent wxRichTextStyleComboCtrl or wxRichTextStyleListCtrl to
|
||||
present styles.
|
||||
|
||||
@library{wxrichtext}
|
||||
@category{richtext}
|
||||
*/
|
||||
class wxRichTextStyleOrganiserDialog : public wxDialog
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Default ctor.
|
||||
*/
|
||||
wxRichTextStyleOrganiserDialog();
|
||||
|
||||
/**
|
||||
Constructor.
|
||||
|
||||
To create a dialog, pass a bitlist of @a flags (see below), a style sheet, a
|
||||
text control to apply a selected style to (or @NULL), followed by the usual
|
||||
window parameters.
|
||||
|
||||
To specify the operations available to the user, pass a combination of these
|
||||
values to @e flags:
|
||||
|
||||
- @b wxRICHTEXT_ORGANISER_DELETE_STYLES: Provides a button for deleting styles.
|
||||
- @b wxRICHTEXT_ORGANISER_CREATE_STYLES: Provides buttons for creating styles.
|
||||
- @b wxRICHTEXT_ORGANISER_APPLY_STYLES: Provides a button for applying the
|
||||
currently selected style to the selection.
|
||||
- @b wxRICHTEXT_ORGANISER_EDIT_STYLES: Provides a button for editing styles.
|
||||
- @b wxRICHTEXT_ORGANISER_RENAME_STYLES: Provides a button for renaming styles.
|
||||
- @b wxRICHTEXT_ORGANISER_OK_CANCEL: Provides OK and Cancel buttons.
|
||||
- @b wxRICHTEXT_ORGANISER_RENUMBER: Provides a checkbox for specifying that
|
||||
the selection should be renumbered.
|
||||
|
||||
The following flags determine what will be displayed in the style list:
|
||||
|
||||
- @b wxRICHTEXT_ORGANISER_SHOW_CHARACTER: Displays character styles only.
|
||||
- @b wxRICHTEXT_ORGANISER_SHOW_PARAGRAPH: Displays paragraph styles only.
|
||||
- @b wxRICHTEXT_ORGANISER_SHOW_LIST: Displays list styles only.
|
||||
- @b wxRICHTEXT_ORGANISER_SHOW_ALL: Displays all styles.
|
||||
|
||||
The following symbols define commonly-used combinations of flags:
|
||||
|
||||
- @b wxRICHTEXT_ORGANISER_ORGANISE:
|
||||
Enable all style editing operations so the dialog behaves as a style organiser.
|
||||
- @b wxRICHTEXT_ORGANISER_BROWSE:
|
||||
Show a list of all styles and their previews, but only allow application of a
|
||||
style or cancellation of the dialog. This makes the dialog behave as a style browser.
|
||||
- @b wxRICHTEXT_ORGANISER_BROWSE_NUMBERING:
|
||||
Enables only list style browsing, plus a control to specify renumbering.
|
||||
This allows the dialog to be used for applying list styles to the selection.
|
||||
*/
|
||||
wxRichTextStyleOrganiserDialog(int flags,
|
||||
wxRichTextStyleSheet* sheet,
|
||||
wxRichTextCtrl* ctrl,
|
||||
wxWindow* parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxString& caption = _("Style Organiser"),
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX);
|
||||
|
||||
/**
|
||||
Applies the selected style to selection in the given control or the control
|
||||
passed to the constructor.
|
||||
*/
|
||||
bool ApplyStyle(wxRichTextCtrl* ctrl = nullptr);
|
||||
|
||||
/**
|
||||
Creates the dialog. See the ctor.
|
||||
*/
|
||||
bool Create(int flags, wxRichTextStyleSheet* sheet, wxRichTextCtrl* ctrl,
|
||||
wxWindow* parent, wxWindowID id = wxID_ANY,
|
||||
const wxString& caption = wxGetTranslation("Style Organiser"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(400, 300), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX);
|
||||
|
||||
/**
|
||||
Returns @true if the user has opted to restart numbering.
|
||||
*/
|
||||
bool GetRestartNumbering() const;
|
||||
|
||||
/**
|
||||
Returns the associated rich text control (if any).
|
||||
*/
|
||||
wxRichTextCtrl* GetRichTextCtrl() const;
|
||||
|
||||
/**
|
||||
Returns selected style name.
|
||||
*/
|
||||
wxString GetSelectedStyle() const;
|
||||
|
||||
/**
|
||||
Returns selected style definition.
|
||||
*/
|
||||
wxRichTextStyleDefinition* GetSelectedStyleDefinition() const;
|
||||
|
||||
/**
|
||||
Returns the associated style sheet.
|
||||
*/
|
||||
wxRichTextStyleSheet* GetStyleSheet() const;
|
||||
|
||||
/**
|
||||
Sets the flags used to control the interface presented to the user.
|
||||
*/
|
||||
void SetFlags(int flags);
|
||||
|
||||
/**
|
||||
Checks or unchecks the restart numbering checkbox.
|
||||
*/
|
||||
void SetRestartNumbering(bool restartNumbering);
|
||||
|
||||
/**
|
||||
Sets the control to be associated with the dialog, for the purposes of applying
|
||||
a style to the selection.
|
||||
*/
|
||||
void SetRichTextCtrl(wxRichTextCtrl* ctrl);
|
||||
|
||||
/**
|
||||
Determines whether tooltips will be shown.
|
||||
*/
|
||||
static void SetShowToolTips(bool show);
|
||||
|
||||
/**
|
||||
Sets the associated style sheet.
|
||||
*/
|
||||
void SetStyleSheet(wxRichTextStyleSheet* sheet);
|
||||
|
||||
/**
|
||||
Returns the flags used to control the interface presented to the user.
|
||||
*/
|
||||
int GetFlags() const;
|
||||
};
|
||||
|
||||
741
libs/wxWidgets-3.3.1/interface/wx/richtext/richtextstyles.h
Normal file
741
libs/wxWidgets-3.3.1/interface/wx/richtext/richtextstyles.h
Normal file
@@ -0,0 +1,741 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: richtext/richtextstyles.h
|
||||
// Purpose: interface of wxRichTextStyleListCtrl
|
||||
// Author: wxWidgets team
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
@class wxRichTextStyleListCtrl
|
||||
|
||||
This class incorporates a wxRichTextStyleListBox and a choice control that
|
||||
allows the user to select the category of style to view.
|
||||
|
||||
It is demonstrated in the wxRichTextCtrl sample in @c samples/richtext.
|
||||
|
||||
To use wxRichTextStyleListCtrl, add the control to your window hierarchy and
|
||||
call wxRichTextStyleListCtrl::SetStyleType with one of
|
||||
wxRichTextStyleListBox::wxRICHTEXT_STYLE_ALL,
|
||||
wxRichTextStyleListBox::wxRICHTEXT_STYLE_PARAGRAPH,
|
||||
wxRichTextStyleListBox::wxRICHTEXT_STYLE_CHARACTER and
|
||||
wxRichTextStyleListBox::wxRICHTEXT_STYLE_LIST to set the current view.
|
||||
|
||||
Associate the control with a style sheet and rich text control with
|
||||
SetStyleSheet and SetRichTextCtrl, so that when a style is double-clicked,
|
||||
it is applied to the selection.
|
||||
|
||||
@beginStyleTable
|
||||
@style{wxRICHTEXTSTYLELIST_HIDE_TYPE_SELECTOR}
|
||||
This style hides the category selection control.
|
||||
@endStyleTable
|
||||
|
||||
@library{wxrichtext}
|
||||
@category{richtext}
|
||||
*/
|
||||
class wxRichTextStyleListCtrl : public wxControl
|
||||
{
|
||||
public:
|
||||
//@{
|
||||
/**
|
||||
Constructors.
|
||||
*/
|
||||
wxRichTextStyleListCtrl(wxWindow* parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0);
|
||||
wxRichTextStyleListCtrl();
|
||||
//@}
|
||||
|
||||
/**
|
||||
Creates the windows.
|
||||
*/
|
||||
bool Create(wxWindow* parent, wxWindowID id = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0);
|
||||
|
||||
/**
|
||||
Returns the associated rich text control, if any.
|
||||
*/
|
||||
wxRichTextCtrl* GetRichTextCtrl() const;
|
||||
|
||||
/**
|
||||
Returns the wxChoice control used for selecting the style category.
|
||||
*/
|
||||
wxChoice* GetStyleChoice() const;
|
||||
|
||||
/**
|
||||
Returns the wxListBox control used to view the style list.
|
||||
*/
|
||||
wxRichTextStyleListBox* GetStyleListBox() const;
|
||||
|
||||
/**
|
||||
Returns the associated style sheet, if any.
|
||||
*/
|
||||
wxRichTextStyleSheet* GetStyleSheet() const;
|
||||
|
||||
/**
|
||||
Returns the type of style to show in the list box.
|
||||
*/
|
||||
wxRichTextStyleListBox::wxRichTextStyleType GetStyleType() const;
|
||||
|
||||
/**
|
||||
Associates the control with a wxRichTextCtrl.
|
||||
*/
|
||||
void SetRichTextCtrl(wxRichTextCtrl* ctrl);
|
||||
|
||||
/**
|
||||
Associates the control with a style sheet.
|
||||
*/
|
||||
void SetStyleSheet(wxRichTextStyleSheet* styleSheet);
|
||||
|
||||
/**
|
||||
Sets the style type to display.
|
||||
|
||||
One of
|
||||
- wxRichTextStyleListBox::wxRICHTEXT_STYLE_ALL,
|
||||
- wxRichTextStyleListBox::wxRICHTEXT_STYLE_PARAGRAPH,
|
||||
- wxRichTextStyleListBox::wxRICHTEXT_STYLE_CHARACTER
|
||||
- wxRichTextStyleListBox::wxRICHTEXT_STYLE_LIST.
|
||||
*/
|
||||
void SetStyleType(wxRichTextStyleListBox::wxRichTextStyleType styleType);
|
||||
|
||||
/**
|
||||
Updates the style list box.
|
||||
*/
|
||||
void UpdateStyles();
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@class wxRichTextStyleDefinition
|
||||
|
||||
This is a base class for paragraph and character styles.
|
||||
|
||||
@library{wxrichtext}
|
||||
@category{richtext}
|
||||
*/
|
||||
class wxRichTextStyleDefinition : public wxObject
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Constructor.
|
||||
*/
|
||||
wxRichTextStyleDefinition(const wxString& name = wxEmptyString);
|
||||
|
||||
/**
|
||||
Destructor.
|
||||
*/
|
||||
virtual ~wxRichTextStyleDefinition();
|
||||
|
||||
/**
|
||||
Returns the style on which this style is based.
|
||||
*/
|
||||
const wxString& GetBaseStyle() const;
|
||||
|
||||
/**
|
||||
Returns the style's description.
|
||||
*/
|
||||
const wxString& GetDescription() const;
|
||||
|
||||
/**
|
||||
Returns the style name.
|
||||
*/
|
||||
const wxString& GetName() const;
|
||||
|
||||
//@{
|
||||
/**
|
||||
Returns the attributes associated with this style.
|
||||
*/
|
||||
wxRichTextAttr GetStyle() const;
|
||||
const wxRichTextAttr GetStyle() const;
|
||||
//@}
|
||||
|
||||
/**
|
||||
Returns the style attributes combined with the attributes of the specified base
|
||||
style, if any. This function works recursively.
|
||||
*/
|
||||
virtual wxRichTextAttr GetStyleMergedWithBase(const wxRichTextStyleSheet* sheet) const;
|
||||
|
||||
/**
|
||||
Sets the name of the style that this style is based on.
|
||||
*/
|
||||
void SetBaseStyle(const wxString& name);
|
||||
|
||||
/**
|
||||
Sets the style description.
|
||||
*/
|
||||
void SetDescription(const wxString& descr);
|
||||
|
||||
/**
|
||||
Sets the name of the style.
|
||||
*/
|
||||
void SetName(const wxString& name);
|
||||
|
||||
/**
|
||||
Sets the attributes for this style.
|
||||
*/
|
||||
void SetStyle(const wxRichTextAttr& style);
|
||||
|
||||
/**
|
||||
Returns the definition's properties.
|
||||
*/
|
||||
wxRichTextProperties& GetProperties();
|
||||
|
||||
/**
|
||||
Returns the definition's properties.
|
||||
*/
|
||||
const wxRichTextProperties& GetProperties() const;
|
||||
|
||||
/**
|
||||
Sets the definition's properties.
|
||||
*/
|
||||
void SetProperties(const wxRichTextProperties& props);
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@class wxRichTextParagraphStyleDefinition
|
||||
|
||||
This class represents a paragraph style definition, usually added to a
|
||||
wxRichTextStyleSheet.
|
||||
|
||||
@library{wxrichtext}
|
||||
@category{richtext}
|
||||
*/
|
||||
class wxRichTextParagraphStyleDefinition : public wxRichTextStyleDefinition
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Constructor.
|
||||
*/
|
||||
wxRichTextParagraphStyleDefinition(const wxString& name = wxEmptyString);
|
||||
|
||||
/**
|
||||
Destructor.
|
||||
*/
|
||||
virtual ~wxRichTextParagraphStyleDefinition();
|
||||
|
||||
/**
|
||||
Returns the style that should normally follow this style.
|
||||
*/
|
||||
const wxString& GetNextStyle() const;
|
||||
|
||||
/**
|
||||
Sets the style that should normally follow this style.
|
||||
*/
|
||||
void SetNextStyle(const wxString& name);
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@class wxRichTextStyleListBox
|
||||
|
||||
This is a listbox that can display the styles in a wxRichTextStyleSheet,
|
||||
and apply the selection to an associated wxRichTextCtrl.
|
||||
|
||||
See @c samples/richtext for an example of how to use it.
|
||||
|
||||
@library{wxrichtext}
|
||||
@category{richtext}
|
||||
|
||||
@see wxRichTextStyleComboCtrl, @ref overview_richtextctrl
|
||||
*/
|
||||
class wxRichTextStyleListBox : public wxHtmlListBox
|
||||
{
|
||||
public:
|
||||
|
||||
/// Which type of style definition is currently showing?
|
||||
enum wxRichTextStyleType
|
||||
{
|
||||
wxRICHTEXT_STYLE_ALL,
|
||||
wxRICHTEXT_STYLE_PARAGRAPH,
|
||||
wxRICHTEXT_STYLE_CHARACTER,
|
||||
wxRICHTEXT_STYLE_LIST,
|
||||
wxRICHTEXT_STYLE_BOX
|
||||
};
|
||||
|
||||
/**
|
||||
Constructor.
|
||||
*/
|
||||
wxRichTextStyleListBox(wxWindow* parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0);
|
||||
wxRichTextStyleListBox();
|
||||
|
||||
/**
|
||||
Destructor.
|
||||
*/
|
||||
virtual ~wxRichTextStyleListBox();
|
||||
|
||||
/**
|
||||
Creates the window.
|
||||
*/
|
||||
bool Create(wxWindow* parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0);
|
||||
|
||||
/**
|
||||
Applies the @e ith style to the associated rich text control.
|
||||
*/
|
||||
void ApplyStyle(int i);
|
||||
|
||||
/**
|
||||
Converts units in tenths of a millimetre to device units.
|
||||
*/
|
||||
int ConvertTenthsMMToPixels(wxDC& dc, int units) const;
|
||||
|
||||
/**
|
||||
Creates a suitable HTML fragment for a definition.
|
||||
*/
|
||||
wxString CreateHTML(wxRichTextStyleDefinition* def) const;
|
||||
|
||||
/**
|
||||
If the return value is @true, clicking on a style name in the list will
|
||||
immediately apply the style to the associated rich text control.
|
||||
*/
|
||||
bool GetApplyOnSelection() const;
|
||||
|
||||
/**
|
||||
Returns the wxRichTextCtrl associated with this listbox.
|
||||
*/
|
||||
wxRichTextCtrl* GetRichTextCtrl() const;
|
||||
|
||||
/**
|
||||
Gets a style for a listbox index.
|
||||
*/
|
||||
wxRichTextStyleDefinition* GetStyle(size_t i) const;
|
||||
|
||||
/**
|
||||
Returns the style sheet associated with this listbox.
|
||||
*/
|
||||
wxRichTextStyleSheet* GetStyleSheet() const;
|
||||
|
||||
/**
|
||||
Returns the type of style to show in the list box.
|
||||
*/
|
||||
wxRichTextStyleListBox::wxRichTextStyleType GetStyleType() const;
|
||||
|
||||
/**
|
||||
Implements left click behaviour, applying the clicked style to the
|
||||
wxRichTextCtrl.
|
||||
*/
|
||||
void OnLeftDown(wxMouseEvent& event);
|
||||
|
||||
/**
|
||||
If @a applyOnSelection is @true, clicking on a style name in the list will
|
||||
immediately apply the style to the associated rich text control.
|
||||
*/
|
||||
void SetApplyOnSelection(bool applyOnSelection);
|
||||
|
||||
/**
|
||||
Associates the listbox with a wxRichTextCtrl.
|
||||
*/
|
||||
void SetRichTextCtrl(wxRichTextCtrl* ctrl);
|
||||
|
||||
/**
|
||||
Associates the control with a style sheet.
|
||||
*/
|
||||
void SetStyleSheet(wxRichTextStyleSheet* styleSheet);
|
||||
|
||||
/**
|
||||
Sets the style type to display. One of
|
||||
- wxRichTextStyleListBox::wxRICHTEXT_STYLE_ALL,
|
||||
- wxRichTextStyleListBox::wxRICHTEXT_STYLE_PARAGRAPH,
|
||||
- wxRichTextStyleListBox::wxRICHTEXT_STYLE_CHARACTER
|
||||
- wxRichTextStyleListBox::wxRICHTEXT_STYLE_LIST.
|
||||
*/
|
||||
void SetStyleType(wxRichTextStyleListBox::wxRichTextStyleType styleType);
|
||||
|
||||
/**
|
||||
Updates the list from the associated style sheet.
|
||||
*/
|
||||
void UpdateStyles();
|
||||
|
||||
protected:
|
||||
|
||||
/**
|
||||
Returns the HTML for this item.
|
||||
*/
|
||||
virtual wxString OnGetItem(size_t n) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@class wxRichTextStyleComboCtrl
|
||||
|
||||
This is a combo control that can display the styles in a wxRichTextStyleSheet,
|
||||
and apply the selection to an associated wxRichTextCtrl.
|
||||
|
||||
See @c samples/richtext for an example of how to use it.
|
||||
|
||||
@library{wxrichtext}
|
||||
@category{richtext}
|
||||
|
||||
@see wxRichTextStyleListBox, @ref overview_richtextctrl
|
||||
*/
|
||||
class wxRichTextStyleComboCtrl : public wxComboCtrl
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Constructor.
|
||||
*/
|
||||
wxRichTextStyleComboCtrl(wxWindow* parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0);
|
||||
wxRichTextStyleComboCtrl();
|
||||
|
||||
/**
|
||||
Destructor.
|
||||
*/
|
||||
virtual ~wxRichTextStyleComboCtrl();
|
||||
|
||||
/**
|
||||
Creates the windows.
|
||||
*/
|
||||
bool Create(wxWindow* parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0);
|
||||
|
||||
/**
|
||||
Returns the wxRichTextCtrl associated with this control.
|
||||
*/
|
||||
wxRichTextCtrl* GetRichTextCtrl() const;
|
||||
|
||||
/**
|
||||
Returns the style sheet associated with this control.
|
||||
*/
|
||||
wxRichTextStyleSheet* GetStyleSheet() const;
|
||||
|
||||
/**
|
||||
Associates the control with a wxRichTextCtrl.
|
||||
*/
|
||||
void SetRichTextCtrl(wxRichTextCtrl* ctrl);
|
||||
|
||||
/**
|
||||
Associates the control with a style sheet.
|
||||
*/
|
||||
void SetStyleSheet(wxRichTextStyleSheet* styleSheet);
|
||||
|
||||
/**
|
||||
Updates the combo control from the associated style sheet.
|
||||
*/
|
||||
void UpdateStyles();
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@class wxRichTextCharacterStyleDefinition
|
||||
|
||||
This class represents a character style definition, usually added to a
|
||||
wxRichTextStyleSheet.
|
||||
|
||||
@library{wxrichtext}
|
||||
@category{richtext}
|
||||
*/
|
||||
class wxRichTextCharacterStyleDefinition : public wxRichTextStyleDefinition
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Constructor.
|
||||
*/
|
||||
wxRichTextCharacterStyleDefinition(const wxString& name = wxEmptyString);
|
||||
|
||||
/**
|
||||
Destructor.
|
||||
*/
|
||||
virtual ~wxRichTextCharacterStyleDefinition();
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@class wxRichTextListStyleDefinition
|
||||
|
||||
This class represents a list style definition, usually added to a
|
||||
wxRichTextStyleSheet.
|
||||
|
||||
The class inherits paragraph attributes from wxRichTextStyleParagraphDefinition,
|
||||
and adds 10 further attribute objects, one for each level of a list.
|
||||
When applying a list style to a paragraph, the list style's base and
|
||||
appropriate level attributes are merged with the paragraph's existing attributes.
|
||||
|
||||
You can apply a list style to one or more paragraphs using wxRichTextCtrl::SetListStyle.
|
||||
You can also use the functions wxRichTextCtrl::NumberList, wxRichTextCtrl::PromoteList and
|
||||
wxRichTextCtrl::ClearListStyle.
|
||||
|
||||
As usual, there are wxRichTextBuffer versions of these functions
|
||||
so that you can apply them directly to a buffer without requiring a control.
|
||||
|
||||
@library{wxrichtext}
|
||||
@category{richtext}
|
||||
*/
|
||||
class wxRichTextListStyleDefinition : public wxRichTextParagraphStyleDefinition
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Constructor.
|
||||
*/
|
||||
wxRichTextListStyleDefinition(const wxString& name = wxEmptyString);
|
||||
|
||||
/**
|
||||
Destructor.
|
||||
*/
|
||||
virtual ~wxRichTextListStyleDefinition();
|
||||
|
||||
/**
|
||||
This function combines the given paragraph style with the list style's base
|
||||
attributes and level style matching the given indent, returning the combined attributes.
|
||||
|
||||
If @a styleSheet is specified, the base style for this definition will also be
|
||||
included in the result.
|
||||
*/
|
||||
wxRichTextAttr CombineWithParagraphStyle(int indent,
|
||||
const wxRichTextAttr& paraStyle,
|
||||
wxRichTextStyleSheet* styleSheet = nullptr);
|
||||
|
||||
/**
|
||||
This function finds the level (from 0 to 9) whose indentation attribute mostly
|
||||
closely matches @a indent (expressed in tenths of a millimetre).
|
||||
*/
|
||||
int FindLevelForIndent(int indent) const;
|
||||
|
||||
/**
|
||||
This function combines the list style's base attributes and the level style
|
||||
matching the given indent, returning the combined attributes.
|
||||
|
||||
If @a styleSheet is specified, the base style for this definition will also be
|
||||
included in the result.
|
||||
*/
|
||||
wxRichTextAttr GetCombinedStyle(int indent,
|
||||
wxRichTextStyleSheet* styleSheet = nullptr);
|
||||
|
||||
/**
|
||||
This function combines the list style's base attributes and the style for the
|
||||
specified level, returning the combined attributes.
|
||||
|
||||
If @a styleSheet is specified, the base style for this definition will also be
|
||||
included in the result.
|
||||
*/
|
||||
|
||||
wxRichTextAttr GetCombinedStyleForLevel(int level,
|
||||
wxRichTextStyleSheet* styleSheet = nullptr);
|
||||
|
||||
/**
|
||||
Returns the style for the given level. @a level is a number between 0 and 9.
|
||||
*/
|
||||
const wxRichTextAttr* GetLevelAttributes(int level) const;
|
||||
|
||||
/**
|
||||
Returns the number of levels. This is hard-wired to 10.
|
||||
Returns the style for the given level. @e level is a number between 0 and 9.
|
||||
*/
|
||||
int GetLevelCount() const;
|
||||
|
||||
/**
|
||||
Returns @true if the given level has numbered list attributes.
|
||||
*/
|
||||
bool IsNumbered(int level) const;
|
||||
|
||||
/**
|
||||
Sets the style for the given level. @a level is a number between 0 and 9.
|
||||
The first and most flexible form uses a wxTextAttr object, while the second
|
||||
form is for convenient setting of the most commonly-used attributes.
|
||||
*/
|
||||
void SetLevelAttributes(int level, const wxRichTextAttr& attr);
|
||||
|
||||
/**
|
||||
Convenience function for setting the major attributes for a list level specification.
|
||||
*/
|
||||
void SetAttributes(int i, int leftIndent, int leftSubIndent, int bulletStyle, const wxString& bulletSymbol = wxEmptyString);
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@class wxRichTextStyleSheet
|
||||
|
||||
A style sheet contains named paragraph and character styles that make it
|
||||
easy for a user to apply combinations of attributes to a wxRichTextCtrl.
|
||||
|
||||
You can use a wxRichTextStyleListBox in your user interface to show available
|
||||
styles to the user, and allow application of styles to the control.
|
||||
|
||||
@library{wxrichtext}
|
||||
@category{richtext}
|
||||
*/
|
||||
class wxRichTextStyleSheet : public wxObject
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Constructor.
|
||||
*/
|
||||
wxRichTextStyleSheet();
|
||||
|
||||
/**
|
||||
Copy constructor.
|
||||
*/
|
||||
wxRichTextStyleSheet(const wxRichTextStyleSheet& sheet);
|
||||
|
||||
/**
|
||||
Destructor.
|
||||
*/
|
||||
virtual ~wxRichTextStyleSheet();
|
||||
|
||||
/**
|
||||
Copies given style sheet.
|
||||
*/
|
||||
void Copy(const wxRichTextStyleSheet& sheet);
|
||||
|
||||
/**
|
||||
Adds a definition to the character style list.
|
||||
*/
|
||||
bool AddCharacterStyle(wxRichTextCharacterStyleDefinition* def);
|
||||
|
||||
/**
|
||||
Adds a definition to the list style list.
|
||||
*/
|
||||
bool AddListStyle(wxRichTextListStyleDefinition* def);
|
||||
|
||||
/**
|
||||
Adds a definition to the paragraph style list.
|
||||
*/
|
||||
bool AddParagraphStyle(wxRichTextParagraphStyleDefinition* def);
|
||||
|
||||
/**
|
||||
Adds a definition to the appropriate style list.
|
||||
*/
|
||||
bool AddStyle(wxRichTextStyleDefinition* def);
|
||||
|
||||
/**
|
||||
Deletes all styles.
|
||||
*/
|
||||
void DeleteStyles();
|
||||
|
||||
/**
|
||||
Finds a character definition by name.
|
||||
*/
|
||||
wxRichTextCharacterStyleDefinition* FindCharacterStyle(const wxString& name,
|
||||
bool recurse = true) const;
|
||||
|
||||
/**
|
||||
Finds a list definition by name.
|
||||
*/
|
||||
wxRichTextListStyleDefinition* FindListStyle(const wxString& name,
|
||||
bool recurse = true) const;
|
||||
|
||||
/**
|
||||
Finds a paragraph definition by name.
|
||||
*/
|
||||
wxRichTextParagraphStyleDefinition* FindParagraphStyle(const wxString& name,
|
||||
bool recurse = true) const;
|
||||
|
||||
/**
|
||||
Finds a style definition by name.
|
||||
*/
|
||||
wxRichTextStyleDefinition* FindStyle(const wxString& name) const;
|
||||
|
||||
/**
|
||||
Returns the @e nth character style.
|
||||
*/
|
||||
wxRichTextCharacterStyleDefinition* GetCharacterStyle(size_t n) const;
|
||||
|
||||
/**
|
||||
Returns the number of character styles.
|
||||
*/
|
||||
size_t GetCharacterStyleCount() const;
|
||||
|
||||
/**
|
||||
Returns the style sheet's description.
|
||||
*/
|
||||
const wxString& GetDescription() const;
|
||||
|
||||
/**
|
||||
Returns the @e nth list style.
|
||||
*/
|
||||
wxRichTextListStyleDefinition* GetListStyle(size_t n) const;
|
||||
|
||||
/**
|
||||
Returns the number of list styles.
|
||||
*/
|
||||
size_t GetListStyleCount() const;
|
||||
|
||||
/**
|
||||
Returns the style sheet's name.
|
||||
*/
|
||||
const wxString& GetName() const;
|
||||
|
||||
/**
|
||||
Returns the @e nth paragraph style.
|
||||
*/
|
||||
wxRichTextParagraphStyleDefinition* GetParagraphStyle(size_t n) const;
|
||||
|
||||
/**
|
||||
Returns the number of paragraph styles.
|
||||
*/
|
||||
size_t GetParagraphStyleCount() const;
|
||||
|
||||
/**
|
||||
Removes a character style.
|
||||
*/
|
||||
bool RemoveCharacterStyle(wxRichTextStyleDefinition* def,
|
||||
bool deleteStyle = false);
|
||||
|
||||
/**
|
||||
Removes a list style.
|
||||
*/
|
||||
bool RemoveListStyle(wxRichTextStyleDefinition* def,
|
||||
bool deleteStyle = false);
|
||||
|
||||
/**
|
||||
Removes a paragraph style.
|
||||
*/
|
||||
bool RemoveParagraphStyle(wxRichTextStyleDefinition* def,
|
||||
bool deleteStyle = false);
|
||||
|
||||
/**
|
||||
Removes a style.
|
||||
*/
|
||||
bool RemoveStyle(wxRichTextStyleDefinition* def,
|
||||
bool deleteStyle = false);
|
||||
|
||||
/**
|
||||
Sets the style sheet's description.
|
||||
*/
|
||||
void SetDescription(const wxString& descr);
|
||||
|
||||
/**
|
||||
Sets the style sheet's name.
|
||||
*/
|
||||
void SetName(const wxString& name);
|
||||
|
||||
/**
|
||||
Returns the sheet's properties.
|
||||
*/
|
||||
wxRichTextProperties& GetProperties();
|
||||
|
||||
/**
|
||||
Returns the sheet's properties.
|
||||
*/
|
||||
const wxRichTextProperties& GetProperties() const;
|
||||
|
||||
/**
|
||||
Sets the sheet's properties.
|
||||
*/
|
||||
void SetProperties(const wxRichTextProperties& props);
|
||||
};
|
||||
|
||||
188
libs/wxWidgets-3.3.1/interface/wx/richtext/richtextsymboldlg.h
Normal file
188
libs/wxWidgets-3.3.1/interface/wx/richtext/richtextsymboldlg.h
Normal file
@@ -0,0 +1,188 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: richtext/richtextsymboldlg.h
|
||||
// Purpose: interface of wxSymbolPickerDialog
|
||||
// Author: wxWidgets team
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
@class wxSymbolPickerDialog
|
||||
|
||||
wxSymbolPickerDialog presents the user with a choice of fonts and a grid
|
||||
of available characters. This modal dialog provides the application with
|
||||
a selected symbol and optional font selection.
|
||||
|
||||
Although this dialog is contained in the rich text library, the dialog
|
||||
is generic and can be used in other contexts.
|
||||
|
||||
To use the dialog, pass a default symbol specified as a string, an initial font
|
||||
name, and a current font name. The difference between the initial font and
|
||||
current font is that the initial font determines what the font control will be
|
||||
set to when the dialog shows - an empty string will show the selection
|
||||
@e normal text.
|
||||
The current font, on the other hand, is used by the dialog to determine what
|
||||
font to display the characters in, even when no initial font is selected.
|
||||
This allows the user (and application) to distinguish between inserting a
|
||||
symbol in the current font, and inserting it with a specified font.
|
||||
|
||||
When the dialog is dismissed, the application can get the selected symbol
|
||||
with wxSymbolPickerDialog::GetSymbol and test whether a font was specified
|
||||
with wxSymbolPickerDialog::UseNormalFont,fetching the specified font with
|
||||
wxSymbolPickerDialog::GetFontName.
|
||||
|
||||
Here's a realistic example, inserting the supplied symbol into a
|
||||
rich text control in either the current font or specified font.
|
||||
|
||||
@code
|
||||
wxRichTextCtrl* ctrl = (wxRichTextCtrl*) FindWindow(ID_RICHTEXT_CTRL);
|
||||
|
||||
wxTextAttr attr;
|
||||
attr.SetFlags(wxTEXT_ATTR_FONT);
|
||||
ctrl-GetStyle(ctrl->GetInsertionPoint(), attr);
|
||||
|
||||
wxString currentFontName;
|
||||
if (attr.HasFont() && attr.GetFont().IsOk())
|
||||
currentFontName = attr.GetFont().GetFaceName();
|
||||
|
||||
// Don't set the initial font in the dialog (so the user is choosing
|
||||
// 'normal text', i.e. the current font) but do tell the dialog
|
||||
// what 'normal text' is.
|
||||
|
||||
wxSymbolPickerDialog dlg("*", wxEmptyString, currentFontName, this);
|
||||
|
||||
if (dlg.ShowModal() == wxID_OK)
|
||||
{
|
||||
if (dlg.HasSelection())
|
||||
{
|
||||
long insertionPoint = ctrl-GetInsertionPoint();
|
||||
|
||||
ctrl->WriteText(dlg.GetSymbol());
|
||||
|
||||
if (!dlg.UseNormalFont())
|
||||
{
|
||||
wxFont font(attr.GetFont());
|
||||
font.SetFaceName(dlg.GetFontName());
|
||||
attr.SetFont(font);
|
||||
ctrl-SetStyle(insertionPoint, insertionPoint+1, attr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@endcode
|
||||
|
||||
@library{wxrichtext}
|
||||
@category{cmndlg}
|
||||
*/
|
||||
class wxSymbolPickerDialog : public wxDialog
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Default ctor.
|
||||
*/
|
||||
wxSymbolPickerDialog();
|
||||
|
||||
/**
|
||||
Constructor.
|
||||
|
||||
@param symbol
|
||||
The initial symbol to show.
|
||||
Specify a single character in a string, or an empty string.
|
||||
@param initialFont
|
||||
The initial font to be displayed in the font list.
|
||||
If empty, the item normal text will be selected.
|
||||
@param normalTextFont
|
||||
The font the dialog will use to display the symbols if the
|
||||
initial font is empty.
|
||||
@param parent
|
||||
The dialog's parent.
|
||||
@param id
|
||||
The dialog's identifier.
|
||||
@param title
|
||||
The dialog's caption.
|
||||
@param pos
|
||||
The dialog's position.
|
||||
@param size
|
||||
The dialog's size.
|
||||
@param style
|
||||
The dialog's window style.
|
||||
*/
|
||||
wxSymbolPickerDialog(const wxString& symbol,
|
||||
const wxString& initialFont,
|
||||
const wxString& normalTextFont,
|
||||
wxWindow* parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxString& title = _("Symbols"),
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxCLOSE_BOX);
|
||||
|
||||
/**
|
||||
Creation: see @ref wxSymbolPickerDialog() "the constructor" for details about
|
||||
the parameters.
|
||||
*/
|
||||
bool Create(const wxString& symbol, const wxString& initialFont,
|
||||
const wxString& normalTextFont, wxWindow* parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxString& caption = wxGetTranslation("Symbols"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(400, 300), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxCLOSE_BOX);
|
||||
|
||||
/**
|
||||
Returns the font name (the font reflected in the font list).
|
||||
*/
|
||||
wxString GetFontName() const;
|
||||
|
||||
/**
|
||||
Returns @true if the dialog is showing the full range of Unicode characters.
|
||||
*/
|
||||
bool GetFromUnicode() const;
|
||||
|
||||
/**
|
||||
Gets the font name used for displaying symbols in the absence of a selected font.
|
||||
*/
|
||||
wxString GetNormalTextFontName() const;
|
||||
|
||||
/**
|
||||
Gets the current or initial symbol as a string.
|
||||
*/
|
||||
wxString GetSymbol() const;
|
||||
|
||||
/**
|
||||
Gets the selected symbol character as an integer.
|
||||
*/
|
||||
int GetSymbolChar() const;
|
||||
|
||||
/**
|
||||
Returns @true if a symbol is selected.
|
||||
*/
|
||||
bool HasSelection() const;
|
||||
|
||||
/**
|
||||
Sets the initial/selected font name.
|
||||
*/
|
||||
void SetFontName(wxString value);
|
||||
|
||||
/**
|
||||
Sets the internal flag indicating that the full Unicode range should be
|
||||
displayed.
|
||||
*/
|
||||
void SetFromUnicode(bool value);
|
||||
|
||||
/**
|
||||
Sets the name of the font to be used in the absence of a selected font.
|
||||
*/
|
||||
void SetNormalTextFontName(wxString value);
|
||||
|
||||
/**
|
||||
Sets the symbol as a one or zero character string.
|
||||
*/
|
||||
void SetSymbol(wxString value);
|
||||
|
||||
/**
|
||||
Sets Unicode display mode.
|
||||
*/
|
||||
void SetUnicodeMode(bool unicodeMode);
|
||||
|
||||
/**
|
||||
Returns @true if the has specified normal text - that is, there is no selected font.
|
||||
*/
|
||||
bool UseNormalFont() const;
|
||||
};
|
||||
|
||||
84
libs/wxWidgets-3.3.1/interface/wx/richtext/richtextxml.h
Normal file
84
libs/wxWidgets-3.3.1/interface/wx/richtext/richtextxml.h
Normal file
@@ -0,0 +1,84 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: richtext/richtextxml.h
|
||||
// Purpose: interface of wxRichTextXMLHandler
|
||||
// Author: wxWidgets team
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
@class wxRichTextXMLHandler
|
||||
|
||||
A handler for loading and saving content in an XML format specific
|
||||
to wxRichTextBuffer.
|
||||
|
||||
You can either add the handler to the buffer and load and save through
|
||||
the buffer or control API, or you can create an instance of the handler
|
||||
on the stack and call its functions directly.
|
||||
|
||||
|
||||
@section richtextxmlhandler_flags Handler flags
|
||||
|
||||
The following flags can be used with this handler, via the handler's SetFlags()
|
||||
function or the buffer or control's SetHandlerFlags() function:
|
||||
|
||||
- wxRICHTEXT_HANDLER_INCLUDE_STYLESHEET
|
||||
Include the style sheet in loading and saving operations.
|
||||
|
||||
|
||||
@library{wxrichtext}
|
||||
@category{richtext}
|
||||
*/
|
||||
class wxRichTextXMLHandler : public wxRichTextFileHandler
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Constructor.
|
||||
*/
|
||||
wxRichTextXMLHandler(const wxString& name = "XML",
|
||||
const wxString& ext = "xml",
|
||||
int type = wxRICHTEXT_TYPE_XML);
|
||||
|
||||
/**
|
||||
Returns @true.
|
||||
*/
|
||||
virtual bool CanLoad() const;
|
||||
|
||||
/**
|
||||
Returns @true.
|
||||
*/
|
||||
virtual bool CanSave() const;
|
||||
|
||||
/**
|
||||
Recursively exports an object to the stream.
|
||||
*/
|
||||
bool ExportXML(wxOutputStream& stream, wxRichTextObject& obj, int level);
|
||||
|
||||
/**
|
||||
Recursively imports an object.
|
||||
*/
|
||||
bool ImportXML(wxRichTextBuffer* buffer, wxRichTextObject* obj, wxXmlNode* node);
|
||||
|
||||
/**
|
||||
Call with XML node name, C++ class name so that wxRTC can read in the node.
|
||||
If you add a custom object, call this.
|
||||
*/
|
||||
static void RegisterNodeName(const wxString& nodeName, const wxString& className) { sm_nodeNameToClassMap[nodeName] = className; }
|
||||
|
||||
/**
|
||||
Cleans up the mapping between node name and C++ class.
|
||||
*/
|
||||
static void ClearNodeToClassMap() { sm_nodeNameToClassMap.clear(); }
|
||||
|
||||
protected:
|
||||
|
||||
/**
|
||||
Loads buffer context from the given stream.
|
||||
*/
|
||||
virtual bool DoLoadFile(wxRichTextBuffer* buffer, wxInputStream& stream);
|
||||
|
||||
/**
|
||||
Saves buffer context to the given stream.
|
||||
*/
|
||||
virtual bool DoSaveFile(wxRichTextBuffer* buffer, wxOutputStream& stream);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user