]> git.saurik.com Git - wxWidgets.git/blob - src/x11/glcanvas.cpp
Increase the number of visible OS X combo items.
[wxWidgets.git] / src / x11 / glcanvas.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/x11/glcanvas.cpp
3 // Purpose: wxGLCanvas, for using OpenGL with wxWidgets
4 // Uses the GLX extension.
5 // Author: Julian Smart and Wolfram Gloger
6 // Modified by: Vadim Zeitlin to update to new API
7 // Created: 1995, 1999
8 // Copyright: (c) Julian Smart, Wolfram Gloger
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 // TODO: merge this with wxGTK version in some src/unix/glcanvasx11.cpp
13
14 // ============================================================================
15 // declarations
16 // ============================================================================
17
18 // ----------------------------------------------------------------------------
19 // headers
20 // ----------------------------------------------------------------------------
21
22 // for compilers that support precompilation, includes "wx.h".
23 #include "wx/wxprec.h"
24
25 #if defined(__BORLANDC__)
26 #pragma hdrstop
27 #endif
28
29 #if wxUSE_GLCANVAS
30
31 #include "wx/glcanvas.h"
32
33 #ifndef WX_PRECOMP
34 #include "wx/app.h"
35 #include "wx/utils.h"
36 #endif
37
38 // ============================================================================
39 // implementation
40 // ============================================================================
41
42 IMPLEMENT_CLASS(wxGLCanvas, wxWindow)
43
44 wxGLCanvas::wxGLCanvas(wxWindow *parent,
45 wxWindowID id,
46 const int *attribList,
47 const wxPoint& pos,
48 const wxSize& size,
49 long style,
50 const wxString& name,
51 const wxPalette& palette)
52 {
53 Create(parent, id, pos, size, style, name, attribList, palette);
54 }
55
56 bool wxGLCanvas::Create(wxWindow *parent,
57 wxWindowID id,
58 const wxPoint& pos,
59 const wxSize& size,
60 long style,
61 const wxString& name,
62 const int *attribList,
63 const wxPalette& WXUNUSED(palette))
64 {
65 if ( !wxWindow::Create(parent, id, pos, size, style, name) )
66 return false;
67
68 if ( !InitVisual(attribList) )
69 return false;
70
71 return true;
72 }
73
74 Window wxGLCanvas::GetXWindow() const
75 {
76 return (Window)
77 #ifdef __WXMOTIF__
78 GetClientXWindow();
79 #else
80 GetClientAreaWindow();
81 #endif
82 }
83
84 int wxGLCanvas::GetColourIndex(const wxColour& col_)
85 {
86 wxColour& col = const_cast<wxColour&>(col_);
87
88 #ifdef __WXMOTIF__
89 col.AllocColour(GetXDisplay());
90 #else
91 col.CalcPixel(wxTheApp->GetMainColormap(wxGetDisplay()));
92 #endif
93
94 return col.GetPixel();
95 }
96
97 #endif // wxUSE_GLCANVAS