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