]>
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 | |
34636400 | 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 | ||
39 | #define wxCHECK_LESSTIF() ( defined(LesstifVersion) && LesstifVersion > 0 ) | |
40 | ||
34636400 VZ |
41 | // ---------------------------------------------------------------------------- |
42 | // common callbacks | |
43 | // ---------------------------------------------------------------------------- | |
44 | ||
45 | // All widgets should have this as their resize proc. | |
7e1bcfa8 MB |
46 | extern void wxWidgetResizeProc(Widget w, XConfigureEvent *event, |
47 | String args[], int *num_args); | |
9b6dbb09 | 48 | |
34636400 | 49 | // For repainting arbitrary windows |
7e1bcfa8 MB |
50 | void wxUniversalRepaintProc(Widget w, XtPointer WXUNUSED(c_data), |
51 | XEvent *event, char *); | |
34636400 VZ |
52 | |
53 | // ---------------------------------------------------------------------------- | |
54 | // we maintain a hash table which contains the mapping from Widget to wxWindow | |
55 | // corresponding to the window for this widget | |
56 | // ---------------------------------------------------------------------------- | |
57 | ||
9b6dbb09 JS |
58 | extern void wxDeleteWindowFromTable(Widget w); |
59 | extern wxWindow *wxGetWindowFromTable(Widget w); | |
60 | extern bool wxAddWindowToTable(Widget w, wxWindow *win); | |
34636400 | 61 | |
aae0472b MB |
62 | // ---------------------------------------------------------------------------- |
63 | // wxBitmap related functions | |
64 | // ---------------------------------------------------------------------------- | |
65 | ||
66 | // Creates a bitmap with transparent areas drawn in the given colour. | |
67 | wxBitmap wxCreateMaskedBitmap(const wxBitmap& bitmap, wxColour& colour); | |
68 | ||
31528cd3 VZ |
69 | // ---------------------------------------------------------------------------- |
70 | // key events related functions | |
71 | // ---------------------------------------------------------------------------- | |
72 | ||
50414e24 | 73 | extern char wxFindMnemonic(const char* s); |
31528cd3 VZ |
74 | |
75 | extern char * wxFindAccelerator (const char *s); | |
76 | extern XmString wxFindAcceleratorText (const char *s); | |
77 | ||
34636400 VZ |
78 | // ---------------------------------------------------------------------------- |
79 | // TranslateXXXEvent() functions - translate Motif event to wxWindow one | |
80 | // ---------------------------------------------------------------------------- | |
34636400 | 81 | |
7e1bcfa8 MB |
82 | extern bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win, |
83 | Widget widget, XEvent *xevent); | |
84 | extern bool wxTranslateKeyEvent(wxKeyEvent& wxevent, wxWindow *win, | |
85 | Widget widget, XEvent *xevent); | |
86 | ||
87 | extern void wxDoChangeForegroundColour(WXWidget widget, | |
88 | wxColour& foregroundColour); | |
89 | extern void wxDoChangeBackgroundColour(WXWidget widget, | |
90 | wxColour& backgroundColour, | |
91 | bool changeArmColour = FALSE); | |
e1aae528 | 92 | extern void wxDoChangeFont(WXWidget widget, wxFont& font); |
94b49b93 | 93 | |
34636400 | 94 | #define wxNO_COLORS 0x00 |
02e8b2f9 JS |
95 | #define wxBACK_COLORS 0x01 |
96 | #define wxFORE_COLORS 0x02 | |
97 | ||
98 | extern XColor itemColors[5] ; | |
99 | ||
100 | #define wxBACK_INDEX 0 | |
101 | #define wxFORE_INDEX 1 | |
102 | #define wxSELE_INDEX 2 | |
103 | #define wxTOPS_INDEX 3 | |
104 | #define wxBOTS_INDEX 4 | |
9b6dbb09 | 105 | |
ee31c392 | 106 | // ---------------------------------------------------------------------------- |
aae0472b | 107 | // XmString/wxString conversion utilities |
ee31c392 VZ |
108 | // ---------------------------------------------------------------------------- |
109 | ||
3e2d47e1 MB |
110 | wxString wxXmStringToString( const XmString& xmString ); |
111 | XmString wxStringToXmString( const wxString& string ); | |
112 | XmString wxStringToXmString( const char* string ); | |
113 | ||
ee31c392 VZ |
114 | // XmString made easy to use in wxWindows (and has an added benefit of |
115 | // cleaning up automatically) | |
116 | class wxXmString | |
117 | { | |
118 | public: | |
7e1bcfa8 MB |
119 | wxXmString(const char* str) |
120 | { | |
121 | m_string = XmStringCreateLtoR((char *)str, XmSTRING_DEFAULT_CHARSET); | |
122 | } | |
123 | ||
ee31c392 VZ |
124 | wxXmString(const wxString& str) |
125 | { | |
126 | m_string = XmStringCreateLtoR((char *)str.c_str(), | |
83df96d6 | 127 | XmSTRING_DEFAULT_CHARSET); |
ee31c392 | 128 | } |
da494b40 MB |
129 | |
130 | // just to avoid calling XmStringFree() | |
131 | wxXmString(const XmString& string) { m_string = string; } | |
132 | ||
ee31c392 | 133 | ~wxXmString() { XmStringFree(m_string); } |
83df96d6 | 134 | |
ee31c392 VZ |
135 | // semi-implicit conversion to XmString (shouldn't rely on implicit |
136 | // conversion because many of Motif functions are macros) | |
137 | XmString operator()() const { return m_string; } | |
83df96d6 | 138 | |
ee31c392 VZ |
139 | private: |
140 | XmString m_string; | |
141 | }; | |
142 | ||
9b1bd0c6 MB |
143 | // ---------------------------------------------------------------------------- |
144 | // Routines used in both wxTextCtrl/wxListBox and nativa wxComboBox | |
145 | // (defined in src/motif/listbox.cpp or src/motif/textctrl.cpp | |
146 | // ---------------------------------------------------------------------------- | |
147 | ||
148 | int wxDoFindStringInList( Widget listWidget, const wxString& str ); | |
e1aae528 MB |
149 | int wxDoGetSelectionInList( Widget listWidget ); |
150 | wxString wxDoGetStringInList( Widget listWidget, int n ); | |
151 | wxSize wxDoGetListBoxBestSize( Widget listWidget, const wxWindow* window ); | |
152 | ||
153 | wxSize wxDoGetSingleTextCtrlBestSize( Widget textWidget, | |
154 | const wxWindow* window ); | |
9b1bd0c6 | 155 | |
7e1bcfa8 | 156 | // ---------------------------------------------------------------------------- |
eb6fa4b4 | 157 | // event-related functions |
7e1bcfa8 MB |
158 | // ---------------------------------------------------------------------------- |
159 | ||
160 | class wxEventLoop; | |
161 | ||
eb6fa4b4 | 162 | // executes one main loop iteration (implemented in src/motif/evtloop.cpp) |
7e1bcfa8 MB |
163 | // returns true if the loop should be exited |
164 | bool wxDoEventLoopIteration( wxEventLoop& evtLoop ); | |
165 | ||
eb6fa4b4 MB |
166 | // Consume all events until no more left |
167 | void wxFlushEvents(WXDisplay* display); | |
168 | ||
ee31c392 VZ |
169 | // ---------------------------------------------------------------------------- |
170 | // macros to avoid casting WXFOO to Foo all the time | |
171 | // ---------------------------------------------------------------------------- | |
172 | ||
173 | // argument is of type "wxWindow *" | |
174 | #define GetWidget(w) ((Widget)(w)->GetHandle()) | |
175 | ||
d391a345 VZ |
176 | // ---------------------------------------------------------------------------- |
177 | // accessors for C modules | |
178 | // ---------------------------------------------------------------------------- | |
179 | ||
180 | extern "C" XtAppContext wxGetAppContext(); | |
181 | ||
9b6dbb09 | 182 | #endif |
83df96d6 | 183 | // _WX_PRIVATE_H_ |