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