The wxRTC formatting dialog now retains custom colours set within the colour dialog, and they can be accessed by the application.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77488 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -22,6 +22,7 @@
|
|||||||
#include "wx/propdlg.h"
|
#include "wx/propdlg.h"
|
||||||
#include "wx/bookctrl.h"
|
#include "wx/bookctrl.h"
|
||||||
#include "wx/withimages.h"
|
#include "wx/withimages.h"
|
||||||
|
#include "wx/colourdata.h"
|
||||||
|
|
||||||
#if wxUSE_HTML
|
#if wxUSE_HTML
|
||||||
#include "wx/htmllbox.h"
|
#include "wx/htmllbox.h"
|
||||||
@@ -241,7 +242,7 @@ public:
|
|||||||
/// Find a page by class
|
/// Find a page by class
|
||||||
wxWindow* FindPage(wxClassInfo* info) const;
|
wxWindow* FindPage(wxClassInfo* info) const;
|
||||||
|
|
||||||
/// Whether to restore the last-selected page
|
/// Whether to restore the last-selected page.
|
||||||
static bool GetRestoreLastPage() { return sm_restoreLastPage; }
|
static bool GetRestoreLastPage() { return sm_restoreLastPage; }
|
||||||
static void SetRestoreLastPage(bool b) { sm_restoreLastPage = b; }
|
static void SetRestoreLastPage(bool b) { sm_restoreLastPage = b; }
|
||||||
|
|
||||||
@@ -249,6 +250,12 @@ public:
|
|||||||
static int GetLastPage() { return sm_lastPage; }
|
static int GetLastPage() { return sm_lastPage; }
|
||||||
static void SetLastPage(int lastPage) { sm_lastPage = lastPage; }
|
static void SetLastPage(int lastPage) { sm_lastPage = lastPage; }
|
||||||
|
|
||||||
|
/// Sets the custom colour data for use by the colour dialog.
|
||||||
|
static void SetColourData(const wxColourData& colourData) { sm_colourData = colourData; }
|
||||||
|
|
||||||
|
/// Returns the custom colour data for use by the colour dialog.
|
||||||
|
static wxColourData GetColourData() { return sm_colourData; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
wxRichTextAttr m_attributes;
|
wxRichTextAttr m_attributes;
|
||||||
@@ -258,6 +265,7 @@ protected:
|
|||||||
wxArrayInt m_pageIds; // mapping of book control indexes to page ids
|
wxArrayInt m_pageIds; // mapping of book control indexes to page ids
|
||||||
int m_options; // UI options
|
int m_options; // UI options
|
||||||
bool m_ignoreUpdates;
|
bool m_ignoreUpdates;
|
||||||
|
static wxColourData sm_colourData;
|
||||||
|
|
||||||
static wxRichTextFormattingDialogFactory* ms_FormattingDialogFactory;
|
static wxRichTextFormattingDialogFactory* ms_FormattingDialogFactory;
|
||||||
static bool sm_showToolTips;
|
static bool sm_showToolTips;
|
||||||
|
@@ -275,5 +275,35 @@ public:
|
|||||||
Updates the display.
|
Updates the display.
|
||||||
*/
|
*/
|
||||||
virtual bool UpdateDisplay();
|
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();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -92,6 +92,7 @@ END_EVENT_TABLE()
|
|||||||
IMPLEMENT_HELP_PROVISION(wxRichTextFormattingDialog)
|
IMPLEMENT_HELP_PROVISION(wxRichTextFormattingDialog)
|
||||||
|
|
||||||
wxRichTextFormattingDialogFactory* wxRichTextFormattingDialog::ms_FormattingDialogFactory = NULL;
|
wxRichTextFormattingDialogFactory* wxRichTextFormattingDialog::ms_FormattingDialogFactory = NULL;
|
||||||
|
wxColourData wxRichTextFormattingDialog::sm_colourData;
|
||||||
|
|
||||||
void wxRichTextFormattingDialog::Init()
|
void wxRichTextFormattingDialog::Init()
|
||||||
{
|
{
|
||||||
@@ -762,7 +763,11 @@ void wxRichTextColourSwatchCtrl::OnMouseEvent(wxMouseEvent& event)
|
|||||||
while (parent != NULL && !wxDynamicCast(parent, wxDialog) && !wxDynamicCast(parent, wxFrame))
|
while (parent != NULL && !wxDynamicCast(parent, wxDialog) && !wxDynamicCast(parent, wxFrame))
|
||||||
parent = parent->GetParent();
|
parent = parent->GetParent();
|
||||||
|
|
||||||
|
wxRichTextFormattingDialog* dlg = wxDynamicCast(parent, wxRichTextFormattingDialog);
|
||||||
wxColourData data;
|
wxColourData data;
|
||||||
|
if (dlg)
|
||||||
|
data = dlg->GetColourData();
|
||||||
|
|
||||||
data.SetChooseFull(true);
|
data.SetChooseFull(true);
|
||||||
data.SetColour(m_colour);
|
data.SetColour(m_colour);
|
||||||
#if wxUSE_COLOURDLG
|
#if wxUSE_COLOURDLG
|
||||||
@@ -774,6 +779,8 @@ void wxRichTextColourSwatchCtrl::OnMouseEvent(wxMouseEvent& event)
|
|||||||
if (dialog->ShowModal() == wxID_OK)
|
if (dialog->ShowModal() == wxID_OK)
|
||||||
{
|
{
|
||||||
wxColourData retData = dialog->GetColourData();
|
wxColourData retData = dialog->GetColourData();
|
||||||
|
if (dlg)
|
||||||
|
dlg->SetColourData(retData);
|
||||||
m_colour = retData.GetColour();
|
m_colour = retData.GetColour();
|
||||||
SetBackgroundColour(m_colour);
|
SetBackgroundColour(m_colour);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user