]> git.saurik.com Git - wxWidgets.git/blame - src/richtext/richtextimagedlg.cpp
Fixed interface typo breaking wxRibbonBar docs (from r72495).
[wxWidgets.git] / src / richtext / richtextimagedlg.cpp
CommitLineData
6255fac9
VZ
1/////////////////////////////////////////////////////////////////////////////
2// Name: src/richtext/richtextimagedlg.cpp
ce00f59b 3// Purpose:
6255fac9 4// Author: Mingquan Yang
603f702b 5// Modified by: Julian Smart
6255fac9 6// Created: Wed 02 Jun 2010 11:27:23 CST
ce00f59b 7// RCS-ID:
603f702b 8// Copyright: (c) Mingquan Yang, Julian Smart
6255fac9
VZ
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12// For compilers that support precompilation, includes "wx/wx.h".
13#include "wx/wxprec.h"
14
15#ifdef __BORLANDC__
16#pragma hdrstop
17#endif
18
0ef18b97
SC
19#if wxUSE_RICHTEXT
20
6255fac9
VZ
21#ifndef WX_PRECOMP
22 #include "wx/button.h"
23 #include "wx/combobox.h"
3a3349f5
VZ
24 #include "wx/sizer.h"
25 #include "wx/stattext.h"
6255fac9
VZ
26 #include "wx/textctrl.h"
27#endif
28
29#include "wx/statline.h"
30
31#include "wx/richtext/richtextimagedlg.h"
32#include "wx/richtext/richtextctrl.h"
33
34////@begin XPM images
35////@end XPM images
36
37
38/*!
603f702b 39 * wxRichTextObjectPropertiesDialog type definition
6255fac9
VZ
40 */
41
603f702b 42IMPLEMENT_DYNAMIC_CLASS( wxRichTextObjectPropertiesDialog, wxRichTextFormattingDialog )
6255fac9
VZ
43
44
45/*!
603f702b 46 * wxRichTextObjectPropertiesDialog event table definition
6255fac9
VZ
47 */
48
603f702b 49BEGIN_EVENT_TABLE( wxRichTextObjectPropertiesDialog, wxRichTextFormattingDialog )
6255fac9 50
603f702b
JS
51////@begin wxRichTextObjectPropertiesDialog event table entries
52////@end wxRichTextObjectPropertiesDialog event table entries
6255fac9
VZ
53
54END_EVENT_TABLE()
55
56
57/*!
603f702b 58 * wxRichTextObjectPropertiesDialog constructors
6255fac9
VZ
59 */
60
603f702b 61wxRichTextObjectPropertiesDialog::wxRichTextObjectPropertiesDialog()
6255fac9
VZ
62{
63 Init();
64}
65
603f702b 66wxRichTextObjectPropertiesDialog::wxRichTextObjectPropertiesDialog( wxRichTextObject* obj, wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
6255fac9
VZ
67{
68 Init();
603f702b 69 Create(obj, parent, id, caption, pos, size, style);
6255fac9
VZ
70}
71
72
73/*!
74 * wxRichTextImageDlg creator
75 */
76
603f702b 77bool wxRichTextObjectPropertiesDialog::Create( wxRichTextObject* obj, wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
6255fac9 78{
603f702b 79 SetObject(obj);
6255fac9 80 SetExtraStyle(wxDIALOG_EX_CONTEXTHELP);
603f702b
JS
81 long flags = wxRICHTEXT_FORMAT_SIZE|wxRICHTEXT_FORMAT_MARGINS|wxRICHTEXT_FORMAT_BORDERS|wxRICHTEXT_FORMAT_BACKGROUND;
82 wxRichTextFormattingDialog::Create( flags, parent, caption, id, pos, size, style );
6255fac9
VZ
83
84 CreateControls();
603f702b 85
6255fac9
VZ
86 return true;
87}
88
89
90/*!
603f702b 91 * wxRichTextObjectPropertiesDialog destructor
6255fac9
VZ
92 */
93
603f702b 94wxRichTextObjectPropertiesDialog::~wxRichTextObjectPropertiesDialog()
6255fac9 95{
603f702b
JS
96////@begin wxRichTextObjectPropertiesDialog destruction
97////@end wxRichTextObjectPropertiesDialog destruction
6255fac9
VZ
98}
99
100
101/*!
102 * Member initialisation
103 */
104
603f702b 105void wxRichTextObjectPropertiesDialog::Init()
6255fac9 106{
603f702b
JS
107////@begin wxRichTextObjectPropertiesDialog member initialisation
108////@end wxRichTextObjectPropertiesDialog member initialisation
6255fac9
VZ
109}
110
111
112/*!
113 * Control creation for wxRichTextImageDlg
114 */
115
603f702b 116void wxRichTextObjectPropertiesDialog::CreateControls()
ce00f59b 117{
6255fac9
VZ
118}
119
120
121/*!
122 * Should we show tooltips?
123 */
124
603f702b 125bool wxRichTextObjectPropertiesDialog::ShowToolTips()
6255fac9
VZ
126{
127 return true;
128}
129
130/*!
131 * Get bitmap resources
132 */
133
603f702b 134wxBitmap wxRichTextObjectPropertiesDialog::GetBitmapResource( const wxString& name )
6255fac9
VZ
135{
136 // Bitmap retrieval
603f702b 137////@begin wxRichTextObjectPropertiesDialog bitmap retrieval
6255fac9
VZ
138 wxUnusedVar(name);
139 return wxNullBitmap;
603f702b 140////@end wxRichTextObjectPropertiesDialog bitmap retrieval
6255fac9
VZ
141}
142
143/*!
144 * Get icon resources
145 */
146
603f702b 147wxIcon wxRichTextObjectPropertiesDialog::GetIconResource( const wxString& name )
6255fac9
VZ
148{
149 // Icon retrieval
603f702b 150////@begin wxRichTextObjectPropertiesDialog icon retrieval
6255fac9
VZ
151 wxUnusedVar(name);
152 return wxNullIcon;
603f702b 153////@end wxRichTextObjectPropertiesDialog icon retrieval
6255fac9
VZ
154}
155
603f702b 156#if 0
6255fac9
VZ
157/*!
158 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON_PARA_UP
159 */
603f702b 160void wxRichTextObjectPropertiesDialog::OnRichtextParaUpClick( wxCommandEvent& WXUNUSED(event))
6255fac9
VZ
161{
162 // Before editing this code, remove the block markers.
603f702b 163 wxRichTextRange range = m_object->GetRange();
6255fac9 164 wxRichTextObjectList::compatibility_iterator iter = m_buffer->GetChildren().GetFirst();
864299f7 165 if (!iter)
6255fac9
VZ
166 return;
167
168 while (iter)
169 {
170 if (iter->GetData() == m_parent)
171 break;
172 iter = iter->GetNext();
173 }
174
175 iter = iter->GetPrevious();
864299f7 176 if (!iter)
6255fac9
VZ
177 return;
178
179 wxRichTextObject *obj = iter->GetData();
180 wxRichTextRange rg = obj->GetRange();
603f702b 181 m_object = m_object->Clone();
6255fac9
VZ
182
183 m_buffer->DeleteRangeWithUndo(range, m_buffer->GetRichTextCtrl());
603f702b 184 m_buffer->InsertObjectWithUndo(rg.GetEnd(), m_object, m_buffer->GetRichTextCtrl(), 0);
6255fac9 185 m_parent = obj;
603f702b 186 m_object->SetRange(wxRichTextRange(rg.GetEnd(), rg.GetEnd()));
6255fac9
VZ
187}
188
189
190/*!
191 * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON_PARA_DOWN
192 */
193
603f702b 194void wxRichTextObjectPropertiesDialog::OnRichtextDownClick( wxCommandEvent& WXUNUSED(event))
6255fac9
VZ
195{
196 // Before editing this code, remove the block markers.
603f702b 197 wxRichTextRange range = m_object->GetRange();
6255fac9 198 wxRichTextObjectList::compatibility_iterator iter = m_buffer->GetChildren().GetFirst();
864299f7 199 if (!iter)
6255fac9
VZ
200 return;
201
202 while (iter)
203 {
204 if (iter->GetData() == m_parent)
205 break;
206 iter = iter->GetNext();
207 }
208
209 iter = iter->GetNext();
864299f7 210 if (!iter)
6255fac9
VZ
211 return;
212
213 wxRichTextObject *obj = iter->GetData();
214 wxRichTextRange rg = obj->GetRange();
603f702b 215 m_object = m_object->Clone();
6255fac9
VZ
216
217 m_buffer->DeleteRangeWithUndo(range, m_buffer->GetRichTextCtrl());
603f702b 218 m_buffer->InsertObjectWithUndo(rg.GetEnd(), m_object, m_buffer->GetRichTextCtrl(), 0);
6255fac9 219 m_parent = obj;
603f702b 220 m_object->SetRange(wxRichTextRange(rg.GetEnd(), rg.GetEnd()));
6255fac9
VZ
221}
222
0ef18b97 223#endif
603f702b
JS
224
225#endif
226 // wxUSE_RICHTEXT