]>
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_
21 // Put any private declarations here: native Motif types may be used because
22 // this header is included after Xm/Xm.h
24 // ----------------------------------------------------------------------------
26 // ----------------------------------------------------------------------------
28 // All widgets should have this as their resize proc.
29 extern void wxWidgetResizeProc(Widget w
, XConfigureEvent
*event
, String args
[], int *num_args
);
31 // For repainting arbitrary windows
32 void wxUniversalRepaintProc(Widget w
, XtPointer
WXUNUSED(c_data
), XEvent
*event
, char *);
34 // ----------------------------------------------------------------------------
35 // we maintain a hash table which contains the mapping from Widget to wxWindow
36 // corresponding to the window for this widget
37 // ----------------------------------------------------------------------------
39 extern void wxDeleteWindowFromTable(Widget w
);
40 extern wxWindow
*wxGetWindowFromTable(Widget w
);
41 extern bool wxAddWindowToTable(Widget w
, wxWindow
*win
);
43 // ----------------------------------------------------------------------------
44 // key events related functions
45 // ----------------------------------------------------------------------------
47 extern char wxFindMnemonic(const char* s
);
49 extern char * wxFindAccelerator (const char *s
);
50 extern XmString
wxFindAcceleratorText (const char *s
);
52 extern int wxCharCodeXToWX(KeySym keySym
);
53 extern KeySym
wxCharCodeWXToX(int id
);
55 // ----------------------------------------------------------------------------
56 // TranslateXXXEvent() functions - translate Motif event to wxWindow one
57 // ----------------------------------------------------------------------------
58 extern bool wxTranslateMouseEvent(wxMouseEvent
& wxevent
, wxWindow
*win
, Widget widget
, XEvent
*xevent
);
59 extern bool wxTranslateKeyEvent(wxKeyEvent
& wxevent
, wxWindow
*win
, Widget widget
, XEvent
*xevent
);
61 int wxGetBestMatchingPixel(Display
*display
, XColor
*desiredColor
, Colormap cmap
);
62 Pixmap
XCreateInsensitivePixmap( Display
*display
, Pixmap pixmap
);
64 extern XColor g_itemColors
[];
65 extern int wxComputeColours (Display
*display
, wxColour
* back
, wxColour
* fore
);
67 extern void wxDoChangeForegroundColour(WXWidget widget
, wxColour
& foregroundColour
);
68 extern void wxDoChangeBackgroundColour(WXWidget widget
, wxColour
& backgroundColour
, bool changeArmColour
= FALSE
);
70 #define wxNO_COLORS 0x00
71 #define wxBACK_COLORS 0x01
72 #define wxFORE_COLORS 0x02
74 extern XColor itemColors
[5] ;
76 #define wxBACK_INDEX 0
77 #define wxFORE_INDEX 1
78 #define wxSELE_INDEX 2
79 #define wxTOPS_INDEX 3
80 #define wxBOTS_INDEX 4
82 // ----------------------------------------------------------------------------
84 // ----------------------------------------------------------------------------
86 // XmString made easy to use in wxWindows (and has an added benefit of
87 // cleaning up automatically)
91 wxXmString(const wxString
& str
)
93 m_string
= XmStringCreateLtoR((char *)str
.c_str(),
94 XmSTRING_DEFAULT_CHARSET
);
97 ~wxXmString() { XmStringFree(m_string
); }
99 // semi-implicit conversion to XmString (shouldn't rely on implicit
100 // conversion because many of Motif functions are macros)
101 XmString
operator()() const { return m_string
; }
107 // ----------------------------------------------------------------------------
108 // macros to avoid casting WXFOO to Foo all the time
109 // ----------------------------------------------------------------------------
111 // argument is of type "wxWindow *"
112 #define GetWidget(w) ((Widget)(w)->GetHandle())
114 // ----------------------------------------------------------------------------
115 // accessors for C modules
116 // ----------------------------------------------------------------------------
118 extern "C" XtAppContext
wxGetAppContext();
120 #define wxMAX_RGB 0xff
121 #define wxMAX_SV 1000
122 #define wxSIGN(x) ((x < 0) ? -x : x)
127 typedef struct wx_hsv
{
131 #define wxMax3(x,y,z) ((x > y) ? ((x > z) ? x : z) : ((y > z) ? y : z))
132 #define wxMin3(x,y,z) ((x < y) ? ((x < z) ? x : z) : ((y < z) ? y : z))
134 void wxHSVToXColor(wxHSV
*hsv
,XColor
*xcolor
);
135 void wxXColorToHSV(wxHSV
*hsv
,XColor
*xcolor
);
136 void wxAllocNearestColor(Display
*display
,Colormap colormap
,XColor
*xcolor
);
137 void wxAllocColor(Display
*display
,Colormap colormap
,XColor
*xcolor
);