]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/private.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: Private declarations for wxMotif port
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #ifndef _WX_PRIVATE_H_
13 #define _WX_PRIVATE_H_
18 #include "wx/x11/privx.h"
20 // Put any private declarations here: native Motif types may be used because
21 // this header is included after Xm/Xm.h
23 // ----------------------------------------------------------------------------
25 // ----------------------------------------------------------------------------
27 #define wxCHECK_MOTIF_VERSION( major, minor ) \
28 ( XmVersion >= (major) * 1000 + (minor) )
30 #define wxCHECK_LESSTIF_VERSION( major, minor ) \
31 ( LesstifVersion >= (major) * 1000 + (minor) )
33 #define wxCHECK_LESSTIF() ( defined(LesstifVersion) && LesstifVersion > 0 )
35 // ----------------------------------------------------------------------------
37 // ----------------------------------------------------------------------------
39 // All widgets should have this as their resize proc.
40 extern void wxWidgetResizeProc(Widget w
, XConfigureEvent
*event
,
41 String args
[], int *num_args
);
43 // For repainting arbitrary windows
44 void wxUniversalRepaintProc(Widget w
, XtPointer
WXUNUSED(c_data
),
45 XEvent
*event
, char *);
47 // ----------------------------------------------------------------------------
48 // we maintain a hash table which contains the mapping from Widget to wxWindow
49 // corresponding to the window for this widget
50 // ----------------------------------------------------------------------------
52 extern void wxDeleteWindowFromTable(Widget w
);
53 extern wxWindow
*wxGetWindowFromTable(Widget w
);
54 extern bool wxAddWindowToTable(Widget w
, wxWindow
*win
);
56 // ----------------------------------------------------------------------------
57 // key events related functions
58 // ----------------------------------------------------------------------------
60 extern char wxFindMnemonic(const char* s
);
62 extern char * wxFindAccelerator (const char *s
);
63 extern XmString
wxFindAcceleratorText (const char *s
);
65 // ----------------------------------------------------------------------------
66 // TranslateXXXEvent() functions - translate Motif event to wxWindow one
67 // ----------------------------------------------------------------------------
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
);
74 extern void wxDoChangeForegroundColour(WXWidget widget
,
75 wxColour
& foregroundColour
);
76 extern void wxDoChangeBackgroundColour(WXWidget widget
,
77 wxColour
& backgroundColour
,
78 bool changeArmColour
= FALSE
);
79 extern void wxDoChangeFont(WXWidget widget
, wxFont
& font
);
81 #define wxNO_COLORS 0x00
82 #define wxBACK_COLORS 0x01
83 #define wxFORE_COLORS 0x02
85 extern XColor itemColors
[5] ;
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
93 // ----------------------------------------------------------------------------
95 // ----------------------------------------------------------------------------
97 wxString
wxXmStringToString( const XmString
& xmString
);
98 XmString
wxStringToXmString( const wxString
& string
);
99 XmString
wxStringToXmString( const char* string
);
101 // XmString made easy to use in wxWindows (and has an added benefit of
102 // cleaning up automatically)
106 wxXmString(const char* str
)
108 m_string
= XmStringCreateLtoR((char *)str
, XmSTRING_DEFAULT_CHARSET
);
111 wxXmString(const wxString
& str
)
113 m_string
= XmStringCreateLtoR((char *)str
.c_str(),
114 XmSTRING_DEFAULT_CHARSET
);
117 // just to avoid calling XmStringFree()
118 wxXmString(const XmString
& string
) { m_string
= string
; }
120 ~wxXmString() { XmStringFree(m_string
); }
122 // semi-implicit conversion to XmString (shouldn't rely on implicit
123 // conversion because many of Motif functions are macros)
124 XmString
operator()() const { return m_string
; }
130 // ----------------------------------------------------------------------------
131 // Routines used in both wxTextCtrl/wxListBox and nativa wxComboBox
132 // (defined in src/motif/listbox.cpp or src/motif/textctrl.cpp
133 // ----------------------------------------------------------------------------
135 int wxDoFindStringInList( Widget listWidget
, const wxString
& str
);
136 int wxDoGetSelectionInList( Widget listWidget
);
137 wxString
wxDoGetStringInList( Widget listWidget
, int n
);
138 wxSize
wxDoGetListBoxBestSize( Widget listWidget
, const wxWindow
* window
);
140 wxSize
wxDoGetSingleTextCtrlBestSize( Widget textWidget
,
141 const wxWindow
* window
);
143 // ----------------------------------------------------------------------------
144 // executes one main loop iteration (implemented in src/motif/evtloop.cpp)
145 // ----------------------------------------------------------------------------
149 // returns true if the loop should be exited
150 bool wxDoEventLoopIteration( wxEventLoop
& evtLoop
);
152 // ----------------------------------------------------------------------------
153 // macros to avoid casting WXFOO to Foo all the time
154 // ----------------------------------------------------------------------------
156 // argument is of type "wxWindow *"
157 #define GetWidget(w) ((Widget)(w)->GetHandle())
159 // ----------------------------------------------------------------------------
160 // accessors for C modules
161 // ----------------------------------------------------------------------------
163 extern "C" XtAppContext
wxGetAppContext();