Added support for extra bitmap for toggled tool.

Implemented WarpPointer() and added a test for it
    to controls.
  Some minor documention updates.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2599 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
1999-05-31 10:47:44 +00:00
parent 1759ff9e91
commit 85eb36c267
9 changed files with 127 additions and 23 deletions

View File

@@ -42,7 +42,23 @@ static void gtk_toolbar_callback( GtkWidget *WXUNUSED(widget), wxToolBarTool *to
if (g_blockEventsOnDrag) return;
if (!tool->m_enabled) return;
if (tool->m_isToggle) tool->m_toggleState = !tool->m_toggleState;
if (tool->m_isToggle)
{
tool->m_toggleState = !tool->m_toggleState;
if (tool->m_bitmap2.Ok())
{
wxBitmap bitmap = tool->m_bitmap1;
if (tool->m_toggleState) bitmap = tool->m_bitmap2;
GtkPixmap *pixmap = GTK_PIXMAP( tool->m_pixmap );
GdkBitmap *mask = (GdkBitmap *) NULL;
if (bitmap.GetMask()) mask = bitmap.GetMask()->GetBitmap();
gtk_pixmap_set( pixmap, bitmap.GetPixmap(), mask );
}
}
tool->m_owner->OnLeftClick( tool->m_index, tool->m_toggleState );
}

View File

@@ -44,9 +44,7 @@
#include "gdk/gdkkeysyms.h"
#include "wx/gtk/win_gtk.h"
#if (GTK_MINOR_VERSION == 0)
#include "gdk/gdkx.h"
#endif
//-----------------------------------------------------------------------------
// documentation on internals
@@ -179,6 +177,32 @@ void debug_focus_in( GtkWidget* widget, const wxChar* name, const wxChar *window
#endif // Debug
//-----------------------------------------------------------------------------
// missing gdk functions
//-----------------------------------------------------------------------------
void
gdk_window_warp_pointer (GdkWindow *window,
gint x,
gint y)
{
GdkWindowPrivate *priv;
if (!window)
window = (GdkWindow*) &gdk_root_parent;
priv = (GdkWindowPrivate*) window;
if (!priv->destroyed)
{
XWarpPointer (priv->xdisplay,
None, /* not source window -> move from anywhere */
priv->xwindow, /* dest window */
0, 0, 0, 0, /* not source window -> move from anywhere */
x, y );
}
}
//-----------------------------------------------------------------------------
// idle system
//-----------------------------------------------------------------------------
@@ -2430,9 +2454,17 @@ bool wxWindow::SetCursor( const wxCursor &cursor )
return TRUE;
}
void wxWindow::WarpPointer( int WXUNUSED(x), int WXUNUSED(y) )
void wxWindow::WarpPointer( int x, int y )
{
// TODO
wxCHECK_RET( (m_widget != NULL), _T("invalid window") );
GtkWidget *connect_widget = GetConnectWidget();
if (connect_widget->window)
{
/* we provide this function ourselves as it is
missing in GDK */
gdk_window_warp_pointer( connect_widget->window, x, y );
}
}
void wxWindow::Refresh( bool eraseBackground, const wxRect *rect )