// implementation
// --------------
- void ComputeScaleAndOrigin();
+ virtual void ComputeScaleAndOrigin();
long XDEV2LOG(long x) const
{
void SetUpDC();
void Destroy();
+ void ComputeScaleAndOrigin();
+
GdkWindow *GetWindow() { return m_window; }
};
// implementation
// --------------
- void ComputeScaleAndOrigin();
+ virtual void ComputeScaleAndOrigin();
long XDEV2LOG(long x) const
{
void SetUpDC();
void Destroy();
+ void ComputeScaleAndOrigin();
+
GdkWindow *GetWindow() { return m_window; }
};
#include "gdk/gdk.h"
+//-----------------------------------------------------------------------------
+// idle system
+//-----------------------------------------------------------------------------
+
+extern void wxapp_install_idle_handler();
+extern bool g_isIdle;
+
//-----------------------------------------------------------------------------
// wxCursor
//-----------------------------------------------------------------------------
// busy cursor routines
//-----------------------------------------------------------------------------
-extern wxCursor *g_globalCursor;
+extern wxCursor g_globalCursor;
-static wxCursor *gs_savedCursor = NULL;
+static wxCursor gs_savedCursor;
static int gs_busyCount = 0;
void wxEndBusyCursor()
{
- if ( --gs_busyCount > 0 )
+ if (--gs_busyCount > 0)
return;
- wxCHECK_RET( gs_savedCursor && gs_savedCursor->Ok(),
- _T("calling wxEndBusyCursor() without wxBeginBusyCursor()?") );
-
- wxSetCursor(*gs_savedCursor);
- delete gs_savedCursor;
- gs_savedCursor = NULL;
+ wxSetCursor( gs_savedCursor );
+ gs_savedCursor = wxNullCursor;
}
void wxBeginBusyCursor( wxCursor *WXUNUSED(cursor) )
{
- if ( gs_busyCount++ > 0 )
+ if (gs_busyCount++ > 0)
return;
- wxASSERT_MSG( !gs_savedCursor,
+ wxASSERT_MSG( !gs_savedCursor.Ok(),
_T("forgot to call wxEndBusyCursor, will leak memory") );
- gs_savedCursor = new wxCursor;
- if ( g_globalCursor && g_globalCursor->Ok() )
- *gs_savedCursor = *g_globalCursor;
- else
- *gs_savedCursor = wxCursor(wxCURSOR_ARROW);
- wxSetCursor(wxCursor(wxCURSOR_WATCH));
+ gs_savedCursor = g_globalCursor;
+
+ wxSetCursor( wxCursor(wxCURSOR_WATCH) );
}
bool wxIsBusy()
void wxSetCursor( const wxCursor& cursor )
{
- if (g_globalCursor) (*g_globalCursor) = cursor;
+ if (g_isIdle)
+ wxapp_install_idle_handler();
+
+ g_globalCursor = cursor;
}
/* Current cursor, in order to hang on to
* cursor handle when setting the cursor globally */
-wxCursor *g_globalCursor = (wxCursor *) NULL;
+wxCursor g_globalCursor;
/* Don't allow event propagation during drag */
bool g_blockEventsOnDrag = FALSE;
void wxDC::ComputeScaleAndOrigin()
{
- /* CMB: copy scale to see if it changes */
- double origScaleX = m_scaleX;
- double origScaleY = m_scaleY;
-
m_scaleX = m_logicalScaleX * m_userScaleX;
m_scaleY = m_logicalScaleY * m_userScaleY;
-
- /* CMB: if scale has changed call SetPen to recalulate the line width */
- if (m_scaleX != origScaleX || m_scaleY != origScaleY)
- {
- /* this is a bit artificial, but we need to force wxDC to think
- the pen has changed */
- wxPen pen = m_pen;
- m_pen = wxNullPen;
- SetPen( pen );
- }
}
void wxDC::SetMapMode( int mode )
m_bgGC = (GdkGC*) NULL;
}
+void wxWindowDC::ComputeScaleAndOrigin()
+{
+ /* CMB: copy scale to see if it changes */
+ double origScaleX = m_scaleX;
+ double origScaleY = m_scaleY;
+
+ wxDC::ComputeScaleAndOrigin();
+
+ /* CMB: if scale has changed call SetPen to recalulate the line width */
+ if ((m_scaleX != origScaleX || m_scaleY != origScaleY) &&
+ (m_pen.Ok()))
+ {
+ /* this is a bit artificial, but we need to force wxDC to think
+ the pen has changed */
+ wxPen pen = m_pen;
+ m_pen = wxNullPen;
+ SetPen( pen );
+ }
+}
+
// Resolution in pixels per logical inch
wxSize wxWindowDC::GetPPI() const
{
extern wxList wxPendingDelete;
extern bool g_blockEventsOnDrag;
extern bool g_blockEventsOnScroll;
+extern wxCursor g_globalCursor;
static bool g_capturing = FALSE;
static wxWindow *g_focusWindow = (wxWindow*) NULL;
if (!win->IsOwnGtkWindow( gdk_event->window )) return FALSE;
- if (widget->window && win->GetCursor().Ok() )
- gdk_window_set_cursor( widget->window, win->GetCursor().GetCursor() );
-
wxMouseEvent event( wxEVT_ENTER_WINDOW );
#if (GTK_MINOR_VERSION > 0)
event.SetTimestamp( gdk_event->time );
if (!win->IsOwnGtkWindow( gdk_event->window )) return FALSE;
- if (widget->window && win->GetCursor().Ok() )
- gdk_window_set_cursor( widget->window, wxSTANDARD_CURSOR->GetCursor() );
-
wxMouseEvent event( wxEVT_LEAVE_WINDOW );
#if (GTK_MINOR_VERSION > 0)
event.SetTimestamp( gdk_event->time );
void wxWindow::OnInternalIdle()
{
+ GdkWindow *window = GetConnectWidget()->window;
+ if (window)
+ {
+ if (g_globalCursor.Ok())
+ gdk_window_set_cursor( window, g_globalCursor.GetCursor() );
+ else
+ gdk_window_set_cursor( window, m_cursor.GetCursor() );
+ }
+
UpdateWindowUI();
}
return TRUE;
}
- if ((m_widget) && (m_widget->window))
- gdk_window_set_cursor( m_widget->window, GetCursor().GetCursor() );
-
- if ((m_wxwindow) && (m_wxwindow->window))
- gdk_window_set_cursor( m_wxwindow->window, GetCursor().GetCursor() );
+// gdk_window_set_cursor( connect_widget->window, GetCursor().GetCursor() );
// cursor was set
return TRUE;
#include "gdk/gdk.h"
+//-----------------------------------------------------------------------------
+// idle system
+//-----------------------------------------------------------------------------
+
+extern void wxapp_install_idle_handler();
+extern bool g_isIdle;
+
//-----------------------------------------------------------------------------
// wxCursor
//-----------------------------------------------------------------------------
// busy cursor routines
//-----------------------------------------------------------------------------
-extern wxCursor *g_globalCursor;
+extern wxCursor g_globalCursor;
-static wxCursor *gs_savedCursor = NULL;
+static wxCursor gs_savedCursor;
static int gs_busyCount = 0;
void wxEndBusyCursor()
{
- if ( --gs_busyCount > 0 )
+ if (--gs_busyCount > 0)
return;
- wxCHECK_RET( gs_savedCursor && gs_savedCursor->Ok(),
- _T("calling wxEndBusyCursor() without wxBeginBusyCursor()?") );
-
- wxSetCursor(*gs_savedCursor);
- delete gs_savedCursor;
- gs_savedCursor = NULL;
+ wxSetCursor( gs_savedCursor );
+ gs_savedCursor = wxNullCursor;
}
void wxBeginBusyCursor( wxCursor *WXUNUSED(cursor) )
{
- if ( gs_busyCount++ > 0 )
+ if (gs_busyCount++ > 0)
return;
- wxASSERT_MSG( !gs_savedCursor,
+ wxASSERT_MSG( !gs_savedCursor.Ok(),
_T("forgot to call wxEndBusyCursor, will leak memory") );
- gs_savedCursor = new wxCursor;
- if ( g_globalCursor && g_globalCursor->Ok() )
- *gs_savedCursor = *g_globalCursor;
- else
- *gs_savedCursor = wxCursor(wxCURSOR_ARROW);
- wxSetCursor(wxCursor(wxCURSOR_WATCH));
+ gs_savedCursor = g_globalCursor;
+
+ wxSetCursor( wxCursor(wxCURSOR_WATCH) );
}
bool wxIsBusy()
void wxSetCursor( const wxCursor& cursor )
{
- if (g_globalCursor) (*g_globalCursor) = cursor;
+ if (g_isIdle)
+ wxapp_install_idle_handler();
+
+ g_globalCursor = cursor;
}
/* Current cursor, in order to hang on to
* cursor handle when setting the cursor globally */
-wxCursor *g_globalCursor = (wxCursor *) NULL;
+wxCursor g_globalCursor;
/* Don't allow event propagation during drag */
bool g_blockEventsOnDrag = FALSE;
void wxDC::ComputeScaleAndOrigin()
{
- /* CMB: copy scale to see if it changes */
- double origScaleX = m_scaleX;
- double origScaleY = m_scaleY;
-
m_scaleX = m_logicalScaleX * m_userScaleX;
m_scaleY = m_logicalScaleY * m_userScaleY;
-
- /* CMB: if scale has changed call SetPen to recalulate the line width */
- if (m_scaleX != origScaleX || m_scaleY != origScaleY)
- {
- /* this is a bit artificial, but we need to force wxDC to think
- the pen has changed */
- wxPen pen = m_pen;
- m_pen = wxNullPen;
- SetPen( pen );
- }
}
void wxDC::SetMapMode( int mode )
m_bgGC = (GdkGC*) NULL;
}
+void wxWindowDC::ComputeScaleAndOrigin()
+{
+ /* CMB: copy scale to see if it changes */
+ double origScaleX = m_scaleX;
+ double origScaleY = m_scaleY;
+
+ wxDC::ComputeScaleAndOrigin();
+
+ /* CMB: if scale has changed call SetPen to recalulate the line width */
+ if ((m_scaleX != origScaleX || m_scaleY != origScaleY) &&
+ (m_pen.Ok()))
+ {
+ /* this is a bit artificial, but we need to force wxDC to think
+ the pen has changed */
+ wxPen pen = m_pen;
+ m_pen = wxNullPen;
+ SetPen( pen );
+ }
+}
+
// Resolution in pixels per logical inch
wxSize wxWindowDC::GetPPI() const
{
extern wxList wxPendingDelete;
extern bool g_blockEventsOnDrag;
extern bool g_blockEventsOnScroll;
+extern wxCursor g_globalCursor;
static bool g_capturing = FALSE;
static wxWindow *g_focusWindow = (wxWindow*) NULL;
if (!win->IsOwnGtkWindow( gdk_event->window )) return FALSE;
- if (widget->window && win->GetCursor().Ok() )
- gdk_window_set_cursor( widget->window, win->GetCursor().GetCursor() );
-
wxMouseEvent event( wxEVT_ENTER_WINDOW );
#if (GTK_MINOR_VERSION > 0)
event.SetTimestamp( gdk_event->time );
if (!win->IsOwnGtkWindow( gdk_event->window )) return FALSE;
- if (widget->window && win->GetCursor().Ok() )
- gdk_window_set_cursor( widget->window, wxSTANDARD_CURSOR->GetCursor() );
-
wxMouseEvent event( wxEVT_LEAVE_WINDOW );
#if (GTK_MINOR_VERSION > 0)
event.SetTimestamp( gdk_event->time );
void wxWindow::OnInternalIdle()
{
+ GdkWindow *window = GetConnectWidget()->window;
+ if (window)
+ {
+ if (g_globalCursor.Ok())
+ gdk_window_set_cursor( window, g_globalCursor.GetCursor() );
+ else
+ gdk_window_set_cursor( window, m_cursor.GetCursor() );
+ }
+
UpdateWindowUI();
}
return TRUE;
}
- if ((m_widget) && (m_widget->window))
- gdk_window_set_cursor( m_widget->window, GetCursor().GetCursor() );
-
- if ((m_wxwindow) && (m_wxwindow->window))
- gdk_window_set_cursor( m_wxwindow->window, GetCursor().GetCursor() );
+// gdk_window_set_cursor( connect_widget->window, GetCursor().GetCursor() );
// cursor was set
return TRUE;