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:
1035
interface/wx/richtext/richtextbuffer.h
Normal file
1035
interface/wx/richtext/richtextbuffer.h
Normal file
File diff suppressed because it is too large
Load Diff
1407
interface/wx/richtext/richtextctrl.h
Normal file
1407
interface/wx/richtext/richtextctrl.h
Normal file
File diff suppressed because it is too large
Load Diff
253
interface/wx/richtext/richtextformatdlg.h
Normal file
253
interface/wx/richtext/richtextformatdlg.h
Normal file
@@ -0,0 +1,253 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: richtext/richtextformatdlg.h
|
||||
// Purpose: interface of wxRichTextFormattingDialogFactory
|
||||
// Author: wxWidgets team
|
||||
// RCS-ID: $Id$
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
@class wxRichTextFormattingDialogFactory
|
||||
@headerfile richtextformatdlg.h wx/richtext/richtextformatdlg.h
|
||||
|
||||
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{FIXME}
|
||||
*/
|
||||
class wxRichTextFormattingDialogFactory : public wxObject
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Constructor.
|
||||
*/
|
||||
wxRichTextFormattingDialogFactory();
|
||||
|
||||
/**
|
||||
Destructor.
|
||||
*/
|
||||
~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);
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@class wxRichTextFormattingDialog
|
||||
@headerfile richtextformatdlg.h wx/richtext/richtextformatdlg.h
|
||||
|
||||
This dialog allows the user to edit a character and/or paragraph style.
|
||||
|
||||
In the constructor, specify the pages that will be created. Use GetStyle
|
||||
to retrieve the common style for a given range, and then use 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:
|
||||
//@{
|
||||
/**
|
||||
Constructors.
|
||||
|
||||
@param flags
|
||||
The pages to show.
|
||||
@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.
|
||||
*/
|
||||
wxRichTextFormattingDialog(long flags, wxWindow* parent);
|
||||
const wxPoint& pos = wxDefaultPosition, const wxSize& sz = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE)
|
||||
wxRichTextFormattingDialog();
|
||||
//@}
|
||||
|
||||
/**
|
||||
Destructor.
|
||||
*/
|
||||
~wxRichTextFormattingDialog();
|
||||
|
||||
/**
|
||||
Apply attributes to the given range, only changing attributes that need to be
|
||||
changed.
|
||||
*/
|
||||
bool ApplyStyle(wxRichTextCtrl* ctrl,
|
||||
const wxRichTextRange& range,
|
||||
int flags = wxRICHTEXT_SETSTYLE_WITH_UNDO|wxRICHTEXT_SETSTYLE_OPTIMIZE);
|
||||
|
||||
/**
|
||||
Creation: see @ref overview_wxrichtextformattingdialog "the constructor" for
|
||||
details about the parameters.
|
||||
*/
|
||||
bool Create(long flags, wxWindow* parent, const wxString& title,
|
||||
wxWindowID id,
|
||||
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.
|
||||
*/
|
||||
wxRichTextFormattingDialog* GetDialog(wxWindow* win);
|
||||
|
||||
/**
|
||||
Helper for pages to get the attributes.
|
||||
*/
|
||||
wxTextAttr* GetDialogAttributes(wxWindow* win);
|
||||
|
||||
/**
|
||||
Helper for pages to get the style.
|
||||
*/
|
||||
wxRichTextStyleDefinition* GetDialogStyleDefinition(wxWindow* win);
|
||||
|
||||
/**
|
||||
Returns the object to be used to customize the dialog and provide pages.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
bool GetStyle(wxRichTextCtrl* ctrl, const wxRichTextRange& range);
|
||||
|
||||
/**
|
||||
Gets the associated style definition, if any.
|
||||
*/
|
||||
wxRichTextStyleDefinition* GetStyleDefinition() const;
|
||||
|
||||
/**
|
||||
Gets the associated style sheet, if any.
|
||||
*/
|
||||
wxRichTextStyleSheet* GetStyleSheet() const;
|
||||
|
||||
/**
|
||||
Sets the attributes to be edited.
|
||||
*/
|
||||
void SetAttributes(const wxTextAttr& attr);
|
||||
|
||||
/**
|
||||
Sets the formatting factory object to be used for customization and page
|
||||
creation.
|
||||
It deletes the existing factory object.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
bool SetStyle(const wxTextAttr& style, bool update = true);
|
||||
|
||||
/**
|
||||
Sets the style definition and optionally update the display, if @a update is @c
|
||||
@true.
|
||||
*/
|
||||
bool SetStyleDefinition(const wxRichTextStyleDefinition& styleDef,
|
||||
wxRichTextStyleSheet* sheet,
|
||||
bool update = true);
|
||||
|
||||
/**
|
||||
Updates the display.
|
||||
*/
|
||||
bool UpdateDisplay();
|
||||
};
|
||||
|
111
interface/wx/richtext/richtexthtml.h
Normal file
111
interface/wx/richtext/richtexthtml.h
Normal file
@@ -0,0 +1,111 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: richtext/richtexthtml.h
|
||||
// Purpose: interface of wxRichTextHTMLHandler
|
||||
// Author: wxWidgets team
|
||||
// RCS-ID: $Id$
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
@class wxRichTextHTMLHandler
|
||||
@headerfile richtexthtml.h wx/richtext/richtexthtml.h
|
||||
|
||||
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
|
||||
wxRICHTEXT_HANDLER_SAVE_IMAGES_TO_MEMORY
|
||||
or 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.
|
||||
|
||||
@library{wxrichtext}
|
||||
@category{richtext}
|
||||
*/
|
||||
class wxRichTextHTMLHandler : public wxRichTextFileHandler
|
||||
{
|
||||
public:
|
||||
/**
|
||||
, wxString&@e ext = wxT("html"), @b int@e type = wxRICHTEXT_TYPE_HTML)
|
||||
Constructor.
|
||||
*/
|
||||
wxRichTextHTMLHandler() const;
|
||||
|
||||
/**
|
||||
Clears the image locations generated by the last operation.
|
||||
*/
|
||||
void ClearTemporaryImageLocations();
|
||||
|
||||
//@{
|
||||
/**
|
||||
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.
|
||||
*/
|
||||
bool DeleteTemporaryImages();
|
||||
bool DeleteTemporaryImages(int flags,
|
||||
const wxArrayString& imageLocations);
|
||||
//@}
|
||||
|
||||
/**
|
||||
Saves the buffer content to the HTML stream.
|
||||
*/
|
||||
bool DoSaveFile(wxRichTextBuffer* buffer, wxOutputStream& stream);
|
||||
|
||||
/**
|
||||
Returns the mapping for converting point sizes to HTML font sizes.
|
||||
*/
|
||||
wxArrayInt GetFontSizeMapping();
|
||||
|
||||
/**
|
||||
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
|
||||
*/
|
||||
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:
|
||||
*/
|
||||
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);
|
||||
};
|
||||
|
397
interface/wx/richtext/richtextprint.h
Normal file
397
interface/wx/richtext/richtextprint.h
Normal file
@@ -0,0 +1,397 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: richtext/richtextprint.h
|
||||
// Purpose: interface of wxRichTextHeaderFooterData
|
||||
// Author: wxWidgets team
|
||||
// RCS-ID: $Id$
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
@class wxRichTextHeaderFooterData
|
||||
@headerfile richtextprint.h wx/richtext/richtextprint.h
|
||||
|
||||
|
||||
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.
|
||||
|
||||
@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 operator=(const wxRichTextHeaderFooterData& data);
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@class wxRichTextPrintout
|
||||
@headerfile richtextprint.h wx/richtext/richtextprint.h
|
||||
|
||||
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();
|
||||
|
||||
/**
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
bool HasPage(int page);
|
||||
|
||||
/**
|
||||
Prepares for printing, laying out the buffer and calculating pagination.
|
||||
*/
|
||||
void OnPreparePrinting();
|
||||
|
||||
/**
|
||||
Does the actual printing for this page.
|
||||
*/
|
||||
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 = 252, int bottom = 252, int left = 252,
|
||||
int right = 252);
|
||||
|
||||
/**
|
||||
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
|
||||
@headerfile richtextprint.h wx/richtext/richtextprint.h
|
||||
|
||||
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:
|
||||
/**
|
||||
, @b wxWindow*@e parentWindow = @NULL)
|
||||
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();
|
||||
|
||||
/**
|
||||
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
|
||||
@e 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 @e buffer.
|
||||
*/
|
||||
bool PrintBuffer(const wxRichTextBuffer& buffer);
|
||||
|
||||
/**
|
||||
Prints the given file. @a richTextFile can be a text file or XML file, or other
|
||||
file
|
||||
depending on the available file handlers.
|
||||
*/
|
||||
bool PrintFile(const wxString& richTextFile);
|
||||
|
||||
/**
|
||||
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 wxPageSetupData& 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);
|
||||
};
|
||||
|
177
interface/wx/richtext/richtextstyledlg.h
Normal file
177
interface/wx/richtext/richtextstyledlg.h
Normal file
@@ -0,0 +1,177 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: richtext/richtextstyledlg.h
|
||||
// Purpose: interface of wxRichTextStyleOrganiserDialog
|
||||
// Author: wxWidgets team
|
||||
// RCS-ID: $Id$
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
@class wxRichTextStyleOrganiserDialog
|
||||
@headerfile richtextstyledlg.h wx/richtext/richtextstyledlg.h
|
||||
|
||||
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:
|
||||
//@{
|
||||
/**
|
||||
Constructors.
|
||||
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 wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX)
|
||||
wxRichTextStyleOrganiserDialog();
|
||||
//@}
|
||||
|
||||
/**
|
||||
Applies the selected style to selection in the given control or the control
|
||||
passed to the constructor.
|
||||
*/
|
||||
bool ApplyStyle(wxRichTextCtrl* ctrl = NULL);
|
||||
|
||||
/**
|
||||
, wxPoint&@e pos = wxDefaultPosition, wxSize&@e size = wxDefaultSize, @b
|
||||
long@e style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX)
|
||||
Creates the dialog. See
|
||||
*/
|
||||
bool Create(int flags, wxRichTextStyleSheet* sheet,
|
||||
wxRichTextCtrl* ctrl,
|
||||
wxWindow* parent,
|
||||
wxWindowID id = wxID_ANY) const;
|
||||
|
||||
/**
|
||||
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.
|
||||
*/
|
||||
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;
|
||||
};
|
||||
|
677
interface/wx/richtext/richtextstyles.h
Normal file
677
interface/wx/richtext/richtextstyles.h
Normal file
@@ -0,0 +1,677 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: richtext/richtextstyles.h
|
||||
// Purpose: interface of wxRichTextStyleListCtrl
|
||||
// Author: wxWidgets team
|
||||
// RCS-ID: $Id$
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
@class wxRichTextStyleListCtrl
|
||||
@headerfile richtextstyles.h wx/richtext/richtextstyles.h
|
||||
|
||||
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{FIXME}
|
||||
*/
|
||||
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 and
|
||||
wxRichTextStyleListBox::wxRICHTEXT_STYLE_LIST.
|
||||
*/
|
||||
void SetStyleType(wxRichTextStyleListBox::wxRichTextStyleType styleType);
|
||||
|
||||
/**
|
||||
Updates the style list box.
|
||||
*/
|
||||
void UpdateStyles();
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@class wxRichTextStyleDefinition
|
||||
@headerfile richtextstyles.h wx/richtext/richtextstyles.h
|
||||
|
||||
This is a base class for paragraph and character styles.
|
||||
|
||||
@library{wxrichtext}
|
||||
@category{FIXME}
|
||||
*/
|
||||
class wxRichTextStyleDefinition : public wxObject
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Constructor.
|
||||
*/
|
||||
wxRichTextStyleDefinition(const wxString& name = wxEmptyString);
|
||||
|
||||
/**
|
||||
Destructor.
|
||||
*/
|
||||
~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.
|
||||
*/
|
||||
wxTextAttr GetStyle() const;
|
||||
const wxTextAttr GetStyle() const;
|
||||
//@}
|
||||
|
||||
/**
|
||||
Returns the style attributes combined with the attributes of the specified base
|
||||
style, if any. This function works recursively.
|
||||
*/
|
||||
wxTextAttr GetStyleMergedWithBase(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 wxTextAttr& style);
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@class wxRichTextParagraphStyleDefinition
|
||||
@headerfile richtextstyles.h wx/richtext/richtextstyles.h
|
||||
|
||||
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.
|
||||
*/
|
||||
~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
|
||||
@headerfile richtextstyles.h wx/richtext/richtextstyles.h
|
||||
|
||||
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_wxrichtextctrloverview
|
||||
"wxRichTextCtrl overview"
|
||||
*/
|
||||
class wxRichTextStyleListBox : public wxHtmlListBox
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Constructor.
|
||||
*/
|
||||
wxRichTextStyleListBox(wxWindow* parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0);
|
||||
|
||||
/**
|
||||
Destructor.
|
||||
*/
|
||||
~wxRichTextStyleListBox();
|
||||
|
||||
/**
|
||||
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;
|
||||
|
||||
/**
|
||||
Returns the HTML for this item.
|
||||
*/
|
||||
wxString OnGetItem(size_t n) const;
|
||||
|
||||
/**
|
||||
Implements left click behaviour, applying the clicked style to the
|
||||
wxRichTextCtrl.
|
||||
*/
|
||||
void OnLeftDown(wxMouseEvent& event);
|
||||
|
||||
/**
|
||||
Reacts to selection.
|
||||
*/
|
||||
void OnSelect(wxCommandEvent& 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 and
|
||||
wxRichTextStyleListBox::wxRICHTEXT_STYLE_LIST.
|
||||
*/
|
||||
void SetStyleType(wxRichTextStyleListBox::wxRichTextStyleType styleType);
|
||||
|
||||
/**
|
||||
Updates the list from the associated style sheet.
|
||||
*/
|
||||
void UpdateStyles();
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@class wxRichTextStyleComboCtrl
|
||||
@headerfile richtextstyles.h wx/richtext/richtextstyles.h
|
||||
|
||||
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_wxrichtextctrloverview
|
||||
"wxRichTextCtrl overview"
|
||||
*/
|
||||
class wxRichTextStyleComboCtrl : public wxComboCtrl
|
||||
{
|
||||
public:
|
||||
/**
|
||||
Constructor.
|
||||
*/
|
||||
wxRichTextStyleComboCtrl(wxWindow* parent,
|
||||
wxWindowID id = wxID_ANY,
|
||||
const wxPoint& pos = wxDefaultPosition,
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0);
|
||||
|
||||
/**
|
||||
Destructor.
|
||||
*/
|
||||
~wxRichTextStyleComboCtrl();
|
||||
|
||||
/**
|
||||
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
|
||||
@headerfile richtextstyles.h wx/richtext/richtextstyles.h
|
||||
|
||||
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.
|
||||
*/
|
||||
~wxRichTextCharacterStyleDefinition();
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@class wxRichTextListStyleDefinition
|
||||
@headerfile richtextstyles.h wx/richtext/richtextstyles.h
|
||||
|
||||
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.
|
||||
*/
|
||||
~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.
|
||||
*/
|
||||
wxTextAttr CombineWithParagraphStyle(int indent,
|
||||
const wxTextAttr& paraStyle,
|
||||
wxRichTextStyleSheet* styleSheet = NULL);
|
||||
|
||||
/**
|
||||
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.
|
||||
*/
|
||||
wxTextAttr GetCombinedStyle(int indent,
|
||||
wxRichTextStyleSheet* styleSheet = NULL) const;
|
||||
|
||||
/**
|
||||
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.
|
||||
*/
|
||||
wxTextAttr GetCombinedStyleLevel(int level,
|
||||
wxRichTextStyleSheet* styleSheet = NULL) const;
|
||||
|
||||
/**
|
||||
Returns the style for the given level. @a level is a number between 0 and 9.
|
||||
*/
|
||||
const wxTextAttr* 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.
|
||||
*/
|
||||
int 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 wxTextAttr& attr);
|
||||
void SetLevelAttributes(int level, int leftIndent,
|
||||
int leftSubIndent,
|
||||
int bulletStyle,
|
||||
const wxString& bulletSymbol = wxEmptyString);
|
||||
//@}
|
||||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@class wxRichTextStyleSheet
|
||||
@headerfile richtextstyles.h wx/richtext/richtextstyles.h
|
||||
|
||||
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();
|
||||
|
||||
/**
|
||||
Destructor.
|
||||
*/
|
||||
~wxRichTextStyleSheet();
|
||||
|
||||
/**
|
||||
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) const;
|
||||
|
||||
/**
|
||||
Finds a list definition by name.
|
||||
*/
|
||||
wxRichTextListStyleDefinition* FindListStyle(const wxString& name) const;
|
||||
|
||||
/**
|
||||
Finds a paragraph definition by name.
|
||||
*/
|
||||
wxRichTextParagraphStyleDefinition* FindParagraphStyle(const wxString& name) 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);
|
||||
};
|
||||
|
190
interface/wx/richtext/richtextsymboldlg.h
Normal file
190
interface/wx/richtext/richtextsymboldlg.h
Normal file
@@ -0,0 +1,190 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: richtext/richtextsymboldlg.h
|
||||
// Purpose: interface of wxSymbolPickerDialog
|
||||
// Author: wxWidgets team
|
||||
// RCS-ID: $Id$
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
@class wxSymbolPickerDialog
|
||||
@headerfile richtextsymboldlg.h wx/richtext/richtextsymboldlg.h
|
||||
|
||||
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 GetSymbol and test whether a font was specified with UseNormalFont,
|
||||
fetching the specified font with 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().Ok())
|
||||
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(wxT("*"), 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:
|
||||
//@{
|
||||
/**
|
||||
Constructors.
|
||||
|
||||
@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 wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxCLOSE_BOX)
|
||||
wxSymbolPickerDialog();
|
||||
//@}
|
||||
|
||||
/**
|
||||
, wxPoint&@e pos = wxDefaultPosition, wxSize&@e size = wxDefaultSize, @b
|
||||
long@e 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;
|
||||
|
||||
/**
|
||||
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(const 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(const wxString& value);
|
||||
|
||||
/**
|
||||
Sets the symbol as a one or zero character string.
|
||||
*/
|
||||
void SetSymbol(const 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;
|
||||
};
|
||||
|
102
interface/wx/richtext/richtextxml.h
Normal file
102
interface/wx/richtext/richtextxml.h
Normal file
@@ -0,0 +1,102 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: richtext/richtextxml.h
|
||||
// Purpose: interface of wxRichTextXMLHandler
|
||||
// Author: wxWidgets team
|
||||
// RCS-ID: $Id$
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/**
|
||||
@class wxRichTextXMLHandler
|
||||
@headerfile richtextxml.h wx/richtext/richtextxml.h
|
||||
|
||||
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.
|
||||
|
||||
@library{wxrichtext}
|
||||
@category{richtext}
|
||||
*/
|
||||
class wxRichTextXMLHandler : public wxRichTextFileHandler
|
||||
{
|
||||
public:
|
||||
/**
|
||||
, wxString&@e ext = wxT("xml"), @b int@e type = wxRICHTEXT_TYPE_XML)
|
||||
Constructor.
|
||||
*/
|
||||
wxRichTextXMLHandler() const;
|
||||
|
||||
/**
|
||||
Returns @true.
|
||||
*/
|
||||
bool CanLoad() const;
|
||||
|
||||
/**
|
||||
Returns @true.
|
||||
*/
|
||||
bool CanSave() const;
|
||||
|
||||
/**
|
||||
Creates XML code for a given character or paragraph style.
|
||||
*/
|
||||
wxString CreateStyle(const wxTextAttr& attr, bool isPara = false);
|
||||
|
||||
/**
|
||||
Loads buffer context from the given stream.
|
||||
*/
|
||||
bool DoLoadFile(wxRichTextBuffer* buffer, wxInputStream& stream);
|
||||
|
||||
/**
|
||||
Saves buffer context to the given stream.
|
||||
*/
|
||||
bool DoSaveFile(wxRichTextBuffer* buffer, wxOutputStream& stream);
|
||||
|
||||
/**
|
||||
Recursively exports an object to the stream.
|
||||
*/
|
||||
bool ExportXML(wxOutputStream& stream, wxMBConv* convMem,
|
||||
wxMBConv* convFile,
|
||||
wxRichTextObject& obj,
|
||||
int level);
|
||||
|
||||
/**
|
||||
Helper function: gets node context.
|
||||
*/
|
||||
wxString GetNodeContent(wxXmlNode* node);
|
||||
|
||||
/**
|
||||
Helper function: gets a named parameter from the XML node.
|
||||
*/
|
||||
wxXmlNode* GetParamNode(wxXmlNode* node, const wxString& param);
|
||||
|
||||
/**
|
||||
Helper function: gets a named parameter from the XML node.
|
||||
*/
|
||||
wxString GetParamValue(wxXmlNode* node, const wxString& param);
|
||||
|
||||
/**
|
||||
Helper function: gets style parameters from the given XML node.
|
||||
*/
|
||||
bool GetStyle(wxTextAttr& attr, wxXmlNode* node,
|
||||
bool isPara = false);
|
||||
|
||||
/**
|
||||
Helper function: gets text from the node.
|
||||
*/
|
||||
wxString GetText(wxXmlNode* node,
|
||||
const wxString& param = wxEmptyString,
|
||||
bool translate = false);
|
||||
|
||||
/**
|
||||
Helper function: returns @true if the node has the given parameter.
|
||||
*/
|
||||
bool HasParam(wxXmlNode* node, const wxString& param);
|
||||
|
||||
/**
|
||||
Recursively imports an object.
|
||||
*/
|
||||
bool ImportXML(wxRichTextBuffer* buffer, wxXmlNode* node);
|
||||
};
|
||||
|
Reference in New Issue
Block a user