Files
GDevelop/Extensions/TextObject/Dialogs/TextObjectDialogs.cpp
T
Florian Rival a8559bfbbc Add clang-format to format (C++) source files automatically (#491)
* Update all CMakeLists of extensions to use clang-format
* Run clang-format on all Extensions
* Update GDCore CMakeLists.txt to add clang-format
* Run clang-format on GDCore files
* Update GDJS and GDCpp CMakeLists.txt to add clang-format
* Run clang-format on GDCpp and GDJS files
2018-05-09 15:57:38 -07:00

358 lines
12 KiB
C++

//////////////////////////////////////////////////////////////////////
// This file was auto-generated by codelite's wxCrafter Plugin
// wxCrafter project file: TextObjectEditor.wxcp
// Do not modify this file by hand!
//////////////////////////////////////////////////////////////////////
#include "TextObjectDialogs.h"
// Declare the bitmap loading function
extern void wxC9DFDInitBitmapResources();
static bool bBitmapLoaded = false;
TextObjectEditorBase::TextObjectEditorBase(wxWindow* parent,
wxWindowID id,
const wxString& title,
const wxPoint& pos,
const wxSize& size,
long style)
: wxDialog(parent, id, title, pos, size, style) {
if (!bBitmapLoaded) {
// We need to initialise the default bitmap handler
wxXmlResource::Get()->AddHandler(new wxBitmapXmlHandler);
wxC9DFDInitBitmapResources();
bBitmapLoaded = true;
}
m_auimgr = new wxAuiManager;
m_auimgr->SetManagedWindow(this);
m_auimgr->SetFlags(wxAUI_MGR_LIVE_RESIZE | wxAUI_MGR_TRANSPARENT_HINT |
wxAUI_MGR_TRANSPARENT_DRAG);
m_auimgr->GetArtProvider()->SetMetric(wxAUI_DOCKART_GRADIENT_TYPE,
wxAUI_GRADIENT_NONE);
m_toolbar =
new wxAuiToolBar(this,
wxID_ANY,
wxDefaultPosition,
wxSize(-1, -1),
wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_HORZ_TEXT |
wxAUI_TB_HORZ_LAYOUT | wxAUI_TB_NO_AUTORESIZE);
m_toolbar->SetToolBitmapSize(wxSize(16, 16));
m_auimgr->AddPane(m_toolbar,
wxAuiPaneInfo()
.Direction(wxAUI_DOCK_TOP)
.Layer(0)
.Row(0)
.Position(0)
.BestSize(100, 30)
.MinSize(100, 20)
.MaxSize(-1, 50)
.Fixed()
.CaptionVisible(false)
.MaximizeButton(false)
.CloseButton(false)
.MinimizeButton(false)
.PinButton(false));
m_fontTextCtrl = new wxTextCtrl(
m_toolbar, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(150, -1), 0);
m_fontTextCtrl->SetToolTip(
_("The font used by the text object.\nIf empty, uses the default font "
"provided with GDevelop (Liberation)"));
#if wxVERSION_NUMBER >= 3000
m_fontTextCtrl->SetHint(_("Default font"));
#endif
m_toolbar->AddControl(m_fontTextCtrl);
m_toolbar->AddTool(CHANGE_FONT_BUTTON,
wxT(""),
wxXmlResource::Get()->LoadBitmap(wxT("open16")),
wxNullBitmap,
wxITEM_NORMAL,
_("Change the font file"),
wxT(""),
NULL);
m_toolbar->AddSeparator();
wxArrayString m_sizeComboboxArr;
m_sizeComboboxArr.Add(wxT("8"));
m_sizeComboboxArr.Add(wxT("10"));
m_sizeComboboxArr.Add(wxT("12"));
m_sizeComboboxArr.Add(wxT("14"));
m_sizeComboboxArr.Add(wxT("16"));
m_sizeComboboxArr.Add(wxT("18"));
m_sizeComboboxArr.Add(wxT("20"));
m_sizeComboboxArr.Add(wxT("24"));
m_sizeComboboxArr.Add(wxT("28"));
m_sizeComboboxArr.Add(wxT("32"));
m_sizeComboboxArr.Add(wxT("48"));
m_sizeComboboxArr.Add(wxT("72"));
m_sizeComboboxArr.Add(wxT("100"));
m_sizeCombobox = new wxComboBox(m_toolbar,
wxID_ANY,
wxT(""),
wxDefaultPosition,
wxSize(-1, -1),
m_sizeComboboxArr,
0);
#if wxVERSION_NUMBER >= 3000
m_sizeCombobox->SetHint(wxT(""));
#endif
m_sizeCombobox->SetSelection(6);
m_toolbar->AddControl(m_sizeCombobox);
m_toolbar->AddTool(COLOR_TOOL_ID,
_("Color..."),
wxXmlResource::Get()->LoadBitmap(wxT("error")),
wxNullBitmap,
wxITEM_NORMAL,
_("Change the text color..."),
wxT(""),
NULL);
m_toolbar->AddSeparator();
m_toolbar->AddTool(BOLD_TOOL_ID,
wxT(""),
wxXmlResource::Get()->LoadBitmap(wxT("bold16")),
wxNullBitmap,
wxITEM_CHECK,
_("Bold"),
_("Bold"),
NULL);
m_toolbar->AddTool(ITALIC_TOOL_ID,
wxT(""),
wxXmlResource::Get()->LoadBitmap(wxT("italic16")),
wxNullBitmap,
wxITEM_CHECK,
_("Italic"),
_("Italic"),
NULL);
m_toolbar->AddTool(UNDER_TOOL_ID,
wxT(""),
wxXmlResource::Get()->LoadBitmap(wxT("underline16")),
wxNullBitmap,
wxITEM_CHECK,
_("Underline"),
_("Underline"),
NULL);
m_toolbar->Realize();
m_centerPanel = new wxPanel(
this, wxID_ANY, wxDefaultPosition, wxSize(-1, -1), wxTAB_TRAVERSAL);
m_auimgr->AddPane(m_centerPanel,
wxAuiPaneInfo()
.Direction(wxAUI_DOCK_CENTER)
.Layer(0)
.Row(0)
.Position(0)
.BestSize(480, 350)
.MinSize(480, 250)
.MaxSize(1000, 800)
.Fixed()
.CaptionVisible(false)
.MaximizeButton(false)
.CloseButton(false)
.MinimizeButton(false)
.PinButton(false));
m_auimgr->Update();
wxFlexGridSizer* flexGridSizer36 = new wxFlexGridSizer(0, 1, 0, 0);
flexGridSizer36->SetFlexibleDirection(wxBOTH);
flexGridSizer36->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
flexGridSizer36->AddGrowableCol(0);
flexGridSizer36->AddGrowableRow(0);
m_centerPanel->SetSizer(flexGridSizer36);
m_textCtrl = new wxTextCtrl(m_centerPanel,
wxID_ANY,
wxT(""),
wxDefaultPosition,
wxSize(-1, -1),
wxTE_MULTILINE | wxTE_DONTWRAP);
flexGridSizer36->Add(m_textCtrl, 0, wxALL | wxEXPAND, 0);
m_staticText62 = new wxStaticText(m_centerPanel,
wxID_ANY,
_("Note : the font can't be previewed."),
wxDefaultPosition,
wxSize(-1, -1),
0);
wxFont m_staticText62Font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT);
m_staticText62Font.SetStyle(wxFONTSTYLE_ITALIC);
m_staticText62->SetFont(m_staticText62Font);
flexGridSizer36->Add(m_staticText62, 0, wxALL, 5);
wxFlexGridSizer* flexGridSizer76 = new wxFlexGridSizer(0, 3, 0, 0);
flexGridSizer76->SetFlexibleDirection(wxBOTH);
flexGridSizer76->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
flexGridSizer76->AddGrowableCol(1);
flexGridSizer76->AddGrowableRow(0);
flexGridSizer36->Add(flexGridSizer76, 1, wxALL | wxEXPAND, 0);
m_staticBitmap80 =
new wxStaticBitmap(m_centerPanel,
wxID_ANY,
wxXmlResource::Get()->LoadBitmap(wxT("help16")),
wxDefaultPosition,
wxSize(-1, -1),
0);
flexGridSizer76->Add(
m_staticBitmap80, 0, wxALL | wxALIGN_CENTER | wxALIGN_CENTER_VERTICAL, 5);
m_helpBt = new wxHyperlinkCtrl(m_centerPanel,
wxID_ANY,
_("Help for this object"),
wxT(""),
wxDefaultPosition,
wxSize(-1, -1),
wxHL_DEFAULT_STYLE);
m_helpBt->SetNormalColour(wxColour(wxT("#0000FF")));
m_helpBt->SetHoverColour(wxColour(wxT("#0000FF")));
m_helpBt->SetVisitedColour(wxColour(wxT("#FF0000")));
flexGridSizer76->Add(m_helpBt, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);
m_stdBtnSizer40 = new wxStdDialogButtonSizer();
flexGridSizer76->Add(m_stdBtnSizer40, 0, wxALL | wxALIGN_RIGHT, 5);
m_okButton = new wxButton(
m_centerPanel, wxID_OK, wxT(""), wxDefaultPosition, wxSize(-1, -1), 0);
m_stdBtnSizer40->AddButton(m_okButton);
m_cancelButton = new wxButton(m_centerPanel,
wxID_CANCEL,
wxT(""),
wxDefaultPosition,
wxSize(-1, -1),
0);
m_stdBtnSizer40->AddButton(m_cancelButton);
m_stdBtnSizer40->Realize();
SetName(wxT("TextObjectEditorBase"));
SetMinSize(wxSize(480, 250));
SetSizeHints(-1, -1);
if (GetSizer()) {
GetSizer()->Fit(this);
}
CentreOnParent(wxBOTH);
// Connect events
this->Connect(CHANGE_FONT_BUTTON,
wxEVT_COMMAND_TOOL_CLICKED,
wxCommandEventHandler(TextObjectEditorBase::OnChangeFontButton),
NULL,
this);
m_sizeCombobox->Connect(
wxEVT_COMMAND_COMBOBOX_SELECTED,
wxCommandEventHandler(
TextObjectEditorBase::OnSizeComboboxSelectionChanged),
NULL,
this);
m_sizeCombobox->Connect(
wxEVT_COMMAND_TEXT_UPDATED,
wxCommandEventHandler(TextObjectEditorBase::OnSizeComboboxUpdated),
NULL,
this);
this->Connect(COLOR_TOOL_ID,
wxEVT_COMMAND_TOOL_CLICKED,
wxCommandEventHandler(TextObjectEditorBase::OnColorToolClicked),
NULL,
this);
this->Connect(BOLD_TOOL_ID,
wxEVT_COMMAND_TOOL_CLICKED,
wxCommandEventHandler(TextObjectEditorBase::OnBoldToolClicked),
NULL,
this);
this->Connect(
ITALIC_TOOL_ID,
wxEVT_COMMAND_TOOL_CLICKED,
wxCommandEventHandler(TextObjectEditorBase::OnItalicToolClicked),
NULL,
this);
this->Connect(
UNDER_TOOL_ID,
wxEVT_COMMAND_TOOL_CLICKED,
wxCommandEventHandler(TextObjectEditorBase::OnUnderlineToolClicked),
NULL,
this);
m_helpBt->Connect(
wxEVT_COMMAND_HYPERLINK,
wxHyperlinkEventHandler(TextObjectEditorBase::OnHelpBtClicked),
NULL,
this);
m_okButton->Connect(
wxEVT_COMMAND_BUTTON_CLICKED,
wxCommandEventHandler(TextObjectEditorBase::OnOkBtClicked),
NULL,
this);
}
TextObjectEditorBase::~TextObjectEditorBase() {
this->Disconnect(
CHANGE_FONT_BUTTON,
wxEVT_COMMAND_TOOL_CLICKED,
wxCommandEventHandler(TextObjectEditorBase::OnChangeFontButton),
NULL,
this);
m_sizeCombobox->Disconnect(
wxEVT_COMMAND_COMBOBOX_SELECTED,
wxCommandEventHandler(
TextObjectEditorBase::OnSizeComboboxSelectionChanged),
NULL,
this);
m_sizeCombobox->Disconnect(
wxEVT_COMMAND_TEXT_UPDATED,
wxCommandEventHandler(TextObjectEditorBase::OnSizeComboboxUpdated),
NULL,
this);
this->Disconnect(
COLOR_TOOL_ID,
wxEVT_COMMAND_TOOL_CLICKED,
wxCommandEventHandler(TextObjectEditorBase::OnColorToolClicked),
NULL,
this);
this->Disconnect(
BOLD_TOOL_ID,
wxEVT_COMMAND_TOOL_CLICKED,
wxCommandEventHandler(TextObjectEditorBase::OnBoldToolClicked),
NULL,
this);
this->Disconnect(
ITALIC_TOOL_ID,
wxEVT_COMMAND_TOOL_CLICKED,
wxCommandEventHandler(TextObjectEditorBase::OnItalicToolClicked),
NULL,
this);
this->Disconnect(
UNDER_TOOL_ID,
wxEVT_COMMAND_TOOL_CLICKED,
wxCommandEventHandler(TextObjectEditorBase::OnUnderlineToolClicked),
NULL,
this);
m_helpBt->Disconnect(
wxEVT_COMMAND_HYPERLINK,
wxHyperlinkEventHandler(TextObjectEditorBase::OnHelpBtClicked),
NULL,
this);
m_okButton->Disconnect(
wxEVT_COMMAND_BUTTON_CLICKED,
wxCommandEventHandler(TextObjectEditorBase::OnOkBtClicked),
NULL,
this);
m_auimgr->UnInit();
delete m_auimgr;
}