]>
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 // All widgets should have this as their resize proc.
28 extern void wxWidgetResizeProc(Widget w
, XConfigureEvent
*event
,
29 String args
[], int *num_args
);
31 // For repainting arbitrary windows
32 void wxUniversalRepaintProc(Widget w
, XtPointer
WXUNUSED(c_data
),
33 XEvent
*event
, char *);
35 // ----------------------------------------------------------------------------
36 // we maintain a hash table which contains the mapping from Widget to wxWindow
37 // corresponding to the window for this widget
38 // ----------------------------------------------------------------------------
40 extern void wxDeleteWindowFromTable(Widget w
);
41 extern wxWindow
*wxGetWindowFromTable(Widget w
);
42 extern bool wxAddWindowToTable(Widget w
, wxWindow
*win
);
44 // ----------------------------------------------------------------------------
45 // key events related functions
46 // ----------------------------------------------------------------------------
48 extern char wxFindMnemonic(const char* s
);
50 extern char * wxFindAccelerator (const char *s
);
51 extern XmString
wxFindAcceleratorText (const char *s
);
53 // ----------------------------------------------------------------------------
54 // TranslateXXXEvent() functions - translate Motif event to wxWindow one
55 // ----------------------------------------------------------------------------
57 extern bool wxTranslateMouseEvent(wxMouseEvent
& wxevent
, wxWindow
*win
,
58 Widget widget
, XEvent
*xevent
);
59 extern bool wxTranslateKeyEvent(wxKeyEvent
& wxevent
, wxWindow
*win
,
60 Widget widget
, XEvent
*xevent
);
62 extern void wxDoChangeForegroundColour(WXWidget widget
,
63 wxColour
& foregroundColour
);
64 extern void wxDoChangeBackgroundColour(WXWidget widget
,
65 wxColour
& backgroundColour
,
66 bool changeArmColour
= FALSE
);
67 extern void wxDoChangeFont(WXWidget widget
, wxFont
& font
);
69 #define wxNO_COLORS 0x00
70 #define wxBACK_COLORS 0x01
71 #define wxFORE_COLORS 0x02
73 extern XColor itemColors
[5] ;
75 #define wxBACK_INDEX 0
76 #define wxFORE_INDEX 1
77 #define wxSELE_INDEX 2
78 #define wxTOPS_INDEX 3
79 #define wxBOTS_INDEX 4
81 // ----------------------------------------------------------------------------
83 // ----------------------------------------------------------------------------
85 // XmString made easy to use in wxWindows (and has an added benefit of
86 // cleaning up automatically)
90 wxXmString(const char* str
)
92 m_string
= XmStringCreateLtoR((char *)str
, XmSTRING_DEFAULT_CHARSET
);
95 wxXmString(const wxString
& str
)
97 m_string
= XmStringCreateLtoR((char *)str
.c_str(),
98 XmSTRING_DEFAULT_CHARSET
);
101 ~wxXmString() { XmStringFree(m_string
); }
103 // semi-implicit conversion to XmString (shouldn't rely on implicit
104 // conversion because many of Motif functions are macros)
105 XmString
operator()() const { return m_string
; }
111 wxString
wxXmStringToString( const XmString
& xmString
);
113 // ----------------------------------------------------------------------------
114 // Routines used in both wxTextCtrl/wxListBox and nativa wxComboBox
115 // (defined in src/motif/listbox.cpp or src/motif/textctrl.cpp
116 // ----------------------------------------------------------------------------
118 int wxDoFindStringInList( Widget listWidget
, const wxString
& str
);
119 int wxDoGetSelectionInList( Widget listWidget
);
120 wxString
wxDoGetStringInList( Widget listWidget
, int n
);
121 wxSize
wxDoGetListBoxBestSize( Widget listWidget
, const wxWindow
* window
);
123 wxSize
wxDoGetSingleTextCtrlBestSize( Widget textWidget
,
124 const wxWindow
* window
);
126 // ----------------------------------------------------------------------------
127 // executes one main loop iteration (implemented in src/motif/evtloop.cpp)
128 // ----------------------------------------------------------------------------
132 // returns true if the loop should be exited
133 bool wxDoEventLoopIteration( wxEventLoop
& evtLoop
);
135 // ----------------------------------------------------------------------------
136 // macros to avoid casting WXFOO to Foo all the time
137 // ----------------------------------------------------------------------------
139 // argument is of type "wxWindow *"
140 #define GetWidget(w) ((Widget)(w)->GetHandle())
142 // ----------------------------------------------------------------------------
143 // accessors for C modules
144 // ----------------------------------------------------------------------------
146 extern "C" XtAppContext
wxGetAppContext();