1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/richtext/richtextimagedlg.h
4 // Author: Mingquan Yang
6 // Created: Wed 02 Jun 2010 11:27:23 CST
8 // Copyright: (c) Mingquan Yang
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #include "wx/dialog.h"
14 #ifndef _RICHTEXTIMAGEDLG_H_
15 #define _RICHTEXTIMAGEDLG_H_
20 #include "wx/richtext/richtextbuffer.h"
23 * Forward declarations
26 class WXDLLIMPEXP_FWD_CORE wxButton
;
27 class WXDLLIMPEXP_FWD_CORE wxComboBox
;
28 class WXDLLIMPEXP_FWD_CORE wxTextCtrl
;
34 ////@begin control identifiers
35 #define SYMBOL_WXRICHTEXTIMAGEDIALOG_STYLE wxDEFAULT_DIALOG_STYLE|wxTAB_TRAVERSAL
36 #define SYMBOL_WXRICHTEXTIMAGEDIALOG_TITLE _("Image Properties")
37 #define SYMBOL_WXRICHTEXTIMAGEDIALOG_IDNAME ID_WXRICHTEXTIMAGEPAGE
38 #define SYMBOL_WXRICHTEXTIMAGEDIALOG_SIZE wxSize(400, 300)
39 #define SYMBOL_WXRICHTEXTIMAGEDIALOG_POSITION wxDefaultPosition
40 ////@end control identifiers
44 * wxRichTextImageDialog class declaration
47 class WXDLLIMPEXP_RICHTEXT wxRichTextImageDialog
: public wxDialog
49 DECLARE_DYNAMIC_CLASS( wxRichTextImageDialog
)
54 wxRichTextImageDialog();
55 wxRichTextImageDialog( wxWindow
* parent
, wxWindowID id
= SYMBOL_WXRICHTEXTIMAGEDIALOG_IDNAME
, const wxString
& caption
= SYMBOL_WXRICHTEXTIMAGEDIALOG_TITLE
, const wxPoint
& pos
= SYMBOL_WXRICHTEXTIMAGEDIALOG_POSITION
, const wxSize
& size
= SYMBOL_WXRICHTEXTIMAGEDIALOG_SIZE
, long style
= SYMBOL_WXRICHTEXTIMAGEDIALOG_STYLE
);
58 bool Create( wxWindow
* parent
, wxWindowID id
= SYMBOL_WXRICHTEXTIMAGEDIALOG_IDNAME
, const wxString
& caption
= SYMBOL_WXRICHTEXTIMAGEDIALOG_TITLE
, const wxPoint
& pos
= SYMBOL_WXRICHTEXTIMAGEDIALOG_POSITION
, const wxSize
& size
= SYMBOL_WXRICHTEXTIMAGEDIALOG_SIZE
, long style
= SYMBOL_WXRICHTEXTIMAGEDIALOG_STYLE
);
61 ~wxRichTextImageDialog();
63 /// Initialises member variables
66 /// Creates the controls and sizers
67 void CreateControls();
69 /// Set the dimension into the value and units controls
70 void SetDimensionValue(wxTextAttrDimension
& dim
, wxTextCtrl
* valueCtrl
, wxComboBox
* unitsCtrl
);
72 /// Get the dimension from the value and units controls
73 void GetDimensionValue(wxTextAttrDimension
& dim
, wxTextCtrl
* valueCtrl
, wxComboBox
* unitsCtrl
);
75 ////@begin wxRichTextImageDialog event handler declarations
77 /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTIMAGEDIALOG_PARA_UP
78 void OnRichtextimagedialogParaUpClick( wxCommandEvent
& event
);
80 /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTIMAGEDIALOG_DOWN
81 void OnRichtextimagedialogDownClick( wxCommandEvent
& event
);
83 ////@end wxRichTextImageDialog event handler declarations
85 ////@begin wxRichTextImageDialog member function declarations
87 /// Retrieves bitmap resources
88 wxBitmap
GetBitmapResource( const wxString
& name
);
90 /// Retrieves icon resources
91 wxIcon
GetIconResource( const wxString
& name
);
92 ////@end wxRichTextImageDialog member function declarations
94 /// Should we show tooltips?
95 static bool ShowToolTips();
97 /// Set the image attribute
98 void SetImageAttr(const wxRichTextAttr
& textAttr
);
99 wxRichTextImage
* ApplyImageAttr();
101 /// Set the anchored object
102 void SetImageObject(wxRichTextImage
*image
, wxRichTextBuffer
* buffer
);
104 virtual bool TransferDataFromWindow();
105 virtual bool TransferDataToWindow();
108 bool ConvertFromString(const wxString
& string
, int& ret
, int scale
);
110 wxRichTextAttr m_textAttr
;
112 ////@begin wxRichTextImageDialog member variables
115 wxComboBox
* m_unitsW
;
116 wxTextCtrl
* m_height
;
117 wxComboBox
* m_unitsH
;
118 wxTextCtrl
* m_offset
;
119 wxComboBox
* m_unitsOffset
;
120 wxButton
* m_saveButton
;
121 wxButton
* m_cancelButton
;
122 /// Control identifiers
124 ID_WXRICHTEXTIMAGEPAGE
= 10015,
125 ID_RICHTEXTIMAGEDIALOG_FLOATING_MODE
= 10017,
126 ID_RICHTEXTIMAGEDIALOG_WIDTH
= 10018,
127 ID_RICHTEXTIMAGEDIALOG_UNITS_W
= 10019,
128 ID_RICHTEXTIMAGEDIALOG_HEIGHT
= 10020,
129 ID_RICHTEXTIMAGEDIALOG_UNITS_H
= 10021,
130 ID_RICHTEXTIMAGEDIALOG_OFFSET
= 10022,
131 ID_RICHTEXTIMAGEDIALOG_OFFSET_UNITS
= 10023,
132 ID_RICHTEXTIMAGEDIALOG_PARA_UP
= 10024,
133 ID_RICHTEXTIMAGEDIALOG_DOWN
= 10025
135 ////@end wxRichTextImageDialog member variables
137 wxRichTextBuffer
* m_buffer
;
138 wxRichTextObject
* m_image
;
139 wxRichTextObject
* m_parent
;
143 // _RICHTEXTIMAGEDLG_H_