]>
Commit | Line | Data |
---|---|---|
9b6dbb09 JS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: private.h | |
34636400 | 3 | // Purpose: Private declarations for wxMotif port |
9b6dbb09 JS |
4 | // Author: Julian Smart |
5 | // Modified by: | |
6 | // Created: 17/09/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart | |
65571936 | 9 | // Licence: wxWindows licence |
9b6dbb09 JS |
10 | ///////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | #ifndef _WX_PRIVATE_H_ | |
13 | #define _WX_PRIVATE_H_ | |
14 | ||
15 | #include "wx/defs.h" | |
7266b672 | 16 | #include "X11/Xlib.h" |
9b6dbb09 | 17 | |
d8d18184 MB |
18 | class WXDLLEXPORT wxFont; |
19 | class WXDLLEXPORT wxWindow; | |
20 | class WXDLLEXPORT wxSize; | |
aae0472b MB |
21 | class WXDLLEXPORT wxBitmap; |
22 | class WXDLLEXPORT wxColour; | |
d8d18184 | 23 | |
3a0b23eb | 24 | #include "wx/x11/privx.h" |
dfc54541 | 25 | |
34636400 VZ |
26 | // Put any private declarations here: native Motif types may be used because |
27 | // this header is included after Xm/Xm.h | |
9b6dbb09 | 28 | |
483561c5 MB |
29 | // ---------------------------------------------------------------------------- |
30 | // convenience macros | |
31 | // ---------------------------------------------------------------------------- | |
32 | ||
33 | #define wxCHECK_MOTIF_VERSION( major, minor ) \ | |
34 | ( XmVersion >= (major) * 1000 + (minor) ) | |
35 | ||
36 | #define wxCHECK_LESSTIF_VERSION( major, minor ) \ | |
37 | ( LesstifVersion >= (major) * 1000 + (minor) ) | |
38 | ||
996994c7 | 39 | #define wxCHECK_LESSTIF() ( __WXLESSTIF__ ) |
483561c5 | 40 | |
6769d0cb MB |
41 | // ---------------------------------------------------------------------------- |
42 | // Miscellaneous functions | |
43 | // ---------------------------------------------------------------------------- | |
44 | ||
45 | WXWidget wxCreateBorderWidget( WXWidget parent, long style ); | |
46 | ||
34636400 VZ |
47 | // ---------------------------------------------------------------------------- |
48 | // common callbacks | |
49 | // ---------------------------------------------------------------------------- | |
50 | ||
51 | // All widgets should have this as their resize proc. | |
7e1bcfa8 MB |
52 | extern void wxWidgetResizeProc(Widget w, XConfigureEvent *event, |
53 | String args[], int *num_args); | |
9b6dbb09 | 54 | |
34636400 | 55 | // For repainting arbitrary windows |
7e1bcfa8 MB |
56 | void wxUniversalRepaintProc(Widget w, XtPointer WXUNUSED(c_data), |
57 | XEvent *event, char *); | |
34636400 VZ |
58 | |
59 | // ---------------------------------------------------------------------------- | |
60 | // we maintain a hash table which contains the mapping from Widget to wxWindow | |
61 | // corresponding to the window for this widget | |
62 | // ---------------------------------------------------------------------------- | |
63 | ||
9b6dbb09 JS |
64 | extern void wxDeleteWindowFromTable(Widget w); |
65 | extern wxWindow *wxGetWindowFromTable(Widget w); | |
66 | extern bool wxAddWindowToTable(Widget w, wxWindow *win); | |
34636400 | 67 | |
aae0472b MB |
68 | // ---------------------------------------------------------------------------- |
69 | // wxBitmap related functions | |
70 | // ---------------------------------------------------------------------------- | |
71 | ||
72 | // Creates a bitmap with transparent areas drawn in the given colour. | |
73 | wxBitmap wxCreateMaskedBitmap(const wxBitmap& bitmap, wxColour& colour); | |
74 | ||
31528cd3 VZ |
75 | // ---------------------------------------------------------------------------- |
76 | // key events related functions | |
77 | // ---------------------------------------------------------------------------- | |
78 | ||
50414e24 | 79 | extern char wxFindMnemonic(const char* s); |
31528cd3 VZ |
80 | |
81 | extern char * wxFindAccelerator (const char *s); | |
82 | extern XmString wxFindAcceleratorText (const char *s); | |
83 | ||
34636400 VZ |
84 | // ---------------------------------------------------------------------------- |
85 | // TranslateXXXEvent() functions - translate Motif event to wxWindow one | |
86 | // ---------------------------------------------------------------------------- | |
34636400 | 87 | |
7e1bcfa8 | 88 | extern bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win, |
2a23a89d | 89 | Widget widget, const XEvent *xevent); |
7e1bcfa8 | 90 | extern bool wxTranslateKeyEvent(wxKeyEvent& wxevent, wxWindow *win, |
2a23a89d | 91 | Widget widget, const XEvent *xevent); |
7e1bcfa8 MB |
92 | |
93 | extern void wxDoChangeForegroundColour(WXWidget widget, | |
94 | wxColour& foregroundColour); | |
95 | extern void wxDoChangeBackgroundColour(WXWidget widget, | |
96 | wxColour& backgroundColour, | |
96be256b | 97 | bool changeArmColour = false); |
e1aae528 | 98 | extern void wxDoChangeFont(WXWidget widget, wxFont& font); |
996994c7 MB |
99 | extern void wxGetTextExtent(WXDisplay* display, const wxFont& font, |
100 | double scale, | |
101 | const wxString& string, int* width, int* height, | |
102 | int* ascent, int* descent); | |
94b49b93 | 103 | |
34636400 | 104 | #define wxNO_COLORS 0x00 |
02e8b2f9 JS |
105 | #define wxBACK_COLORS 0x01 |
106 | #define wxFORE_COLORS 0x02 | |
107 | ||
108 | extern XColor itemColors[5] ; | |
109 | ||
110 | #define wxBACK_INDEX 0 | |
111 | #define wxFORE_INDEX 1 | |
112 | #define wxSELE_INDEX 2 | |
113 | #define wxTOPS_INDEX 3 | |
114 | #define wxBOTS_INDEX 4 | |
9b6dbb09 | 115 | |
ee31c392 | 116 | // ---------------------------------------------------------------------------- |
aae0472b | 117 | // XmString/wxString conversion utilities |
ee31c392 VZ |
118 | // ---------------------------------------------------------------------------- |
119 | ||
3e2d47e1 MB |
120 | wxString wxXmStringToString( const XmString& xmString ); |
121 | XmString wxStringToXmString( const wxString& string ); | |
122 | XmString wxStringToXmString( const char* string ); | |
123 | ||
77ffb593 | 124 | // XmString made easy to use in wxWidgets (and has an added benefit of |
ee31c392 VZ |
125 | // cleaning up automatically) |
126 | class wxXmString | |
127 | { | |
128 | public: | |
7e1bcfa8 MB |
129 | wxXmString(const char* str) |
130 | { | |
131 | m_string = XmStringCreateLtoR((char *)str, XmSTRING_DEFAULT_CHARSET); | |
132 | } | |
133 | ||
ee31c392 VZ |
134 | wxXmString(const wxString& str) |
135 | { | |
136 | m_string = XmStringCreateLtoR((char *)str.c_str(), | |
83df96d6 | 137 | XmSTRING_DEFAULT_CHARSET); |
ee31c392 | 138 | } |
da494b40 MB |
139 | |
140 | // just to avoid calling XmStringFree() | |
141 | wxXmString(const XmString& string) { m_string = string; } | |
142 | ||
ee31c392 | 143 | ~wxXmString() { XmStringFree(m_string); } |
83df96d6 | 144 | |
ee31c392 VZ |
145 | // semi-implicit conversion to XmString (shouldn't rely on implicit |
146 | // conversion because many of Motif functions are macros) | |
147 | XmString operator()() const { return m_string; } | |
83df96d6 | 148 | |
ee31c392 VZ |
149 | private: |
150 | XmString m_string; | |
151 | }; | |
152 | ||
9b1bd0c6 MB |
153 | // ---------------------------------------------------------------------------- |
154 | // Routines used in both wxTextCtrl/wxListBox and nativa wxComboBox | |
155 | // (defined in src/motif/listbox.cpp or src/motif/textctrl.cpp | |
156 | // ---------------------------------------------------------------------------- | |
157 | ||
158 | int wxDoFindStringInList( Widget listWidget, const wxString& str ); | |
e1aae528 MB |
159 | int wxDoGetSelectionInList( Widget listWidget ); |
160 | wxString wxDoGetStringInList( Widget listWidget, int n ); | |
161 | wxSize wxDoGetListBoxBestSize( Widget listWidget, const wxWindow* window ); | |
162 | ||
163 | wxSize wxDoGetSingleTextCtrlBestSize( Widget textWidget, | |
164 | const wxWindow* window ); | |
9b1bd0c6 | 165 | |
7e1bcfa8 | 166 | // ---------------------------------------------------------------------------- |
eb6fa4b4 | 167 | // event-related functions |
7e1bcfa8 MB |
168 | // ---------------------------------------------------------------------------- |
169 | ||
170 | class wxEventLoop; | |
171 | ||
eb6fa4b4 | 172 | // executes one main loop iteration (implemented in src/motif/evtloop.cpp) |
7e1bcfa8 MB |
173 | // returns true if the loop should be exited |
174 | bool wxDoEventLoopIteration( wxEventLoop& evtLoop ); | |
175 | ||
eb6fa4b4 MB |
176 | // Consume all events until no more left |
177 | void wxFlushEvents(WXDisplay* display); | |
178 | ||
ee31c392 VZ |
179 | // ---------------------------------------------------------------------------- |
180 | // macros to avoid casting WXFOO to Foo all the time | |
181 | // ---------------------------------------------------------------------------- | |
182 | ||
183 | // argument is of type "wxWindow *" | |
184 | #define GetWidget(w) ((Widget)(w)->GetHandle()) | |
185 | ||
d391a345 VZ |
186 | // ---------------------------------------------------------------------------- |
187 | // accessors for C modules | |
188 | // ---------------------------------------------------------------------------- | |
189 | ||
190 | extern "C" XtAppContext wxGetAppContext(); | |
191 | ||
9b6dbb09 | 192 | #endif |
83df96d6 | 193 | // _WX_PRIVATE_H_ |