- Made wxSizer::Fit() set the client size of the target window
- Add support for wxDatePickerCtrl in wxGenericValidator (Herry Ayen Yang)
- Added wxWindow::HasFocus().
+- Added wxGLCanvas::IsDisplaySupported()
wxGTK:
Ignored under most platforms.}
+\membersection{wxGLCanvas::IsDisplaySupported}\label{wxglcanvasisdisplaysupported}
+
+\func{static bool}{IsDisplaySupported}{ \param{const int *}{ attribList = \NULL} }
+
+Determines if a canvas having the specified attributes is available.
+
+\docparam{attribList}{See \arg{attribList} for \helpref{wxGLCanvas::wxGLCanvas}{wxglcanvasconstr}.}
+
+Returns \true if attributes are supported.
+
+
\membersection{wxGLCanvas::SetCurrent}\label{wxglcanvassetcurrent}
\func{bool}{SetCurrent}{ \param{const wxGLContext&}{ context} }
// accessors
// ---------
+ // check if the given attributes are supported without creating a canvas
+ static bool IsDisplaySupported(const int *attribList);
+
const wxPalette *GetPalette() const { return &m_palette; }
// miscellaneous helper functions
// free the global GL visual, called by wxGLApp
static void FreeDefaultVisualInfo();
+ // initializes XVisualInfo (in any case) and, if supported, GLXFBConfig
+ //
+ // returns false if XVisualInfo couldn't be initialized, otherwise caller
+ // is responsible for freeing the pointers
+ static bool InitXVisualInfo(const int *attribList,
+ GLXFBConfig **pFBC, XVisualInfo **pXVisual);
+
private:
// fills in glattrs with attributes defined by wxattrs which must be
// 0-terminated if it is non-NULL
// should be at least 16 to accommodate the default attributes
static bool ConvertWXAttrsToGL(const int *wxattrs, int *glattrs, size_t n);
- // initializes XVisualInfo (in any case) and, if supported, GLXFBConfig
- //
- // returns false if XVisualInfo couldn't be initialized, otherwise caller
- // is responsible for freeing the pointers
- static bool InitXVisualInfo(const int *attribList,
- GLXFBConfig **pFBC, XVisualInfo **pXVisual);
-
// this is only used if it's supported i.e. if GL >= 1.3
GLXFBConfig *m_fbc;
SetClientSize(400, 400);
Show();
+
+ // test IsDisplaySupported() function:
+ static const int attribs[] = { WX_GL_RGBA, WX_GL_DOUBLEBUFFER, 0 };
+ wxLogStatus("Double-buffered display %s supported",
+ wxGLCanvas::IsDisplaySupported(attribs) ? "is" : "not");
}
void MyFrame::OnClose(wxCommandEvent& WXUNUSED(event))
aglDestroyPixelFormat(m_aglFormat);
}
+/* static */
+bool wxGLCanvasBase::IsDisplaySupported(const int *attribList)
+{
+ AGLPixelFormat aglFormat = ChoosePixelFormat(attribList);
+
+ if ( !aglFormat )
+ return false;
+
+ aglDestroyPixelFormat(aglFormat);
+
+ return true;
+}
+
bool wxGLCanvas::SwapBuffers()
{
AGLContext context = aglGetCurrentContext();
return ::ChoosePixelFormat(hdc, ppfd);
}
+/* static */
+bool wxGLCanvasBase::IsDisplaySupported(const int *attribList)
+{
+ // We need a device context to test the pixel format, so get one
+ // for the root window.
+ return wxGLCanvas::ChooseMatchingPixelFormat(ScreenHDC(), attribList) > 0;
+}
+
bool wxGLCanvas::DoSetup(const int *attribList)
{
PIXELFORMATDESCRIPTOR pfd;
return *pXVisual != NULL;
}
+/* static */
+bool
+wxGLCanvasBase::IsDisplaySupported(const int *attribList)
+{
+ GLXFBConfig *fbc = NULL;
+ XVisualInfo *vi = NULL;
+
+ const bool
+ isSupported = wxGLCanvasX11::InitXVisualInfo(attribList, &fbc, &vi);
+
+ if ( fbc )
+ XFree(fbc);
+ if ( vi )
+ XFree(vi);
+
+ return isSupported;
+}
+
// ----------------------------------------------------------------------------
// default visual management
// ----------------------------------------------------------------------------