]> git.saurik.com Git - wxWidgets.git/blame - include/wx/motif/private.h
forward declare wxMenu
[wxWidgets.git] / include / wx / motif / private.h
CommitLineData
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
34636400
VZ
23// ----------------------------------------------------------------------------
24// common callbacks
25// ----------------------------------------------------------------------------
26
27// All widgets should have this as their resize proc.
7e1bcfa8
MB
28extern void wxWidgetResizeProc(Widget w, XConfigureEvent *event,
29 String args[], int *num_args);
9b6dbb09 30
34636400 31// For repainting arbitrary windows
7e1bcfa8
MB
32void wxUniversalRepaintProc(Widget w, XtPointer WXUNUSED(c_data),
33 XEvent *event, char *);
34636400
VZ
34
35// ----------------------------------------------------------------------------
36// we maintain a hash table which contains the mapping from Widget to wxWindow
37// corresponding to the window for this widget
38// ----------------------------------------------------------------------------
39
9b6dbb09
JS
40extern void wxDeleteWindowFromTable(Widget w);
41extern wxWindow *wxGetWindowFromTable(Widget w);
42extern bool wxAddWindowToTable(Widget w, wxWindow *win);
34636400 43
31528cd3
VZ
44// ----------------------------------------------------------------------------
45// key events related functions
46// ----------------------------------------------------------------------------
47
50414e24 48extern char wxFindMnemonic(const char* s);
31528cd3
VZ
49
50extern char * wxFindAccelerator (const char *s);
51extern XmString wxFindAcceleratorText (const char *s);
52
34636400
VZ
53// ----------------------------------------------------------------------------
54// TranslateXXXEvent() functions - translate Motif event to wxWindow one
55// ----------------------------------------------------------------------------
34636400 56
7e1bcfa8
MB
57extern bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win,
58 Widget widget, XEvent *xevent);
59extern bool wxTranslateKeyEvent(wxKeyEvent& wxevent, wxWindow *win,
60 Widget widget, XEvent *xevent);
61
62extern void wxDoChangeForegroundColour(WXWidget widget,
63 wxColour& foregroundColour);
64extern void wxDoChangeBackgroundColour(WXWidget widget,
65 wxColour& backgroundColour,
66 bool changeArmColour = FALSE);
e1aae528 67extern void wxDoChangeFont(WXWidget widget, wxFont& font);
94b49b93 68
34636400 69#define wxNO_COLORS 0x00
02e8b2f9
JS
70#define wxBACK_COLORS 0x01
71#define wxFORE_COLORS 0x02
72
73extern XColor itemColors[5] ;
74
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
9b6dbb09 80
ee31c392
VZ
81// ----------------------------------------------------------------------------
82// utility classes
83// ----------------------------------------------------------------------------
84
85// XmString made easy to use in wxWindows (and has an added benefit of
86// cleaning up automatically)
87class wxXmString
88{
89public:
7e1bcfa8
MB
90 wxXmString(const char* str)
91 {
92 m_string = XmStringCreateLtoR((char *)str, XmSTRING_DEFAULT_CHARSET);
93 }
94
ee31c392
VZ
95 wxXmString(const wxString& str)
96 {
97 m_string = XmStringCreateLtoR((char *)str.c_str(),
83df96d6 98 XmSTRING_DEFAULT_CHARSET);
ee31c392 99 }
83df96d6 100
ee31c392 101 ~wxXmString() { XmStringFree(m_string); }
83df96d6 102
ee31c392
VZ
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; }
83df96d6 106
ee31c392
VZ
107private:
108 XmString m_string;
109};
110
e1aae528
MB
111wxString wxXmStringToString( const XmString& xmString );
112
9b1bd0c6
MB
113// ----------------------------------------------------------------------------
114// Routines used in both wxTextCtrl/wxListBox and nativa wxComboBox
115// (defined in src/motif/listbox.cpp or src/motif/textctrl.cpp
116// ----------------------------------------------------------------------------
117
118int wxDoFindStringInList( Widget listWidget, const wxString& str );
e1aae528
MB
119int wxDoGetSelectionInList( Widget listWidget );
120wxString wxDoGetStringInList( Widget listWidget, int n );
121wxSize wxDoGetListBoxBestSize( Widget listWidget, const wxWindow* window );
122
123wxSize wxDoGetSingleTextCtrlBestSize( Widget textWidget,
124 const wxWindow* window );
9b1bd0c6 125
7e1bcfa8
MB
126// ----------------------------------------------------------------------------
127// executes one main loop iteration (implemented in src/motif/evtloop.cpp)
128// ----------------------------------------------------------------------------
129
130class wxEventLoop;
131
132// returns true if the loop should be exited
133bool wxDoEventLoopIteration( wxEventLoop& evtLoop );
134
ee31c392
VZ
135// ----------------------------------------------------------------------------
136// macros to avoid casting WXFOO to Foo all the time
137// ----------------------------------------------------------------------------
138
139// argument is of type "wxWindow *"
140#define GetWidget(w) ((Widget)(w)->GetHandle())
141
d391a345
VZ
142// ----------------------------------------------------------------------------
143// accessors for C modules
144// ----------------------------------------------------------------------------
145
146extern "C" XtAppContext wxGetAppContext();
147
9b6dbb09 148#endif
83df96d6 149// _WX_PRIVATE_H_