platform.cpp

Go to the documentation of this file.
00001 // $Id: platform.cpp 1344 2006-06-20 19:52:02Z alex $
00002 /* @@tag:xara-cn-tp@@ THIRD PARTY COPYRIGHT */
00003 // The following line makes normalize.pl skip type fixing
00004 /* SKIPFIXTYPES: START */
00005 
00006 // This file is derived from CVSHEAD wxWidgets and is thus
00007 // under the wxWidgets / wxWindows license.
00008 
00009 #include "platform.h"
00010 
00011 wxPlatformDependent * wxPlatformDependent::s_PlatformDependent = NULL;
00012 IMPLEMENT_DYNAMIC_CLASS(wxPlatformDependent, wxObject);
00013 
00014 #if defined( __WXGTK__ )
00015 #include <gtk/gtk.h>
00016 #endif
00017 
00018 // Platform specific Init code
00019 bool wxPlatformDependent::Init(wxClassInfo * pClassInfo)
00020 {
00021     if (!pClassInfo)
00022         pClassInfo = CLASSINFO(wxPlatformDependent);
00023     wxASSERT(pClassInfo != NULL);
00024     wxASSERT(pClassInfo->IsKindOf(CLASSINFO(wxPlatformDependent)));
00025     wxASSERT(s_PlatformDependent == NULL);
00026     s_PlatformDependent = (wxPlatformDependent *) pClassInfo->CreateObject();
00027     wxASSERT(s_PlatformDependent != NULL);
00028     if (!s_PlatformDependent) return false;
00029 
00030     Get()->Initialise();
00031     return true;
00032 }
00033 
00034 // Deinit static function
00035 void wxPlatformDependent::DeInit()
00036 {
00037     wxASSERT(s_PlatformDependent != NULL);
00038     Get()->Deinitialise();
00039     delete (s_PlatformDependent);
00040     s_PlatformDependent = NULL;
00041 }
00042 
00043 // Platform dependent stuff starts here
00044 
00045 void wxPlatformDependent::FixUpdate(wxWindow * pwxWindow, bool flush /*=true*/)
00046 {
00047 #if defined( __WXGTK__ )
00048     // On GTK, in 2.6.3 and predecessor, wxWindow::Update does not update the window
00049     // where m_window is NULL, and thus misses native controls. We thus do it properly
00050     // here - we assume the patch to fix this will be taken in 2.6.4
00051     // This routine should be called after "update"
00052 #if !wxCHECK_VERSION(2,6,4)
00053     // Update this one
00054     if (pwxWindow && pwxWindow->m_widget && pwxWindow->m_widget->window)
00055         gdk_window_process_updates( pwxWindow->m_widget->window, FALSE );
00056     // now recurse through children
00057     // Now process children if any
00058     wxWindowList::Node * pNode = pwxWindow->GetChildren().GetFirst();
00059     while (pNode)
00060     {
00061         FixUpdate(pNode->GetData(), false);
00062         pNode = pNode->GetNext();
00063     }
00064     if (flush)
00065         gdk_flush();
00066 #endif
00067 #endif
00068     return;
00069 }
00070 
00071 #if defined( __WXGTK__ )
00072 void wxPlatformDependent::ParseGtkRcString(char * rcstring)
00073 {
00074     gtk_rc_parse_string(rcstring);
00075     return;
00076 }
00077 
00078 void wxPlatformDependent::SetGtkWidgetName(wxWindow * pwxWindow, char * name)
00079 {
00080     gtk_widget_set_name(pwxWindow->m_widget, name);
00081     return;
00082 }
00083 
00084 #endif
00085 
00086 void wxPlatformDependent::RealYield()
00087 {
00088 #if defined( __WXGTK__ )
00089     int i=0;
00090     do
00091     {
00092         gdk_flush();
00093         ::wxYield();
00094     } while (gtk_events_pending() && (i++<10));
00095 #else
00096     ::wxYield();
00097 #endif
00098 }

Generated on Sat Nov 10 03:49:02 2007 for Camelot by  doxygen 1.4.4