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 ////@begin wxRichTextImageDialog event handler declarations
71 /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTIMAGEDIALOG_PARA_UP
72 void OnRichtextimagedialogParaUpClick( wxCommandEvent
& event
);
74 /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTIMAGEDIALOG_DOWN
75 void OnRichtextimagedialogDownClick( wxCommandEvent
& event
);
77 ////@end wxRichTextImageDialog event handler declarations
79 ////@begin wxRichTextImageDialog member function declarations
81 /// Retrieves bitmap resources
82 wxBitmap
GetBitmapResource( const wxString
& name
);
84 /// Retrieves icon resources
85 wxIcon
GetIconResource( const wxString
& name
);
86 ////@end wxRichTextImageDialog member function declarations
88 /// Should we show tooltips?
89 static bool ShowToolTips();
91 /// Set the image attribute
92 void SetImageAttr(const wxRichTextAnchoredObjectAttr
& attr
);
93 wxRichTextImage
* ApplyImageAttr();
95 /// Set the anchored object
96 void SetImageObject(wxRichTextImage
*image
, wxRichTextBuffer
* buffer
);
98 virtual bool TransferDataFromWindow();
99 virtual bool TransferDataToWindow();
102 bool ConvertFromString(const wxString
& string
, int& ret
, int scale
);
104 wxRichTextAnchoredObjectAttr m_attr
;
105 ////@begin wxRichTextImageDialog member variables
106 wxComboBox
* m_alignment
;
109 wxComboBox
* m_unitsW
;
110 wxTextCtrl
* m_height
;
111 wxComboBox
* m_unitsH
;
112 wxTextCtrl
* m_offset
;
113 wxComboBox
* m_unitsOffset
;
114 wxButton
* m_saveButton
;
115 wxButton
* m_cancelButton
;
116 /// Control identifiers
118 ID_WXRICHTEXTIMAGEPAGE
= 10015,
119 ID_COMBOBOX_ALIGN
= 10016,
120 ID_RICHTEXTIMAGEDIALOG_FLOATING_MODE
= 10017,
121 ID_RICHTEXTIMAGEDIALOG_WIDTH
= 10018,
122 ID_RICHTEXTIMAGEDIALOG_UNITS_W
= 10019,
123 ID_RICHTEXTIMAGEDIALOG_HEIGHT
= 10020,
124 ID_RICHTEXTIMAGEDIALOG_UNITS_H
= 10021,
125 ID_RICHTEXTIMAGEDIALOG_OFFSET
= 10022,
126 ID_RICHTEXTIMAGEDIALOG_OFFSET_UNITS
= 10023,
127 ID_RICHTEXTIMAGEDIALOG_PARA_UP
= 10024,
128 ID_RICHTEXTIMAGEDIALOG_DOWN
= 10025
130 ////@end wxRichTextImageDialog member variables
132 wxRichTextBuffer
* m_buffer
;
133 wxRichTextObject
* m_image
;
134 wxRichTextObject
* m_parent
;
138 // _RICHTEXTIMAGEDLG_H_