]>
Commit | Line | Data |
---|---|---|
6255fac9 VZ |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/richtext/richtextimagedlg.h | |
ce00f59b | 3 | // Purpose: |
6255fac9 | 4 | // Author: Mingquan Yang |
ce00f59b | 5 | // Modified by: |
6255fac9 | 6 | // Created: Wed 02 Jun 2010 11:27:23 CST |
ce00f59b | 7 | // RCS-ID: |
6255fac9 VZ |
8 | // Copyright: (c) Mingquan Yang |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #include "wx/dialog.h" | |
13 | ||
14 | #ifndef _RICHTEXTIMAGEDLG_H_ | |
15 | #define _RICHTEXTIMAGEDLG_H_ | |
16 | ||
17 | /*! | |
18 | * Includes | |
19 | */ | |
20 | #include "wx/richtext/richtextbuffer.h" | |
21 | ||
22 | /*! | |
23 | * Forward declarations | |
24 | */ | |
25 | ||
26 | class WXDLLIMPEXP_FWD_CORE wxButton; | |
27 | class WXDLLIMPEXP_FWD_CORE wxComboBox; | |
28 | class WXDLLIMPEXP_FWD_CORE wxTextCtrl; | |
29 | ||
30 | /*! | |
31 | * Control identifiers | |
32 | */ | |
33 | ||
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 | |
41 | ||
42 | ||
43 | /*! | |
44 | * wxRichTextImageDialog class declaration | |
45 | */ | |
46 | ||
47 | class WXDLLIMPEXP_RICHTEXT wxRichTextImageDialog: public wxDialog | |
ce00f59b | 48 | { |
6255fac9 VZ |
49 | DECLARE_DYNAMIC_CLASS( wxRichTextImageDialog ) |
50 | DECLARE_EVENT_TABLE() | |
51 | ||
52 | public: | |
53 | /// Constructors | |
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 ); | |
56 | ||
57 | /// Creation | |
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 ); | |
59 | ||
60 | /// Destructor | |
61 | ~wxRichTextImageDialog(); | |
62 | ||
63 | /// Initialises member variables | |
64 | void Init(); | |
65 | ||
66 | /// Creates the controls and sizers | |
67 | void CreateControls(); | |
68 | ||
24777478 JS |
69 | /// Set the dimension into the value and units controls |
70 | void SetDimensionValue(wxTextAttrDimension& dim, wxTextCtrl* valueCtrl, wxComboBox* unitsCtrl); | |
71 | ||
72 | /// Get the dimension from the value and units controls | |
73 | void GetDimensionValue(wxTextAttrDimension& dim, wxTextCtrl* valueCtrl, wxComboBox* unitsCtrl); | |
74 | ||
6255fac9 VZ |
75 | ////@begin wxRichTextImageDialog event handler declarations |
76 | ||
77 | /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTIMAGEDIALOG_PARA_UP | |
78 | void OnRichtextimagedialogParaUpClick( wxCommandEvent& event ); | |
79 | ||
80 | /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RICHTEXTIMAGEDIALOG_DOWN | |
81 | void OnRichtextimagedialogDownClick( wxCommandEvent& event ); | |
82 | ||
83 | ////@end wxRichTextImageDialog event handler declarations | |
84 | ||
85 | ////@begin wxRichTextImageDialog member function declarations | |
86 | ||
87 | /// Retrieves bitmap resources | |
88 | wxBitmap GetBitmapResource( const wxString& name ); | |
89 | ||
90 | /// Retrieves icon resources | |
91 | wxIcon GetIconResource( const wxString& name ); | |
92 | ////@end wxRichTextImageDialog member function declarations | |
93 | ||
94 | /// Should we show tooltips? | |
95 | static bool ShowToolTips(); | |
96 | ||
97 | /// Set the image attribute | |
24777478 | 98 | void SetImageAttr(const wxRichTextAttr& textAttr); |
6255fac9 VZ |
99 | wxRichTextImage* ApplyImageAttr(); |
100 | ||
101 | /// Set the anchored object | |
102 | void SetImageObject(wxRichTextImage *image, wxRichTextBuffer* buffer); | |
103 | ||
104 | virtual bool TransferDataFromWindow(); | |
105 | virtual bool TransferDataToWindow(); | |
106 | private: | |
107 | /// Convert CM to MM | |
108 | bool ConvertFromString(const wxString& string, int& ret, int scale); | |
109 | private: | |
24777478 JS |
110 | wxRichTextAttr m_textAttr; |
111 | ||
6255fac9 | 112 | ////@begin wxRichTextImageDialog member variables |
6255fac9 VZ |
113 | wxComboBox* m_float; |
114 | wxTextCtrl* m_width; | |
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 | |
123 | enum { | |
124 | ID_WXRICHTEXTIMAGEPAGE = 10015, | |
6255fac9 VZ |
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 | |
134 | }; | |
135 | ////@end wxRichTextImageDialog member variables | |
136 | ||
137 | wxRichTextBuffer* m_buffer; | |
138 | wxRichTextObject* m_image; | |
139 | wxRichTextObject* m_parent; | |
140 | }; | |
141 | ||
142 | #endif | |
143 | // _RICHTEXTIMAGEDLG_H_ |