]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: private.h | |
3 | // Purpose: Private declarations for wxMotif port | |
4 | // Author: Julian Smart | |
5 | // Modified by: | |
6 | // Created: 17/09/98 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) Julian Smart | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _WX_PRIVATE_H_ | |
13 | #define _WX_PRIVATE_H_ | |
14 | ||
15 | #include "wx/defs.h" | |
16 | #include "X11/Xlib.h" | |
17 | ||
18 | class WXDLLEXPORT wxFont; | |
19 | class WXDLLEXPORT wxWindow; | |
20 | class WXDLLEXPORT wxSize; | |
21 | ||
22 | #include "wx/x11/privx.h" | |
23 | ||
24 | // Put any private declarations here: native Motif types may be used because | |
25 | // this header is included after Xm/Xm.h | |
26 | ||
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 | ||
39 | // ---------------------------------------------------------------------------- | |
40 | // common callbacks | |
41 | // ---------------------------------------------------------------------------- | |
42 | ||
43 | // All widgets should have this as their resize proc. | |
44 | extern void wxWidgetResizeProc(Widget w, XConfigureEvent *event, | |
45 | String args[], int *num_args); | |
46 | ||
47 | // For repainting arbitrary windows | |
48 | void wxUniversalRepaintProc(Widget w, XtPointer WXUNUSED(c_data), | |
49 | XEvent *event, char *); | |
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 | ||
56 | extern void wxDeleteWindowFromTable(Widget w); | |
57 | extern wxWindow *wxGetWindowFromTable(Widget w); | |
58 | extern bool wxAddWindowToTable(Widget w, wxWindow *win); | |
59 | ||
60 | // ---------------------------------------------------------------------------- | |
61 | // key events related functions | |
62 | // ---------------------------------------------------------------------------- | |
63 | ||
64 | extern char wxFindMnemonic(const char* s); | |
65 | ||
66 | extern char * wxFindAccelerator (const char *s); | |
67 | extern XmString wxFindAcceleratorText (const char *s); | |
68 | ||
69 | // ---------------------------------------------------------------------------- | |
70 | // TranslateXXXEvent() functions - translate Motif event to wxWindow one | |
71 | // ---------------------------------------------------------------------------- | |
72 | ||
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); | |
83 | extern void wxDoChangeFont(WXWidget widget, wxFont& font); | |
84 | ||
85 | #define wxNO_COLORS 0x00 | |
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 | |
96 | ||
97 | // ---------------------------------------------------------------------------- | |
98 | // utility classes | |
99 | // ---------------------------------------------------------------------------- | |
100 | ||
101 | wxString wxXmStringToString( const XmString& xmString ); | |
102 | XmString wxStringToXmString( const wxString& string ); | |
103 | XmString wxStringToXmString( const char* string ); | |
104 | ||
105 | // XmString made easy to use in wxWindows (and has an added benefit of | |
106 | // cleaning up automatically) | |
107 | class wxXmString | |
108 | { | |
109 | public: | |
110 | wxXmString(const char* str) | |
111 | { | |
112 | m_string = XmStringCreateLtoR((char *)str, XmSTRING_DEFAULT_CHARSET); | |
113 | } | |
114 | ||
115 | wxXmString(const wxString& str) | |
116 | { | |
117 | m_string = XmStringCreateLtoR((char *)str.c_str(), | |
118 | XmSTRING_DEFAULT_CHARSET); | |
119 | } | |
120 | ||
121 | // just to avoid calling XmStringFree() | |
122 | wxXmString(const XmString& string) { m_string = string; } | |
123 | ||
124 | ~wxXmString() { XmStringFree(m_string); } | |
125 | ||
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; } | |
129 | ||
130 | private: | |
131 | XmString m_string; | |
132 | }; | |
133 | ||
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 ); | |
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 ); | |
146 | ||
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 | ||
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 | ||
163 | // ---------------------------------------------------------------------------- | |
164 | // accessors for C modules | |
165 | // ---------------------------------------------------------------------------- | |
166 | ||
167 | extern "C" XtAppContext wxGetAppContext(); | |
168 | ||
169 | #endif | |
170 | // _WX_PRIVATE_H_ |