]> git.saurik.com Git - wxWidgets.git/commitdiff
Rename gtk{,1}/tbargtk.{h,cpp} to toolbar.{h,cpp}.
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 10 Dec 2009 03:04:07 +0000 (03:04 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 10 Dec 2009 03:04:07 +0000 (03:04 +0000)
We don't use crptknm$port.cpp naming convention even for MSW any more and
there is really no reason to continue to do it for just this one file in
wxGTK.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62849 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

14 files changed:
Makefile.in
build/bakefiles/files.bkl
include/wx/gtk/tbargtk.h [deleted file]
include/wx/gtk/toolbar.h [new file with mode: 0644]
include/wx/gtk1/tbargtk.h [deleted file]
include/wx/gtk1/toolbar.h [new file with mode: 0644]
include/wx/toolbar.h
src/gtk/descrip.mms
src/gtk/tbargtk.cpp [deleted file]
src/gtk/toolbar.cpp [new file with mode: 0644]
src/gtk1/descrip.mms
src/gtk1/font.cpp
src/gtk1/tbargtk.cpp [deleted file]
src/gtk1/toolbar.cpp [new file with mode: 0644]

index 61f9b7d1f75f1ae24f2fe27afb3e94800c56b141..febf89f088329883ac15e07bdfe864d8e6bb3354 100644 (file)
@@ -2707,7 +2707,7 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION__GUI_HDR =  \
        wx/gtk1/statbox.h \
        wx/gtk1/statline.h \
        wx/gtk1/stattext.h \
        wx/gtk1/statbox.h \
        wx/gtk1/statline.h \
        wx/gtk1/stattext.h \
-       wx/gtk1/tbargtk.h \
+       wx/gtk1/tooltip.h \
        wx/gtk1/textctrl.h \
        wx/gtk1/tglbtn.h \
        wx/gtk1/treectrl.h
        wx/gtk1/textctrl.h \
        wx/gtk1/tglbtn.h \
        wx/gtk1/treectrl.h
@@ -2759,7 +2759,7 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION_2_GUI_HDR =  \
        wx/gtk/statbox.h \
        wx/gtk/statline.h \
        wx/gtk/stattext.h \
        wx/gtk/statbox.h \
        wx/gtk/statline.h \
        wx/gtk/stattext.h \
-       wx/gtk/tbargtk.h \
+       wx/gtk/toolbar.h \
        wx/gtk/textctrl.h \
        wx/gtk/textentry.h \
        wx/gtk/tglbtn.h \
        wx/gtk/textctrl.h \
        wx/gtk/textentry.h \
        wx/gtk/tglbtn.h \
@@ -4987,7 +4987,7 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION____GUI_SRC_OBJECTS =  \
        monodll_gtk1_statbox.o \
        monodll_gtk1_statline.o \
        monodll_gtk1_stattext.o \
        monodll_gtk1_statbox.o \
        monodll_gtk1_statline.o \
        monodll_gtk1_stattext.o \
-       monodll_gtk1_tbargtk.o \
+       monodll_gtk1_tooltip.o \
        monodll_gtk1_textctrl.o \
        monodll_gtk1_tglbtn.o
 @COND_TOOLKIT_GTK_TOOLKIT_VERSION_@__GUI_SRC_OBJECTS = $(COND_TOOLKIT_GTK_TOOLKIT_VERSION____GUI_SRC_OBJECTS)
        monodll_gtk1_textctrl.o \
        monodll_gtk1_tglbtn.o
 @COND_TOOLKIT_GTK_TOOLKIT_VERSION_@__GUI_SRC_OBJECTS = $(COND_TOOLKIT_GTK_TOOLKIT_VERSION____GUI_SRC_OBJECTS)
@@ -5040,7 +5040,7 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___GUI_SRC_OBJECTS =  \
        monodll_gtk_statbox.o \
        monodll_gtk_statline.o \
        monodll_gtk_stattext.o \
        monodll_gtk_statbox.o \
        monodll_gtk_statline.o \
        monodll_gtk_stattext.o \
-       monodll_gtk_tbargtk.o \
+       monodll_gtk_toolbar.o \
        monodll_gtk_textctrl.o \
        monodll_gtk_textentry.o \
        monodll_gtk_tglbtn.o \
        monodll_gtk_textctrl.o \
        monodll_gtk_textentry.o \
        monodll_gtk_tglbtn.o \
@@ -6807,7 +6807,7 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION____GUI_SRC_OBJECTS_1 =  \
        monolib_gtk1_statbox.o \
        monolib_gtk1_statline.o \
        monolib_gtk1_stattext.o \
        monolib_gtk1_statbox.o \
        monolib_gtk1_statline.o \
        monolib_gtk1_stattext.o \
-       monolib_gtk1_tbargtk.o \
+       monolib_gtk1_tooltip.o \
        monolib_gtk1_textctrl.o \
        monolib_gtk1_tglbtn.o
 @COND_TOOLKIT_GTK_TOOLKIT_VERSION_@__GUI_SRC_OBJECTS_1 = $(COND_TOOLKIT_GTK_TOOLKIT_VERSION____GUI_SRC_OBJECTS_1)
        monolib_gtk1_textctrl.o \
        monolib_gtk1_tglbtn.o
 @COND_TOOLKIT_GTK_TOOLKIT_VERSION_@__GUI_SRC_OBJECTS_1 = $(COND_TOOLKIT_GTK_TOOLKIT_VERSION____GUI_SRC_OBJECTS_1)
@@ -6860,7 +6860,7 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___GUI_SRC_OBJECTS_1 =  \
        monolib_gtk_statbox.o \
        monolib_gtk_statline.o \
        monolib_gtk_stattext.o \
        monolib_gtk_statbox.o \
        monolib_gtk_statline.o \
        monolib_gtk_stattext.o \
-       monolib_gtk_tbargtk.o \
+       monolib_gtk_toolbar.o \
        monolib_gtk_textctrl.o \
        monolib_gtk_textentry.o \
        monolib_gtk_tglbtn.o \
        monolib_gtk_textctrl.o \
        monolib_gtk_textentry.o \
        monolib_gtk_tglbtn.o \
@@ -8816,7 +8816,7 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION____GUI_SRC_OBJECTS_2 =  \
        coredll_gtk1_statbox.o \
        coredll_gtk1_statline.o \
        coredll_gtk1_stattext.o \
        coredll_gtk1_statbox.o \
        coredll_gtk1_statline.o \
        coredll_gtk1_stattext.o \
-       coredll_gtk1_tbargtk.o \
+       coredll_gtk1_tooltip.o \
        coredll_gtk1_textctrl.o \
        coredll_gtk1_tglbtn.o
 @COND_TOOLKIT_GTK_TOOLKIT_VERSION_@__GUI_SRC_OBJECTS_2 = $(COND_TOOLKIT_GTK_TOOLKIT_VERSION____GUI_SRC_OBJECTS_2)
        coredll_gtk1_textctrl.o \
        coredll_gtk1_tglbtn.o
 @COND_TOOLKIT_GTK_TOOLKIT_VERSION_@__GUI_SRC_OBJECTS_2 = $(COND_TOOLKIT_GTK_TOOLKIT_VERSION____GUI_SRC_OBJECTS_2)
@@ -8869,7 +8869,7 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___GUI_SRC_OBJECTS_2 =  \
        coredll_gtk_statbox.o \
        coredll_gtk_statline.o \
        coredll_gtk_stattext.o \
        coredll_gtk_statbox.o \
        coredll_gtk_statline.o \
        coredll_gtk_stattext.o \
-       coredll_gtk_tbargtk.o \
+       coredll_gtk_toolbar.o \
        coredll_gtk_textctrl.o \
        coredll_gtk_textentry.o \
        coredll_gtk_tglbtn.o \
        coredll_gtk_textctrl.o \
        coredll_gtk_textentry.o \
        coredll_gtk_tglbtn.o \
@@ -10309,7 +10309,7 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION____GUI_SRC_OBJECTS_3 =  \
        corelib_gtk1_statbox.o \
        corelib_gtk1_statline.o \
        corelib_gtk1_stattext.o \
        corelib_gtk1_statbox.o \
        corelib_gtk1_statline.o \
        corelib_gtk1_stattext.o \
-       corelib_gtk1_tbargtk.o \
+       corelib_gtk1_tooltip.o \
        corelib_gtk1_textctrl.o \
        corelib_gtk1_tglbtn.o
 @COND_TOOLKIT_GTK_TOOLKIT_VERSION_@__GUI_SRC_OBJECTS_3 = $(COND_TOOLKIT_GTK_TOOLKIT_VERSION____GUI_SRC_OBJECTS_3)
        corelib_gtk1_textctrl.o \
        corelib_gtk1_tglbtn.o
 @COND_TOOLKIT_GTK_TOOLKIT_VERSION_@__GUI_SRC_OBJECTS_3 = $(COND_TOOLKIT_GTK_TOOLKIT_VERSION____GUI_SRC_OBJECTS_3)
@@ -10362,7 +10362,7 @@ COND_TOOLKIT_GTK_TOOLKIT_VERSION_2___GUI_SRC_OBJECTS_3 =  \
        corelib_gtk_statbox.o \
        corelib_gtk_statline.o \
        corelib_gtk_stattext.o \
        corelib_gtk_statbox.o \
        corelib_gtk_statline.o \
        corelib_gtk_stattext.o \
-       corelib_gtk_tbargtk.o \
+       corelib_gtk_toolbar.o \
        corelib_gtk_textctrl.o \
        corelib_gtk_textentry.o \
        corelib_gtk_tglbtn.o \
        corelib_gtk_textctrl.o \
        corelib_gtk_textentry.o \
        corelib_gtk_tglbtn.o \
@@ -15149,8 +15149,8 @@ monodll_gtk_statline.o: $(srcdir)/src/gtk/statline.cpp $(MONODLL_ODEP)
 monodll_gtk_stattext.o: $(srcdir)/src/gtk/stattext.cpp $(MONODLL_ODEP)
        $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/gtk/stattext.cpp
 
 monodll_gtk_stattext.o: $(srcdir)/src/gtk/stattext.cpp $(MONODLL_ODEP)
        $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/gtk/stattext.cpp
 
-monodll_gtk_tbargtk.o: $(srcdir)/src/gtk/tbargtk.cpp $(MONODLL_ODEP)
-       $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/gtk/tbargtk.cpp
+monodll_gtk_toolbar.o: $(srcdir)/src/gtk/toolbar.cpp $(MONODLL_ODEP)
+       $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/gtk/toolbar.cpp
 
 monodll_gtk_textctrl.o: $(srcdir)/src/gtk/textctrl.cpp $(MONODLL_ODEP)
        $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/gtk/textctrl.cpp
 
 monodll_gtk_textctrl.o: $(srcdir)/src/gtk/textctrl.cpp $(MONODLL_ODEP)
        $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/gtk/textctrl.cpp
@@ -15245,9 +15245,6 @@ monodll_gtk1_statline.o: $(srcdir)/src/gtk1/statline.cpp $(MONODLL_ODEP)
 monodll_gtk1_stattext.o: $(srcdir)/src/gtk1/stattext.cpp $(MONODLL_ODEP)
        $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/gtk1/stattext.cpp
 
 monodll_gtk1_stattext.o: $(srcdir)/src/gtk1/stattext.cpp $(MONODLL_ODEP)
        $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/gtk1/stattext.cpp
 
-monodll_gtk1_tbargtk.o: $(srcdir)/src/gtk1/tbargtk.cpp $(MONODLL_ODEP)
-       $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/gtk1/tbargtk.cpp
-
 monodll_gtk1_textctrl.o: $(srcdir)/src/gtk1/textctrl.cpp $(MONODLL_ODEP)
        $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/gtk1/textctrl.cpp
 
 monodll_gtk1_textctrl.o: $(srcdir)/src/gtk1/textctrl.cpp $(MONODLL_ODEP)
        $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/gtk1/textctrl.cpp
 
@@ -19949,8 +19946,8 @@ monolib_gtk_statline.o: $(srcdir)/src/gtk/statline.cpp $(MONOLIB_ODEP)
 monolib_gtk_stattext.o: $(srcdir)/src/gtk/stattext.cpp $(MONOLIB_ODEP)
        $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/gtk/stattext.cpp
 
 monolib_gtk_stattext.o: $(srcdir)/src/gtk/stattext.cpp $(MONOLIB_ODEP)
        $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/gtk/stattext.cpp
 
-monolib_gtk_tbargtk.o: $(srcdir)/src/gtk/tbargtk.cpp $(MONOLIB_ODEP)
-       $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/gtk/tbargtk.cpp
+monolib_gtk_toolbar.o: $(srcdir)/src/gtk/toolbar.cpp $(MONOLIB_ODEP)
+       $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/gtk/toolbar.cpp
 
 monolib_gtk_textctrl.o: $(srcdir)/src/gtk/textctrl.cpp $(MONOLIB_ODEP)
        $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/gtk/textctrl.cpp
 
 monolib_gtk_textctrl.o: $(srcdir)/src/gtk/textctrl.cpp $(MONOLIB_ODEP)
        $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/gtk/textctrl.cpp
@@ -20045,9 +20042,6 @@ monolib_gtk1_statline.o: $(srcdir)/src/gtk1/statline.cpp $(MONOLIB_ODEP)
 monolib_gtk1_stattext.o: $(srcdir)/src/gtk1/stattext.cpp $(MONOLIB_ODEP)
        $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/gtk1/stattext.cpp
 
 monolib_gtk1_stattext.o: $(srcdir)/src/gtk1/stattext.cpp $(MONOLIB_ODEP)
        $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/gtk1/stattext.cpp
 
-monolib_gtk1_tbargtk.o: $(srcdir)/src/gtk1/tbargtk.cpp $(MONOLIB_ODEP)
-       $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/gtk1/tbargtk.cpp
-
 monolib_gtk1_textctrl.o: $(srcdir)/src/gtk1/textctrl.cpp $(MONOLIB_ODEP)
        $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/gtk1/textctrl.cpp
 
 monolib_gtk1_textctrl.o: $(srcdir)/src/gtk1/textctrl.cpp $(MONOLIB_ODEP)
        $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/gtk1/textctrl.cpp
 
@@ -25460,8 +25454,8 @@ coredll_gtk_statline.o: $(srcdir)/src/gtk/statline.cpp $(COREDLL_ODEP)
 coredll_gtk_stattext.o: $(srcdir)/src/gtk/stattext.cpp $(COREDLL_ODEP)
        $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/gtk/stattext.cpp
 
 coredll_gtk_stattext.o: $(srcdir)/src/gtk/stattext.cpp $(COREDLL_ODEP)
        $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/gtk/stattext.cpp
 
-coredll_gtk_tbargtk.o: $(srcdir)/src/gtk/tbargtk.cpp $(COREDLL_ODEP)
-       $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/gtk/tbargtk.cpp
+coredll_gtk_toolbar.o: $(srcdir)/src/gtk/toolbar.cpp $(COREDLL_ODEP)
+       $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/gtk/toolbar.cpp
 
 coredll_gtk_textctrl.o: $(srcdir)/src/gtk/textctrl.cpp $(COREDLL_ODEP)
        $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/gtk/textctrl.cpp
 
 coredll_gtk_textctrl.o: $(srcdir)/src/gtk/textctrl.cpp $(COREDLL_ODEP)
        $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/gtk/textctrl.cpp
@@ -25556,9 +25550,6 @@ coredll_gtk1_statline.o: $(srcdir)/src/gtk1/statline.cpp $(COREDLL_ODEP)
 coredll_gtk1_stattext.o: $(srcdir)/src/gtk1/stattext.cpp $(COREDLL_ODEP)
        $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/gtk1/stattext.cpp
 
 coredll_gtk1_stattext.o: $(srcdir)/src/gtk1/stattext.cpp $(COREDLL_ODEP)
        $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/gtk1/stattext.cpp
 
-coredll_gtk1_tbargtk.o: $(srcdir)/src/gtk1/tbargtk.cpp $(COREDLL_ODEP)
-       $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/gtk1/tbargtk.cpp
-
 coredll_gtk1_textctrl.o: $(srcdir)/src/gtk1/textctrl.cpp $(COREDLL_ODEP)
        $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/gtk1/textctrl.cpp
 
 coredll_gtk1_textctrl.o: $(srcdir)/src/gtk1/textctrl.cpp $(COREDLL_ODEP)
        $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/gtk1/textctrl.cpp
 
@@ -28991,8 +28982,8 @@ corelib_gtk_statline.o: $(srcdir)/src/gtk/statline.cpp $(CORELIB_ODEP)
 corelib_gtk_stattext.o: $(srcdir)/src/gtk/stattext.cpp $(CORELIB_ODEP)
        $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/gtk/stattext.cpp
 
 corelib_gtk_stattext.o: $(srcdir)/src/gtk/stattext.cpp $(CORELIB_ODEP)
        $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/gtk/stattext.cpp
 
-corelib_gtk_tbargtk.o: $(srcdir)/src/gtk/tbargtk.cpp $(CORELIB_ODEP)
-       $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/gtk/tbargtk.cpp
+corelib_gtk_toolbar.o: $(srcdir)/src/gtk/toolbar.cpp $(CORELIB_ODEP)
+       $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/gtk/toolbar.cpp
 
 corelib_gtk_textctrl.o: $(srcdir)/src/gtk/textctrl.cpp $(CORELIB_ODEP)
        $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/gtk/textctrl.cpp
 
 corelib_gtk_textctrl.o: $(srcdir)/src/gtk/textctrl.cpp $(CORELIB_ODEP)
        $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/gtk/textctrl.cpp
@@ -29087,9 +29078,6 @@ corelib_gtk1_statline.o: $(srcdir)/src/gtk1/statline.cpp $(CORELIB_ODEP)
 corelib_gtk1_stattext.o: $(srcdir)/src/gtk1/stattext.cpp $(CORELIB_ODEP)
        $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/gtk1/stattext.cpp
 
 corelib_gtk1_stattext.o: $(srcdir)/src/gtk1/stattext.cpp $(CORELIB_ODEP)
        $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/gtk1/stattext.cpp
 
-corelib_gtk1_tbargtk.o: $(srcdir)/src/gtk1/tbargtk.cpp $(CORELIB_ODEP)
-       $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/gtk1/tbargtk.cpp
-
 corelib_gtk1_textctrl.o: $(srcdir)/src/gtk1/textctrl.cpp $(CORELIB_ODEP)
        $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/gtk1/textctrl.cpp
 
 corelib_gtk1_textctrl.o: $(srcdir)/src/gtk1/textctrl.cpp $(CORELIB_ODEP)
        $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/gtk1/textctrl.cpp
 
index 7686643cf48c1387f3d808767f04897928a396ec..790f4a404128964ed41bd7e55ce765b9284b651b 100644 (file)
@@ -1126,7 +1126,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
     src/gtk/statbox.cpp
     src/gtk/statline.cpp
     src/gtk/stattext.cpp
     src/gtk/statbox.cpp
     src/gtk/statline.cpp
     src/gtk/stattext.cpp
-    src/gtk/tbargtk.cpp
+    src/gtk/toolbar.cpp
     src/gtk/textctrl.cpp
     src/gtk/textentry.cpp
     src/gtk/tglbtn.cpp
     src/gtk/textctrl.cpp
     src/gtk/textentry.cpp
     src/gtk/tglbtn.cpp
@@ -1179,7 +1179,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
     wx/gtk/statbox.h
     wx/gtk/statline.h
     wx/gtk/stattext.h
     wx/gtk/statbox.h
     wx/gtk/statline.h
     wx/gtk/stattext.h
-    wx/gtk/tbargtk.h
+    wx/gtk/toolbar.h
     wx/gtk/textctrl.h
     wx/gtk/textentry.h
     wx/gtk/tglbtn.h
     wx/gtk/textctrl.h
     wx/gtk/textentry.h
     wx/gtk/tglbtn.h
@@ -1297,7 +1297,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
     src/gtk1/statbox.cpp
     src/gtk1/statline.cpp
     src/gtk1/stattext.cpp
     src/gtk1/statbox.cpp
     src/gtk1/statline.cpp
     src/gtk1/stattext.cpp
-    src/gtk1/tbargtk.cpp
+    src/gtk1/tooltip.cpp
     src/gtk1/textctrl.cpp
     src/gtk1/tglbtn.cpp
 </set>
     src/gtk1/textctrl.cpp
     src/gtk1/tglbtn.cpp
 </set>
@@ -1343,7 +1343,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
     wx/gtk1/statbox.h
     wx/gtk1/statline.h
     wx/gtk1/stattext.h
     wx/gtk1/statbox.h
     wx/gtk1/statline.h
     wx/gtk1/stattext.h
-    wx/gtk1/tbargtk.h
+    wx/gtk1/tooltip.h
     wx/gtk1/textctrl.h
     wx/gtk1/tglbtn.h
     wx/gtk1/treectrl.h
     wx/gtk1/textctrl.h
     wx/gtk1/tglbtn.h
     wx/gtk1/treectrl.h
diff --git a/include/wx/gtk/tbargtk.h b/include/wx/gtk/tbargtk.h
deleted file mode 100644 (file)
index 07bff71..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name:        tbargtk.h
-// Purpose:     GTK toolbar
-// Author:      Robert Roebling
-// RCS-ID:      $Id$
-// Copyright:   (c) Robert Roebling
-// Licence:     wxWindows licence
-/////////////////////////////////////////////////////////////////////////////
-
-#ifndef _WX_GTK_TBARGTK_H_
-#define _WX_GTK_TBARGTK_H_
-
-#if wxUSE_TOOLBAR
-
-// ----------------------------------------------------------------------------
-// wxToolBar
-// ----------------------------------------------------------------------------
-
-class WXDLLIMPEXP_CORE wxToolBar : public wxToolBarBase
-{
-public:
-    // construction/destruction
-    wxToolBar() { Init(); }
-    wxToolBar( wxWindow *parent,
-               wxWindowID id,
-               const wxPoint& pos = wxDefaultPosition,
-               const wxSize& size = wxDefaultSize,
-               long style = wxTB_HORIZONTAL,
-               const wxString& name = wxToolBarNameStr )
-    {
-        Init();
-
-        Create(parent, id, pos, size, style, name);
-    }
-
-    bool Create( wxWindow *parent,
-                 wxWindowID id,
-                 const wxPoint& pos = wxDefaultPosition,
-                 const wxSize& size = wxDefaultSize,
-                 long style = wxTB_HORIZONTAL,
-                 const wxString& name = wxToolBarNameStr );
-
-    virtual ~wxToolBar();
-
-    virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const;
-
-    virtual void SetToolShortHelp(int id, const wxString& helpString);
-
-    virtual void SetWindowStyleFlag( long style );
-
-    virtual void SetToolNormalBitmap(int id, const wxBitmap& bitmap);
-    virtual void SetToolDisabledBitmap(int id, const wxBitmap& bitmap);
-
-    static wxVisualAttributes
-    GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
-
-    // implementation from now on
-    // --------------------------
-
-    void OnInternalIdle();
-
-protected:
-    virtual wxSize DoGetBestSize() const;
-    virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
-
-    // implement base class pure virtuals
-    virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool);
-    virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool);
-
-    virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable);
-    virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle);
-    virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle);
-
-    virtual wxToolBarToolBase *CreateTool(int id,
-                                          const wxString& label,
-                                          const wxBitmap& bitmap1,
-                                          const wxBitmap& bitmap2,
-                                          wxItemKind kind,
-                                          wxObject *clientData,
-                                          const wxString& shortHelpString,
-                                          const wxString& longHelpString);
-    virtual wxToolBarToolBase *CreateTool(wxControl *control,
-                                          const wxString& label);
-
-private:
-    void Init();
-    void GtkSetStyle();
-    GSList* GetRadioGroup(size_t pos);
-    virtual void AddChildGTK(wxWindowGTK* child);
-
-    GtkToolbar* m_toolbar;
-    GtkTooltips* m_tooltips;
-
-    DECLARE_DYNAMIC_CLASS(wxToolBar)
-};
-
-#endif // wxUSE_TOOLBAR
-
-#endif
-    // _WX_GTK_TBARGTK_H_
diff --git a/include/wx/gtk/toolbar.h b/include/wx/gtk/toolbar.h
new file mode 100644 (file)
index 0000000..ffefa73
--- /dev/null
@@ -0,0 +1,100 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        wx/gtk/toolbar.h
+// Purpose:     GTK toolbar
+// Author:      Robert Roebling
+// RCS-ID:      $Id$
+// Copyright:   (c) Robert Roebling
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_TOOLBAR_H_
+#define _WX_GTK_TOOLBAR_H_
+
+#if wxUSE_TOOLBAR
+
+// ----------------------------------------------------------------------------
+// wxToolBar
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxToolBar : public wxToolBarBase
+{
+public:
+    // construction/destruction
+    wxToolBar() { Init(); }
+    wxToolBar( wxWindow *parent,
+               wxWindowID id,
+               const wxPoint& pos = wxDefaultPosition,
+               const wxSize& size = wxDefaultSize,
+               long style = wxTB_HORIZONTAL,
+               const wxString& name = wxToolBarNameStr )
+    {
+        Init();
+
+        Create(parent, id, pos, size, style, name);
+    }
+
+    bool Create( wxWindow *parent,
+                 wxWindowID id,
+                 const wxPoint& pos = wxDefaultPosition,
+                 const wxSize& size = wxDefaultSize,
+                 long style = wxTB_HORIZONTAL,
+                 const wxString& name = wxToolBarNameStr );
+
+    virtual ~wxToolBar();
+
+    virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const;
+
+    virtual void SetToolShortHelp(int id, const wxString& helpString);
+
+    virtual void SetWindowStyleFlag( long style );
+
+    virtual void SetToolNormalBitmap(int id, const wxBitmap& bitmap);
+    virtual void SetToolDisabledBitmap(int id, const wxBitmap& bitmap);
+
+    static wxVisualAttributes
+    GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
+
+    // implementation from now on
+    // --------------------------
+
+    void OnInternalIdle();
+
+protected:
+    virtual wxSize DoGetBestSize() const;
+    virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
+
+    // implement base class pure virtuals
+    virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool);
+    virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool);
+
+    virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable);
+    virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle);
+    virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle);
+
+    virtual wxToolBarToolBase *CreateTool(int id,
+                                          const wxString& label,
+                                          const wxBitmap& bitmap1,
+                                          const wxBitmap& bitmap2,
+                                          wxItemKind kind,
+                                          wxObject *clientData,
+                                          const wxString& shortHelpString,
+                                          const wxString& longHelpString);
+    virtual wxToolBarToolBase *CreateTool(wxControl *control,
+                                          const wxString& label);
+
+private:
+    void Init();
+    void GtkSetStyle();
+    GSList* GetRadioGroup(size_t pos);
+    virtual void AddChildGTK(wxWindowGTK* child);
+
+    GtkToolbar* m_toolbar;
+    GtkTooltips* m_tooltips;
+
+    DECLARE_DYNAMIC_CLASS(wxToolBar)
+};
+
+#endif // wxUSE_TOOLBAR
+
+#endif
+    // _WX_GTK_TOOLBAR_H_
diff --git a/include/wx/gtk1/tbargtk.h b/include/wx/gtk1/tbargtk.h
deleted file mode 100644 (file)
index 9055c1f..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name:        wx/gtk1/tbargtk.h
-// Purpose:     GTK toolbar
-// Author:      Robert Roebling
-// RCS-ID:      $Id$
-// Copyright:   (c) Robert Roebling
-// Licence:     wxWindows licence
-/////////////////////////////////////////////////////////////////////////////
-
-#ifndef _WX_GTK_TBARGTK_H_
-#define _WX_GTK_TBARGTK_H_
-
-#if wxUSE_TOOLBAR
-
-// ----------------------------------------------------------------------------
-// wxToolBar
-// ----------------------------------------------------------------------------
-
-class WXDLLIMPEXP_CORE wxToolBar : public wxToolBarBase
-{
-public:
-    // construction/destruction
-    wxToolBar() { Init(); }
-    wxToolBar( wxWindow *parent,
-               wxWindowID id,
-               const wxPoint& pos = wxDefaultPosition,
-               const wxSize& size = wxDefaultSize,
-               long style = 0,
-               const wxString& name = wxToolBarNameStr )
-    {
-        Init();
-
-        Create(parent, id, pos, size, style, name);
-    }
-
-    bool Create( wxWindow *parent,
-                 wxWindowID id,
-                 const wxPoint& pos = wxDefaultPosition,
-                 const wxSize& size = wxDefaultSize,
-                 long style = 0,
-                 const wxString& name = wxToolBarNameStr );
-
-    virtual ~wxToolBar();
-
-    // override base class virtuals
-    virtual void SetMargins(int x, int y);
-    virtual void SetToolSeparation(int separation);
-
-    virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const;
-
-    virtual void SetToolShortHelp(int id, const wxString& helpString);
-
-    virtual void SetWindowStyleFlag( long style );
-
-    static wxVisualAttributes
-    GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
-
-    // implementation from now on
-    // --------------------------
-
-    GtkToolbar   *m_toolbar;
-
-    bool          m_blockEvent;
-
-    void OnInternalIdle();
-
-protected:
-    // common part of all ctors
-    void Init();
-
-    // set the GTK toolbar style and orientation
-    void GtkSetStyle();
-
-    // implement base class pure virtuals
-    virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool);
-    virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool);
-
-    virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable);
-    virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle);
-    virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle);
-
-    virtual wxToolBarToolBase *CreateTool(int id,
-                                          const wxString& label,
-                                          const wxBitmap& bitmap1,
-                                          const wxBitmap& bitmap2,
-                                          wxItemKind kind,
-                                          wxObject *clientData,
-                                          const wxString& shortHelpString,
-                                          const wxString& longHelpString);
-    virtual wxToolBarToolBase *CreateTool(wxControl *control,
-                                          const wxString& label);
-
-private:
-    DECLARE_DYNAMIC_CLASS(wxToolBar)
-};
-
-#endif // wxUSE_TOOLBAR
-
-#endif
-    // _WX_GTK_TBARGTK_H_
diff --git a/include/wx/gtk1/toolbar.h b/include/wx/gtk1/toolbar.h
new file mode 100644 (file)
index 0000000..616fba9
--- /dev/null
@@ -0,0 +1,100 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        wx/gtk1/toolbar.h
+// Purpose:     GTK toolbar
+// Author:      Robert Roebling
+// RCS-ID:      $Id$
+// Copyright:   (c) Robert Roebling
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_GTK_TOOLBAR_H_
+#define _WX_GTK_TOOLBAR_H_
+
+#if wxUSE_TOOLBAR
+
+// ----------------------------------------------------------------------------
+// wxToolBar
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxToolBar : public wxToolBarBase
+{
+public:
+    // construction/destruction
+    wxToolBar() { Init(); }
+    wxToolBar( wxWindow *parent,
+               wxWindowID id,
+               const wxPoint& pos = wxDefaultPosition,
+               const wxSize& size = wxDefaultSize,
+               long style = 0,
+               const wxString& name = wxToolBarNameStr )
+    {
+        Init();
+
+        Create(parent, id, pos, size, style, name);
+    }
+
+    bool Create( wxWindow *parent,
+                 wxWindowID id,
+                 const wxPoint& pos = wxDefaultPosition,
+                 const wxSize& size = wxDefaultSize,
+                 long style = 0,
+                 const wxString& name = wxToolBarNameStr );
+
+    virtual ~wxToolBar();
+
+    // override base class virtuals
+    virtual void SetMargins(int x, int y);
+    virtual void SetToolSeparation(int separation);
+
+    virtual wxToolBarToolBase *FindToolForPosition(wxCoord x, wxCoord y) const;
+
+    virtual void SetToolShortHelp(int id, const wxString& helpString);
+
+    virtual void SetWindowStyleFlag( long style );
+
+    static wxVisualAttributes
+    GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
+
+    // implementation from now on
+    // --------------------------
+
+    GtkToolbar   *m_toolbar;
+
+    bool          m_blockEvent;
+
+    void OnInternalIdle();
+
+protected:
+    // common part of all ctors
+    void Init();
+
+    // set the GTK toolbar style and orientation
+    void GtkSetStyle();
+
+    // implement base class pure virtuals
+    virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool);
+    virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool);
+
+    virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable);
+    virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle);
+    virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle);
+
+    virtual wxToolBarToolBase *CreateTool(int id,
+                                          const wxString& label,
+                                          const wxBitmap& bitmap1,
+                                          const wxBitmap& bitmap2,
+                                          wxItemKind kind,
+                                          wxObject *clientData,
+                                          const wxString& shortHelpString,
+                                          const wxString& longHelpString);
+    virtual wxToolBarToolBase *CreateTool(wxControl *control,
+                                          const wxString& label);
+
+private:
+    DECLARE_DYNAMIC_CLASS(wxToolBar)
+};
+
+#endif // wxUSE_TOOLBAR
+
+#endif
+    // _WX_GTK_TOOLBAR_H_
index 0fec2feea7ece5a00944f86847ad6942586983b8..60b3ce10d70d1160e163054020fa385ecc62c702 100644 (file)
@@ -77,9 +77,9 @@ enum
     #elif defined(__WXMOTIF__)
        #include "wx/motif/toolbar.h"
     #elif defined(__WXGTK20__)
     #elif defined(__WXMOTIF__)
        #include "wx/motif/toolbar.h"
     #elif defined(__WXGTK20__)
-        #include "wx/gtk/tbargtk.h"
+        #include "wx/gtk/toolbar.h"
     #elif defined(__WXGTK__)
     #elif defined(__WXGTK__)
-        #include "wx/gtk1/tbargtk.h"
+        #include "wx/gtk1/toolbar.h"
     #elif defined(__WXMAC__)
        #include "wx/osx/toolbar.h"
     #elif defined(__WXCOCOA__)
     #elif defined(__WXMAC__)
        #include "wx/osx/toolbar.h"
     #elif defined(__WXCOCOA__)
index 0fa2bb23a9d496c62029ef23d5a089564cd8a4ba..cf4536a3478db281b0a11514133b1cc41381f48b 100644 (file)
@@ -94,7 +94,7 @@ OBJECTS0= \
        statbox.obj,\
        statline.obj,\
        stattext.obj,\
        statbox.obj,\
        statline.obj,\
        stattext.obj,\
-       tbargtk.obj,\
+       toolbar.obj,\
        textctrl.obj,\
        tglbtn.obj,\
        msgdlg.obj,\
        textctrl.obj,\
        tglbtn.obj,\
        msgdlg.obj,\
@@ -156,7 +156,7 @@ SOURCES =\
        statbox.cpp,\
        statline.cpp,\
        stattext.cpp,\
        statbox.cpp,\
        statline.cpp,\
        stattext.cpp,\
-       tbargtk.cpp,\
+       toolbar.cpp,\
        textctrl.cpp,\
        tglbtn.cpp,\
        timer.cpp,\
        textctrl.cpp,\
        tglbtn.cpp,\
        timer.cpp,\
@@ -243,7 +243,7 @@ statbmp.obj : statbmp.cpp
 statbox.obj : statbox.cpp
 statline.obj : statline.cpp
 stattext.obj : stattext.cpp
 statbox.obj : statbox.cpp
 statline.obj : statline.cpp
 stattext.obj : stattext.cpp
-tbargtk.obj : tbargtk.cpp
+toolbar.obj : toolbar.cpp
 textctrl.obj : textctrl.cpp
 tglbtn.obj : tglbtn.cpp
 timer.obj : timer.cpp
 textctrl.obj : textctrl.cpp
 tglbtn.obj : tglbtn.cpp
 timer.obj : timer.cpp
diff --git a/src/gtk/tbargtk.cpp b/src/gtk/tbargtk.cpp
deleted file mode 100644 (file)
index 5a675ea..0000000
+++ /dev/null
@@ -1,754 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name:        src/gtk/tbargtk.cpp
-// Purpose:     GTK toolbar
-// Author:      Robert Roebling
-// Modified:    13.12.99 by VZ to derive from wxToolBarBase
-// RCS-ID:      $Id$
-// Copyright:   (c) Robert Roebling
-// Licence:     wxWindows licence
-/////////////////////////////////////////////////////////////////////////////
-
-// For compilers that support precompilation, includes "wx.h".
-#include "wx/wxprec.h"
-
-#if wxUSE_TOOLBAR_NATIVE
-
-#include "wx/toolbar.h"
-
-#include "wx/gtk/private.h"
-
-// ----------------------------------------------------------------------------
-// globals
-// ----------------------------------------------------------------------------
-
-// data
-extern bool       g_blockEventsOnDrag;
-extern wxCursor   g_globalCursor;
-
-// ----------------------------------------------------------------------------
-// wxToolBarTool
-// ----------------------------------------------------------------------------
-
-class wxToolBarTool : public wxToolBarToolBase
-{
-public:
-    wxToolBarTool(wxToolBar *tbar,
-                  int id,
-                  const wxString& label,
-                  const wxBitmap& bitmap1,
-                  const wxBitmap& bitmap2,
-                  wxItemKind kind,
-                  wxObject *clientData,
-                  const wxString& shortHelpString,
-                  const wxString& longHelpString)
-        : wxToolBarToolBase(tbar, id, label, bitmap1, bitmap2, kind,
-                            clientData, shortHelpString, longHelpString)
-    {
-        m_item = NULL;
-    }
-
-    wxToolBarTool(wxToolBar *tbar, wxControl *control, const wxString& label)
-        : wxToolBarToolBase(tbar, control, label)
-    {
-        m_item = NULL;
-    }
-
-    void SetImage();
-    void CreateDropDown();
-    void ShowDropdown(GtkToggleButton* button);
-
-    GtkToolItem* m_item;
-};
-
-// ----------------------------------------------------------------------------
-// wxWin macros
-// ----------------------------------------------------------------------------
-
-IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxControl)
-
-// ============================================================================
-// implementation
-// ============================================================================
-
-//-----------------------------------------------------------------------------
-// "clicked" from m_item
-//-----------------------------------------------------------------------------
-
-extern "C" {
-static void item_clicked(GtkToolButton*, wxToolBarTool* tool)
-{
-    if (g_blockEventsOnDrag) return;
-
-    tool->GetToolBar()->OnLeftClick(tool->GetId(), false);
-}
-}
-
-//-----------------------------------------------------------------------------
-// "toggled" from m_item
-//-----------------------------------------------------------------------------
-
-extern "C" {
-static void item_toggled(GtkToggleToolButton* button, wxToolBarTool* tool)
-{
-    if (g_blockEventsOnDrag) return;
-
-    const bool active = gtk_toggle_tool_button_get_active(button) != 0;
-    tool->Toggle(active);
-    if (!active && tool->GetKind() == wxITEM_RADIO)
-        return;
-
-    if (!tool->GetToolBar()->OnLeftClick(tool->GetId(), active))
-    {
-        // revert back
-        tool->Toggle();
-    }
-}
-}
-
-//-----------------------------------------------------------------------------
-// "button_press_event" from m_item child
-//-----------------------------------------------------------------------------
-
-extern "C" {
-static gboolean
-button_press_event(GtkWidget*, GdkEventButton* event, wxToolBarTool* tool)
-{
-    if (event->button != 3)
-        return FALSE;
-
-    if (g_blockEventsOnDrag) return TRUE;
-
-    tool->GetToolBar()->OnRightClick(
-        tool->GetId(), int(event->x), int(event->y));
-
-    return TRUE;
-}
-}
-
-//-----------------------------------------------------------------------------
-// "child_detached" from m_widget
-//-----------------------------------------------------------------------------
-
-extern "C" {
-static void child_detached(GtkWidget*, GtkToolbar* toolbar, void*)
-{
-    // disable showing overflow arrow when toolbar is detached,
-    // otherwise toolbar collapses to just an arrow
-    gtk_toolbar_set_show_arrow(toolbar, false);
-}
-}
-
-//-----------------------------------------------------------------------------
-// "child_attached" from m_widget
-//-----------------------------------------------------------------------------
-
-extern "C" {
-static void child_attached(GtkWidget*, GtkToolbar* toolbar, void*)
-{
-    gtk_toolbar_set_show_arrow(toolbar, true);
-}
-}
-
-//-----------------------------------------------------------------------------
-// "enter_notify_event" / "leave_notify_event" from m_item
-//-----------------------------------------------------------------------------
-
-extern "C" {
-static gboolean
-enter_notify_event(GtkWidget*, GdkEventCrossing* event, wxToolBarTool* tool)
-{
-    if (g_blockEventsOnDrag) return TRUE;
-
-    int id = -1;
-    if (event->type == GDK_ENTER_NOTIFY)
-        id = tool->GetId();
-    tool->GetToolBar()->OnMouseEnter(id);
-
-    return FALSE;
-}
-}
-
-//-----------------------------------------------------------------------------
-// "size_request" from m_toolbar
-//-----------------------------------------------------------------------------
-
-extern "C" {
-static void
-size_request(GtkWidget*, GtkRequisition* req, wxToolBar* win)
-{
-    const wxSize margins = win->GetMargins();
-    req->width  += margins.x;
-    req->height += 2 * margins.y;
-}
-}
-
-//-----------------------------------------------------------------------------
-// "expose_event" from GtkImage inside m_item
-//-----------------------------------------------------------------------------
-
-extern "C" {
-static gboolean
-image_expose_event(GtkWidget* widget, GdkEventExpose*, wxToolBarTool* tool)
-{
-    const wxBitmap& bitmap = tool->GetDisabledBitmap();
-    if (tool->IsEnabled() || !bitmap.IsOk())
-        return false;
-
-    // draw disabled bitmap ourselves, GtkImage has no way to specify it
-    const GtkAllocation& alloc = widget->allocation;
-    gdk_draw_pixbuf(
-        widget->window, widget->style->black_gc, bitmap.GetPixbuf(),
-        0, 0,
-        alloc.x + (alloc.width - widget->requisition.width) / 2,
-        alloc.y + (alloc.height - widget->requisition.height) / 2,
-        -1, -1, GDK_RGB_DITHER_NORMAL, 0, 0);
-    return true;
-}
-}
-
-//-----------------------------------------------------------------------------
-// "toggled" from dropdown menu button
-//-----------------------------------------------------------------------------
-
-extern "C" {
-static void arrow_toggled(GtkToggleButton* button, wxToolBarTool* tool)
-{
-    if (gtk_toggle_button_get_active(button))
-    {
-        tool->ShowDropdown(button);
-        gtk_toggle_button_set_active(button, false);
-    }
-}
-}
-
-//-----------------------------------------------------------------------------
-// "button_press_event" from dropdown menu button
-//-----------------------------------------------------------------------------
-
-extern "C" {
-static gboolean
-arrow_button_press_event(GtkToggleButton* button, GdkEventButton* event, wxToolBarTool* tool)
-{
-    if (event->button == 1)
-    {
-        g_signal_handlers_block_by_func(button, (void*)arrow_toggled, tool);
-        gtk_toggle_button_set_active(button, true);
-        tool->ShowDropdown(button);
-        gtk_toggle_button_set_active(button, false);
-        g_signal_handlers_unblock_by_func(button, (void*)arrow_toggled, tool);
-        return true;
-    }
-    return false;
-}
-}
-
-void wxToolBar::AddChildGTK(wxWindowGTK* child)
-{
-    GtkWidget* align = gtk_alignment_new(0.5, 0.5, 0, 0);
-    gtk_widget_show(align);
-    gtk_container_add(GTK_CONTAINER(align), child->m_widget);
-    GtkToolItem* item = gtk_tool_item_new();
-    gtk_container_add(GTK_CONTAINER(item), align);
-    // position will be corrected in DoInsertTool if necessary
-    gtk_toolbar_insert(GTK_TOOLBAR(GTK_BIN(m_widget)->child), item, -1);
-}
-
-// ----------------------------------------------------------------------------
-// wxToolBarTool
-// ----------------------------------------------------------------------------
-
-void wxToolBarTool::SetImage()
-{
-    const wxBitmap& bitmap = GetNormalBitmap();
-    wxCHECK_RET(bitmap.IsOk(), "invalid bitmap for wxToolBar icon");
-
-    GtkWidget* image = gtk_tool_button_get_icon_widget(GTK_TOOL_BUTTON(m_item));
-    // always use pixbuf, because pixmap mask does not
-    // work with disabled images in some themes
-    gtk_image_set_from_pixbuf(GTK_IMAGE(image), bitmap.GetPixbuf());
-}
-
-// helper to create a dropdown menu item
-void wxToolBarTool::CreateDropDown()
-{
-    gtk_tool_item_set_homogeneous(m_item, false);
-    GtkWidget* box;
-    GtkWidget* arrow;
-    if (GetToolBar()->HasFlag(wxTB_LEFT | wxTB_RIGHT))
-    {
-        box = gtk_vbox_new(false, 0);
-        arrow = gtk_arrow_new(GTK_ARROW_RIGHT, GTK_SHADOW_NONE);
-    }
-    else
-    {
-        box = gtk_hbox_new(false, 0);
-        arrow = gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_NONE);
-    }
-    GtkWidget* tool_button = GTK_BIN(m_item)->child;
-    gtk_widget_reparent(tool_button, box);
-    GtkWidget* arrow_button = gtk_toggle_button_new();
-    gtk_button_set_relief(GTK_BUTTON(arrow_button),
-        gtk_tool_item_get_relief_style(GTK_TOOL_ITEM(m_item)));
-    gtk_container_add(GTK_CONTAINER(arrow_button), arrow);
-    gtk_container_add(GTK_CONTAINER(box), arrow_button);
-    gtk_widget_show_all(box);
-    gtk_container_add(GTK_CONTAINER(m_item), box);
-
-    g_signal_connect(arrow_button, "toggled", G_CALLBACK(arrow_toggled), this);
-    g_signal_connect(arrow_button, "button_press_event",
-        G_CALLBACK(arrow_button_press_event), this);
-}
-
-void wxToolBarTool::ShowDropdown(GtkToggleButton* button)
-{
-    wxToolBarBase* toolbar = GetToolBar();
-    wxCommandEvent event(wxEVT_COMMAND_TOOL_DROPDOWN_CLICKED, GetId());
-    if (!toolbar->HandleWindowEvent(event))
-    {
-        wxMenu* menu = GetDropdownMenu();
-        if (menu)
-        {
-            const GtkAllocation& alloc = GTK_WIDGET(button)->allocation;
-            int x = alloc.x;
-            int y = alloc.y;
-            if (toolbar->HasFlag(wxTB_LEFT | wxTB_RIGHT))
-                x += alloc.width;
-            else
-                y += alloc.height;
-            toolbar->PopupMenu(menu, x, y);
-        }
-    }
-}
-
-wxToolBarToolBase *wxToolBar::CreateTool(int id,
-                                         const wxString& text,
-                                         const wxBitmap& bitmap1,
-                                         const wxBitmap& bitmap2,
-                                         wxItemKind kind,
-                                         wxObject *clientData,
-                                         const wxString& shortHelpString,
-                                         const wxString& longHelpString)
-{
-    return new wxToolBarTool(this, id, text, bitmap1, bitmap2, kind,
-                             clientData, shortHelpString, longHelpString);
-}
-
-wxToolBarToolBase *
-wxToolBar::CreateTool(wxControl *control, const wxString& label)
-{
-    return new wxToolBarTool(this, control, label);
-}
-
-//-----------------------------------------------------------------------------
-// wxToolBar construction
-//-----------------------------------------------------------------------------
-
-void wxToolBar::Init()
-{
-    m_toolbar = NULL;
-    m_tooltips = NULL;
-}
-
-wxToolBar::~wxToolBar()
-{
-    if (m_tooltips)
-    {
-        gtk_object_destroy(GTK_OBJECT(m_tooltips));
-        g_object_unref(m_tooltips);
-    }
-}
-
-bool wxToolBar::Create( wxWindow *parent,
-                        wxWindowID id,
-                        const wxPoint& pos,
-                        const wxSize& size,
-                        long style,
-                        const wxString& name )
-{
-    if ( !PreCreation( parent, pos, size ) ||
-         !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
-    {
-        wxFAIL_MSG( wxT("wxToolBar creation failed") );
-
-        return false;
-    }
-
-    FixupStyle();
-
-    m_toolbar = GTK_TOOLBAR( gtk_toolbar_new() );
-    m_tooltips = gtk_tooltips_new();
-    g_object_ref(m_tooltips);
-    gtk_object_sink(GTK_OBJECT(m_tooltips));
-    GtkSetStyle();
-
-    if (style & wxTB_DOCKABLE)
-    {
-        m_widget = gtk_handle_box_new();
-
-        g_signal_connect(m_widget, "child_detached",
-            G_CALLBACK(child_detached), NULL);
-        g_signal_connect(m_widget, "child_attached",
-            G_CALLBACK(child_attached), NULL);
-
-        if (style & wxTB_FLAT)
-            gtk_handle_box_set_shadow_type( GTK_HANDLE_BOX(m_widget), GTK_SHADOW_NONE );
-    }
-    else
-    {
-        m_widget = gtk_event_box_new();
-        ConnectWidget( m_widget );
-    }
-    g_object_ref(m_widget);
-    gtk_container_add(GTK_CONTAINER(m_widget), GTK_WIDGET(m_toolbar));
-    gtk_widget_show(GTK_WIDGET(m_toolbar));
-
-    m_parent->DoAddChild( this );
-
-    PostCreation(size);
-
-    g_signal_connect_after(m_toolbar, "size_request",
-        G_CALLBACK(size_request), this);
-
-    return true;
-}
-
-GdkWindow *wxToolBar::GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const
-{
-    return GTK_WIDGET(m_toolbar)->window;
-}
-
-void wxToolBar::GtkSetStyle()
-{
-    GtkOrientation orient = GTK_ORIENTATION_HORIZONTAL;
-    if (HasFlag(wxTB_LEFT | wxTB_RIGHT))
-        orient = GTK_ORIENTATION_VERTICAL;
-
-    GtkToolbarStyle style = GTK_TOOLBAR_ICONS;
-    if (HasFlag(wxTB_NOICONS))
-        style = GTK_TOOLBAR_TEXT;
-    else if (HasFlag(wxTB_TEXT))
-    {
-        style = GTK_TOOLBAR_BOTH;
-        if (HasFlag(wxTB_HORZ_LAYOUT))
-            style = GTK_TOOLBAR_BOTH_HORIZ;
-    }
-
-    gtk_toolbar_set_orientation(m_toolbar, orient);
-    gtk_toolbar_set_style(m_toolbar, style);
-}
-
-void wxToolBar::SetWindowStyleFlag( long style )
-{
-    wxToolBarBase::SetWindowStyleFlag(style);
-
-    if ( m_toolbar )
-        GtkSetStyle();
-}
-
-bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
-{
-    wxToolBarTool* tool = static_cast<wxToolBarTool*>(toolBase);
-
-    GSList* radioGroup;
-    switch ( tool->GetStyle() )
-    {
-        case wxTOOL_STYLE_BUTTON:
-            switch (tool->GetKind())
-            {
-                case wxITEM_CHECK:
-                    tool->m_item = gtk_toggle_tool_button_new();
-                    g_signal_connect(tool->m_item, "toggled",
-                        G_CALLBACK(item_toggled), tool);
-                    break;
-                case wxITEM_RADIO:
-                    radioGroup = GetRadioGroup(pos);
-                    if (radioGroup)
-                    {
-                        // this is the first button in the radio button group,
-                        // it will be toggled automatically by GTK so bring the
-                        // internal flag in sync
-                        tool->Toggle(true);
-                    }
-                    tool->m_item = gtk_radio_tool_button_new(radioGroup);
-                    g_signal_connect(tool->m_item, "toggled",
-                        G_CALLBACK(item_toggled), tool);
-                    break;
-                default:
-                    wxFAIL_MSG("unknown toolbar child type");
-                    // fall through
-                case wxITEM_DROPDOWN:
-                case wxITEM_NORMAL:
-                    tool->m_item = gtk_tool_button_new(NULL, "");
-                    g_signal_connect(tool->m_item, "clicked",
-                        G_CALLBACK(item_clicked), tool);
-                    break;
-            }
-            if (!HasFlag(wxTB_NOICONS))
-            {
-                GtkWidget* image = gtk_image_new();
-                gtk_tool_button_set_icon_widget(
-                    GTK_TOOL_BUTTON(tool->m_item), image);
-                tool->SetImage();
-                gtk_widget_show(image);
-                g_signal_connect(image, "expose_event",
-                    G_CALLBACK(image_expose_event), tool);
-            }
-            if (!tool->GetLabel().empty())
-            {
-                gtk_tool_button_set_label(
-                    GTK_TOOL_BUTTON(tool->m_item), wxGTK_CONV(tool->GetLabel()));
-                // needed for labels in horizontal toolbar with wxTB_HORZ_LAYOUT
-                gtk_tool_item_set_is_important(tool->m_item, true);
-            }
-            if (!HasFlag(wxTB_NO_TOOLTIPS) && !tool->GetShortHelp().empty())
-            {
-                gtk_tool_item_set_tooltip(tool->m_item,
-                    m_tooltips, wxGTK_CONV(tool->GetShortHelp()), "");
-            }
-            g_signal_connect(GTK_BIN(tool->m_item)->child, "button_press_event",
-                G_CALLBACK(button_press_event), tool);
-            g_signal_connect(tool->m_item, "enter_notify_event",
-                G_CALLBACK(enter_notify_event), tool);
-            g_signal_connect(tool->m_item, "leave_notify_event",
-                G_CALLBACK(enter_notify_event), tool);
-
-            if (tool->GetKind() == wxITEM_DROPDOWN)
-                tool->CreateDropDown();
-            gtk_toolbar_insert(m_toolbar, tool->m_item, int(pos));
-            break;
-
-        case wxTOOL_STYLE_SEPARATOR:
-            tool->m_item = gtk_separator_tool_item_new();
-            gtk_toolbar_insert(m_toolbar, tool->m_item, int(pos));
-            break;
-
-        case wxTOOL_STYLE_CONTROL:
-            wxWindow* control = tool->GetControl();
-            if (control->m_widget->parent == NULL)
-                AddChildGTK(control);
-            tool->m_item = GTK_TOOL_ITEM(control->m_widget->parent->parent);
-            if (gtk_toolbar_get_item_index(m_toolbar, tool->m_item) != int(pos))
-            {
-                g_object_ref(tool->m_item);
-                gtk_container_remove(
-                    GTK_CONTAINER(m_toolbar), GTK_WIDGET(tool->m_item));
-                gtk_toolbar_insert(m_toolbar, tool->m_item, int(pos));
-                g_object_unref(tool->m_item);
-            }
-            // Inserted items "slide" into place using an animated effect that
-            // causes multiple size events on the item. Must set size request
-            // to keep item size from getting permanently set too small by the
-            // first of these size events.
-            const wxSize size = control->GetSize();
-            gtk_widget_set_size_request(control->m_widget, size.x, size.y);
-            break;
-    }
-    gtk_widget_show(GTK_WIDGET(tool->m_item));
-
-    InvalidateBestSize();
-
-    return true;
-}
-
-bool wxToolBar::DoDeleteTool(size_t /* pos */, wxToolBarToolBase* toolBase)
-{
-    wxToolBarTool* tool = static_cast<wxToolBarTool*>(toolBase);
-
-    if (tool->GetStyle() == wxTOOL_STYLE_CONTROL)
-    {
-        // don't destroy the control here as we can be called from
-        // RemoveTool() and then we need to keep the control alive;
-        // while if we're called from DeleteTool() the control will
-        // be destroyed when wxToolBarToolBase itself is deleted
-        GtkWidget* widget = tool->GetControl()->m_widget;
-        gtk_container_remove(GTK_CONTAINER(widget->parent), widget);
-    }
-    gtk_object_destroy(GTK_OBJECT(tool->m_item));
-    tool->m_item = NULL;
-
-    InvalidateBestSize();
-    return true;
-}
-
-GSList* wxToolBar::GetRadioGroup(size_t pos)
-{
-    GSList* radioGroup = NULL;
-    GtkToolItem* item = NULL;
-    if (pos > 0)
-    {
-        item = gtk_toolbar_get_nth_item(m_toolbar, int(pos) - 1);
-        if (!GTK_IS_RADIO_TOOL_BUTTON(item))
-            item = NULL;
-    }
-    if (item == NULL && pos < m_tools.size())
-    {
-        item = gtk_toolbar_get_nth_item(m_toolbar, int(pos));
-        if (!GTK_IS_RADIO_TOOL_BUTTON(item))
-            item = NULL;
-    }
-    if (item)
-        radioGroup = gtk_radio_tool_button_get_group((GtkRadioToolButton*)item);
-    return radioGroup;
-}
-
-// ----------------------------------------------------------------------------
-// wxToolBar tools state
-// ----------------------------------------------------------------------------
-
-void wxToolBar::DoEnableTool(wxToolBarToolBase *toolBase, bool enable)
-{
-    wxToolBarTool* tool = static_cast<wxToolBarTool*>(toolBase);
-
-    if (tool->m_item)
-        gtk_widget_set_sensitive(GTK_WIDGET(tool->m_item), enable);
-}
-
-void wxToolBar::DoToggleTool( wxToolBarToolBase *toolBase, bool toggle )
-{
-    wxToolBarTool* tool = static_cast<wxToolBarTool*>(toolBase);
-
-    if (tool->m_item)
-    {
-        g_signal_handlers_block_by_func(tool->m_item, (void*)item_toggled, tool);
-
-        gtk_toggle_tool_button_set_active(
-            GTK_TOGGLE_TOOL_BUTTON(tool->m_item), toggle);
-
-        g_signal_handlers_unblock_by_func(tool->m_item, (void*)item_toggled, tool);
-    }
-}
-
-void wxToolBar::DoSetToggle(wxToolBarToolBase * WXUNUSED(tool),
-                            bool WXUNUSED(toggle))
-{
-    // VZ: absolutely no idea about how to do it
-    wxFAIL_MSG( wxT("not implemented") );
-}
-
-// ----------------------------------------------------------------------------
-// wxToolBar geometry
-// ----------------------------------------------------------------------------
-
-wxSize wxToolBar::DoGetBestSize() const
-{
-    // Unfortunately, if overflow arrow is enabled GtkToolbar only reports size
-    // of arrow. To get the real size, the arrow is temporarily disabled here.
-    // This is gross, since it will cause a queue_resize, and could potentially
-    // lead to an infinite loop. But there seems to be no alternative, short of
-    // disabling the arrow entirely.
-    gtk_toolbar_set_show_arrow(m_toolbar, false);
-    const wxSize size = wxToolBarBase::DoGetBestSize();
-    gtk_toolbar_set_show_arrow(m_toolbar, true);
-    return size;
-}
-
-wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord WXUNUSED(x),
-                                                  wxCoord WXUNUSED(y)) const
-{
-    // VZ: GTK+ doesn't seem to have such thing
-    wxFAIL_MSG( wxT("wxToolBar::FindToolForPosition() not implemented") );
-
-    return NULL;
-}
-
-void wxToolBar::SetToolShortHelp( int id, const wxString& helpString )
-{
-    wxToolBarTool* tool = static_cast<wxToolBarTool*>(FindById(id));
-
-    if ( tool )
-    {
-        (void)tool->SetShortHelp(helpString);
-        if (tool->m_item)
-        {
-            gtk_tool_item_set_tooltip(tool->m_item,
-                m_tooltips, wxGTK_CONV(helpString), "");
-        }
-    }
-}
-
-void wxToolBar::SetToolNormalBitmap( int id, const wxBitmap& bitmap )
-{
-    wxToolBarTool* tool = static_cast<wxToolBarTool*>(FindById(id));
-    if ( tool )
-    {
-        wxCHECK_RET( tool->IsButton(), wxT("Can only set bitmap on button tools."));
-
-        tool->SetNormalBitmap(bitmap);
-        tool->SetImage();
-    }
-}
-
-void wxToolBar::SetToolDisabledBitmap( int id, const wxBitmap& bitmap )
-{
-    wxToolBarTool* tool = static_cast<wxToolBarTool*>(FindById(id));
-    if ( tool )
-    {
-        wxCHECK_RET( tool->IsButton(), wxT("Can only set bitmap on button tools."));
-
-        tool->SetDisabledBitmap(bitmap);
-    }
-}
-
-// ----------------------------------------------------------------------------
-// wxToolBar idle handling
-// ----------------------------------------------------------------------------
-
-void wxToolBar::OnInternalIdle()
-{
-    // Check if we have to show window now
-    if (GTKShowFromOnIdle()) return;
-
-    wxCursor cursor = m_cursor;
-    if (g_globalCursor.Ok()) cursor = g_globalCursor;
-
-    if (cursor.Ok())
-    {
-        /* I now set the cursor the anew in every OnInternalIdle call
-           as setting the cursor in a parent window also effects the
-           windows above so that checking for the current cursor is
-           not possible. */
-
-        if (HasFlag(wxTB_DOCKABLE) && (m_widget->window))
-        {
-            /* if the toolbar is dockable, then m_widget stands for the
-               GtkHandleBox widget, which uses its own window so that we
-               can set the cursor for it. if the toolbar is not dockable,
-               m_widget comes from m_toolbar which uses its parent's
-               window ("windowless windows") and thus we cannot set the
-               cursor. */
-            gdk_window_set_cursor( m_widget->window, cursor.GetCursor() );
-        }
-
-        wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
-        while ( node )
-        {
-            wxToolBarTool *tool = (wxToolBarTool *)node->GetData();
-            node = node->GetNext();
-
-            if (tool->m_item)
-            {
-                GdkWindow* window = GTK_WIDGET(tool->m_item)->window;
-
-                if ( window )
-                {
-                    gdk_window_set_cursor( window, cursor.GetCursor() );
-                }
-            }
-        }
-    }
-
-    if (wxUpdateUIEvent::CanUpdate(this) && IsShownOnScreen())
-        UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
-}
-
-
-// ----------------------------------------------------------------------------
-
-// static
-wxVisualAttributes
-wxToolBar::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
-{
-    return GetDefaultAttributesFromGTKWidget(gtk_toolbar_new);
-}
-
-#endif // wxUSE_TOOLBAR_NATIVE
diff --git a/src/gtk/toolbar.cpp b/src/gtk/toolbar.cpp
new file mode 100644 (file)
index 0000000..701ec64
--- /dev/null
@@ -0,0 +1,754 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        src/gtk/toolbar.cpp
+// Purpose:     GTK toolbar
+// Author:      Robert Roebling
+// Modified:    13.12.99 by VZ to derive from wxToolBarBase
+// RCS-ID:      $Id$
+// Copyright:   (c) Robert Roebling
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#if wxUSE_TOOLBAR_NATIVE
+
+#include "wx/toolbar.h"
+
+#include "wx/gtk/private.h"
+
+// ----------------------------------------------------------------------------
+// globals
+// ----------------------------------------------------------------------------
+
+// data
+extern bool       g_blockEventsOnDrag;
+extern wxCursor   g_globalCursor;
+
+// ----------------------------------------------------------------------------
+// wxToolBarTool
+// ----------------------------------------------------------------------------
+
+class wxToolBarTool : public wxToolBarToolBase
+{
+public:
+    wxToolBarTool(wxToolBar *tbar,
+                  int id,
+                  const wxString& label,
+                  const wxBitmap& bitmap1,
+                  const wxBitmap& bitmap2,
+                  wxItemKind kind,
+                  wxObject *clientData,
+                  const wxString& shortHelpString,
+                  const wxString& longHelpString)
+        : wxToolBarToolBase(tbar, id, label, bitmap1, bitmap2, kind,
+                            clientData, shortHelpString, longHelpString)
+    {
+        m_item = NULL;
+    }
+
+    wxToolBarTool(wxToolBar *tbar, wxControl *control, const wxString& label)
+        : wxToolBarToolBase(tbar, control, label)
+    {
+        m_item = NULL;
+    }
+
+    void SetImage();
+    void CreateDropDown();
+    void ShowDropdown(GtkToggleButton* button);
+
+    GtkToolItem* m_item;
+};
+
+// ----------------------------------------------------------------------------
+// wxWin macros
+// ----------------------------------------------------------------------------
+
+IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxControl)
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+//-----------------------------------------------------------------------------
+// "clicked" from m_item
+//-----------------------------------------------------------------------------
+
+extern "C" {
+static void item_clicked(GtkToolButton*, wxToolBarTool* tool)
+{
+    if (g_blockEventsOnDrag) return;
+
+    tool->GetToolBar()->OnLeftClick(tool->GetId(), false);
+}
+}
+
+//-----------------------------------------------------------------------------
+// "toggled" from m_item
+//-----------------------------------------------------------------------------
+
+extern "C" {
+static void item_toggled(GtkToggleToolButton* button, wxToolBarTool* tool)
+{
+    if (g_blockEventsOnDrag) return;
+
+    const bool active = gtk_toggle_tool_button_get_active(button) != 0;
+    tool->Toggle(active);
+    if (!active && tool->GetKind() == wxITEM_RADIO)
+        return;
+
+    if (!tool->GetToolBar()->OnLeftClick(tool->GetId(), active))
+    {
+        // revert back
+        tool->Toggle();
+    }
+}
+}
+
+//-----------------------------------------------------------------------------
+// "button_press_event" from m_item child
+//-----------------------------------------------------------------------------
+
+extern "C" {
+static gboolean
+button_press_event(GtkWidget*, GdkEventButton* event, wxToolBarTool* tool)
+{
+    if (event->button != 3)
+        return FALSE;
+
+    if (g_blockEventsOnDrag) return TRUE;
+
+    tool->GetToolBar()->OnRightClick(
+        tool->GetId(), int(event->x), int(event->y));
+
+    return TRUE;
+}
+}
+
+//-----------------------------------------------------------------------------
+// "child_detached" from m_widget
+//-----------------------------------------------------------------------------
+
+extern "C" {
+static void child_detached(GtkWidget*, GtkToolbar* toolbar, void*)
+{
+    // disable showing overflow arrow when toolbar is detached,
+    // otherwise toolbar collapses to just an arrow
+    gtk_toolbar_set_show_arrow(toolbar, false);
+}
+}
+
+//-----------------------------------------------------------------------------
+// "child_attached" from m_widget
+//-----------------------------------------------------------------------------
+
+extern "C" {
+static void child_attached(GtkWidget*, GtkToolbar* toolbar, void*)
+{
+    gtk_toolbar_set_show_arrow(toolbar, true);
+}
+}
+
+//-----------------------------------------------------------------------------
+// "enter_notify_event" / "leave_notify_event" from m_item
+//-----------------------------------------------------------------------------
+
+extern "C" {
+static gboolean
+enter_notify_event(GtkWidget*, GdkEventCrossing* event, wxToolBarTool* tool)
+{
+    if (g_blockEventsOnDrag) return TRUE;
+
+    int id = -1;
+    if (event->type == GDK_ENTER_NOTIFY)
+        id = tool->GetId();
+    tool->GetToolBar()->OnMouseEnter(id);
+
+    return FALSE;
+}
+}
+
+//-----------------------------------------------------------------------------
+// "size_request" from m_toolbar
+//-----------------------------------------------------------------------------
+
+extern "C" {
+static void
+size_request(GtkWidget*, GtkRequisition* req, wxToolBar* win)
+{
+    const wxSize margins = win->GetMargins();
+    req->width  += margins.x;
+    req->height += 2 * margins.y;
+}
+}
+
+//-----------------------------------------------------------------------------
+// "expose_event" from GtkImage inside m_item
+//-----------------------------------------------------------------------------
+
+extern "C" {
+static gboolean
+image_expose_event(GtkWidget* widget, GdkEventExpose*, wxToolBarTool* tool)
+{
+    const wxBitmap& bitmap = tool->GetDisabledBitmap();
+    if (tool->IsEnabled() || !bitmap.IsOk())
+        return false;
+
+    // draw disabled bitmap ourselves, GtkImage has no way to specify it
+    const GtkAllocation& alloc = widget->allocation;
+    gdk_draw_pixbuf(
+        widget->window, widget->style->black_gc, bitmap.GetPixbuf(),
+        0, 0,
+        alloc.x + (alloc.width - widget->requisition.width) / 2,
+        alloc.y + (alloc.height - widget->requisition.height) / 2,
+        -1, -1, GDK_RGB_DITHER_NORMAL, 0, 0);
+    return true;
+}
+}
+
+//-----------------------------------------------------------------------------
+// "toggled" from dropdown menu button
+//-----------------------------------------------------------------------------
+
+extern "C" {
+static void arrow_toggled(GtkToggleButton* button, wxToolBarTool* tool)
+{
+    if (gtk_toggle_button_get_active(button))
+    {
+        tool->ShowDropdown(button);
+        gtk_toggle_button_set_active(button, false);
+    }
+}
+}
+
+//-----------------------------------------------------------------------------
+// "button_press_event" from dropdown menu button
+//-----------------------------------------------------------------------------
+
+extern "C" {
+static gboolean
+arrow_button_press_event(GtkToggleButton* button, GdkEventButton* event, wxToolBarTool* tool)
+{
+    if (event->button == 1)
+    {
+        g_signal_handlers_block_by_func(button, (void*)arrow_toggled, tool);
+        gtk_toggle_button_set_active(button, true);
+        tool->ShowDropdown(button);
+        gtk_toggle_button_set_active(button, false);
+        g_signal_handlers_unblock_by_func(button, (void*)arrow_toggled, tool);
+        return true;
+    }
+    return false;
+}
+}
+
+void wxToolBar::AddChildGTK(wxWindowGTK* child)
+{
+    GtkWidget* align = gtk_alignment_new(0.5, 0.5, 0, 0);
+    gtk_widget_show(align);
+    gtk_container_add(GTK_CONTAINER(align), child->m_widget);
+    GtkToolItem* item = gtk_tool_item_new();
+    gtk_container_add(GTK_CONTAINER(item), align);
+    // position will be corrected in DoInsertTool if necessary
+    gtk_toolbar_insert(GTK_TOOLBAR(GTK_BIN(m_widget)->child), item, -1);
+}
+
+// ----------------------------------------------------------------------------
+// wxToolBarTool
+// ----------------------------------------------------------------------------
+
+void wxToolBarTool::SetImage()
+{
+    const wxBitmap& bitmap = GetNormalBitmap();
+    wxCHECK_RET(bitmap.IsOk(), "invalid bitmap for wxToolBar icon");
+
+    GtkWidget* image = gtk_tool_button_get_icon_widget(GTK_TOOL_BUTTON(m_item));
+    // always use pixbuf, because pixmap mask does not
+    // work with disabled images in some themes
+    gtk_image_set_from_pixbuf(GTK_IMAGE(image), bitmap.GetPixbuf());
+}
+
+// helper to create a dropdown menu item
+void wxToolBarTool::CreateDropDown()
+{
+    gtk_tool_item_set_homogeneous(m_item, false);
+    GtkWidget* box;
+    GtkWidget* arrow;
+    if (GetToolBar()->HasFlag(wxTB_LEFT | wxTB_RIGHT))
+    {
+        box = gtk_vbox_new(false, 0);
+        arrow = gtk_arrow_new(GTK_ARROW_RIGHT, GTK_SHADOW_NONE);
+    }
+    else
+    {
+        box = gtk_hbox_new(false, 0);
+        arrow = gtk_arrow_new(GTK_ARROW_DOWN, GTK_SHADOW_NONE);
+    }
+    GtkWidget* tool_button = GTK_BIN(m_item)->child;
+    gtk_widget_reparent(tool_button, box);
+    GtkWidget* arrow_button = gtk_toggle_button_new();
+    gtk_button_set_relief(GTK_BUTTON(arrow_button),
+        gtk_tool_item_get_relief_style(GTK_TOOL_ITEM(m_item)));
+    gtk_container_add(GTK_CONTAINER(arrow_button), arrow);
+    gtk_container_add(GTK_CONTAINER(box), arrow_button);
+    gtk_widget_show_all(box);
+    gtk_container_add(GTK_CONTAINER(m_item), box);
+
+    g_signal_connect(arrow_button, "toggled", G_CALLBACK(arrow_toggled), this);
+    g_signal_connect(arrow_button, "button_press_event",
+        G_CALLBACK(arrow_button_press_event), this);
+}
+
+void wxToolBarTool::ShowDropdown(GtkToggleButton* button)
+{
+    wxToolBarBase* toolbar = GetToolBar();
+    wxCommandEvent event(wxEVT_COMMAND_TOOL_DROPDOWN_CLICKED, GetId());
+    if (!toolbar->HandleWindowEvent(event))
+    {
+        wxMenu* menu = GetDropdownMenu();
+        if (menu)
+        {
+            const GtkAllocation& alloc = GTK_WIDGET(button)->allocation;
+            int x = alloc.x;
+            int y = alloc.y;
+            if (toolbar->HasFlag(wxTB_LEFT | wxTB_RIGHT))
+                x += alloc.width;
+            else
+                y += alloc.height;
+            toolbar->PopupMenu(menu, x, y);
+        }
+    }
+}
+
+wxToolBarToolBase *wxToolBar::CreateTool(int id,
+                                         const wxString& text,
+                                         const wxBitmap& bitmap1,
+                                         const wxBitmap& bitmap2,
+                                         wxItemKind kind,
+                                         wxObject *clientData,
+                                         const wxString& shortHelpString,
+                                         const wxString& longHelpString)
+{
+    return new wxToolBarTool(this, id, text, bitmap1, bitmap2, kind,
+                             clientData, shortHelpString, longHelpString);
+}
+
+wxToolBarToolBase *
+wxToolBar::CreateTool(wxControl *control, const wxString& label)
+{
+    return new wxToolBarTool(this, control, label);
+}
+
+//-----------------------------------------------------------------------------
+// wxToolBar construction
+//-----------------------------------------------------------------------------
+
+void wxToolBar::Init()
+{
+    m_toolbar = NULL;
+    m_tooltips = NULL;
+}
+
+wxToolBar::~wxToolBar()
+{
+    if (m_tooltips)
+    {
+        gtk_object_destroy(GTK_OBJECT(m_tooltips));
+        g_object_unref(m_tooltips);
+    }
+}
+
+bool wxToolBar::Create( wxWindow *parent,
+                        wxWindowID id,
+                        const wxPoint& pos,
+                        const wxSize& size,
+                        long style,
+                        const wxString& name )
+{
+    if ( !PreCreation( parent, pos, size ) ||
+         !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
+    {
+        wxFAIL_MSG( wxT("wxToolBar creation failed") );
+
+        return false;
+    }
+
+    FixupStyle();
+
+    m_toolbar = GTK_TOOLBAR( gtk_toolbar_new() );
+    m_tooltips = gtk_tooltips_new();
+    g_object_ref(m_tooltips);
+    gtk_object_sink(GTK_OBJECT(m_tooltips));
+    GtkSetStyle();
+
+    if (style & wxTB_DOCKABLE)
+    {
+        m_widget = gtk_handle_box_new();
+
+        g_signal_connect(m_widget, "child_detached",
+            G_CALLBACK(child_detached), NULL);
+        g_signal_connect(m_widget, "child_attached",
+            G_CALLBACK(child_attached), NULL);
+
+        if (style & wxTB_FLAT)
+            gtk_handle_box_set_shadow_type( GTK_HANDLE_BOX(m_widget), GTK_SHADOW_NONE );
+    }
+    else
+    {
+        m_widget = gtk_event_box_new();
+        ConnectWidget( m_widget );
+    }
+    g_object_ref(m_widget);
+    gtk_container_add(GTK_CONTAINER(m_widget), GTK_WIDGET(m_toolbar));
+    gtk_widget_show(GTK_WIDGET(m_toolbar));
+
+    m_parent->DoAddChild( this );
+
+    PostCreation(size);
+
+    g_signal_connect_after(m_toolbar, "size_request",
+        G_CALLBACK(size_request), this);
+
+    return true;
+}
+
+GdkWindow *wxToolBar::GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const
+{
+    return GTK_WIDGET(m_toolbar)->window;
+}
+
+void wxToolBar::GtkSetStyle()
+{
+    GtkOrientation orient = GTK_ORIENTATION_HORIZONTAL;
+    if (HasFlag(wxTB_LEFT | wxTB_RIGHT))
+        orient = GTK_ORIENTATION_VERTICAL;
+
+    GtkToolbarStyle style = GTK_TOOLBAR_ICONS;
+    if (HasFlag(wxTB_NOICONS))
+        style = GTK_TOOLBAR_TEXT;
+    else if (HasFlag(wxTB_TEXT))
+    {
+        style = GTK_TOOLBAR_BOTH;
+        if (HasFlag(wxTB_HORZ_LAYOUT))
+            style = GTK_TOOLBAR_BOTH_HORIZ;
+    }
+
+    gtk_toolbar_set_orientation(m_toolbar, orient);
+    gtk_toolbar_set_style(m_toolbar, style);
+}
+
+void wxToolBar::SetWindowStyleFlag( long style )
+{
+    wxToolBarBase::SetWindowStyleFlag(style);
+
+    if ( m_toolbar )
+        GtkSetStyle();
+}
+
+bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
+{
+    wxToolBarTool* tool = static_cast<wxToolBarTool*>(toolBase);
+
+    GSList* radioGroup;
+    switch ( tool->GetStyle() )
+    {
+        case wxTOOL_STYLE_BUTTON:
+            switch (tool->GetKind())
+            {
+                case wxITEM_CHECK:
+                    tool->m_item = gtk_toggle_tool_button_new();
+                    g_signal_connect(tool->m_item, "toggled",
+                        G_CALLBACK(item_toggled), tool);
+                    break;
+                case wxITEM_RADIO:
+                    radioGroup = GetRadioGroup(pos);
+                    if (radioGroup)
+                    {
+                        // this is the first button in the radio button group,
+                        // it will be toggled automatically by GTK so bring the
+                        // internal flag in sync
+                        tool->Toggle(true);
+                    }
+                    tool->m_item = gtk_radio_tool_button_new(radioGroup);
+                    g_signal_connect(tool->m_item, "toggled",
+                        G_CALLBACK(item_toggled), tool);
+                    break;
+                default:
+                    wxFAIL_MSG("unknown toolbar child type");
+                    // fall through
+                case wxITEM_DROPDOWN:
+                case wxITEM_NORMAL:
+                    tool->m_item = gtk_tool_button_new(NULL, "");
+                    g_signal_connect(tool->m_item, "clicked",
+                        G_CALLBACK(item_clicked), tool);
+                    break;
+            }
+            if (!HasFlag(wxTB_NOICONS))
+            {
+                GtkWidget* image = gtk_image_new();
+                gtk_tool_button_set_icon_widget(
+                    GTK_TOOL_BUTTON(tool->m_item), image);
+                tool->SetImage();
+                gtk_widget_show(image);
+                g_signal_connect(image, "expose_event",
+                    G_CALLBACK(image_expose_event), tool);
+            }
+            if (!tool->GetLabel().empty())
+            {
+                gtk_tool_button_set_label(
+                    GTK_TOOL_BUTTON(tool->m_item), wxGTK_CONV(tool->GetLabel()));
+                // needed for labels in horizontal toolbar with wxTB_HORZ_LAYOUT
+                gtk_tool_item_set_is_important(tool->m_item, true);
+            }
+            if (!HasFlag(wxTB_NO_TOOLTIPS) && !tool->GetShortHelp().empty())
+            {
+                gtk_tool_item_set_tooltip(tool->m_item,
+                    m_tooltips, wxGTK_CONV(tool->GetShortHelp()), "");
+            }
+            g_signal_connect(GTK_BIN(tool->m_item)->child, "button_press_event",
+                G_CALLBACK(button_press_event), tool);
+            g_signal_connect(tool->m_item, "enter_notify_event",
+                G_CALLBACK(enter_notify_event), tool);
+            g_signal_connect(tool->m_item, "leave_notify_event",
+                G_CALLBACK(enter_notify_event), tool);
+
+            if (tool->GetKind() == wxITEM_DROPDOWN)
+                tool->CreateDropDown();
+            gtk_toolbar_insert(m_toolbar, tool->m_item, int(pos));
+            break;
+
+        case wxTOOL_STYLE_SEPARATOR:
+            tool->m_item = gtk_separator_tool_item_new();
+            gtk_toolbar_insert(m_toolbar, tool->m_item, int(pos));
+            break;
+
+        case wxTOOL_STYLE_CONTROL:
+            wxWindow* control = tool->GetControl();
+            if (control->m_widget->parent == NULL)
+                AddChildGTK(control);
+            tool->m_item = GTK_TOOL_ITEM(control->m_widget->parent->parent);
+            if (gtk_toolbar_get_item_index(m_toolbar, tool->m_item) != int(pos))
+            {
+                g_object_ref(tool->m_item);
+                gtk_container_remove(
+                    GTK_CONTAINER(m_toolbar), GTK_WIDGET(tool->m_item));
+                gtk_toolbar_insert(m_toolbar, tool->m_item, int(pos));
+                g_object_unref(tool->m_item);
+            }
+            // Inserted items "slide" into place using an animated effect that
+            // causes multiple size events on the item. Must set size request
+            // to keep item size from getting permanently set too small by the
+            // first of these size events.
+            const wxSize size = control->GetSize();
+            gtk_widget_set_size_request(control->m_widget, size.x, size.y);
+            break;
+    }
+    gtk_widget_show(GTK_WIDGET(tool->m_item));
+
+    InvalidateBestSize();
+
+    return true;
+}
+
+bool wxToolBar::DoDeleteTool(size_t /* pos */, wxToolBarToolBase* toolBase)
+{
+    wxToolBarTool* tool = static_cast<wxToolBarTool*>(toolBase);
+
+    if (tool->GetStyle() == wxTOOL_STYLE_CONTROL)
+    {
+        // don't destroy the control here as we can be called from
+        // RemoveTool() and then we need to keep the control alive;
+        // while if we're called from DeleteTool() the control will
+        // be destroyed when wxToolBarToolBase itself is deleted
+        GtkWidget* widget = tool->GetControl()->m_widget;
+        gtk_container_remove(GTK_CONTAINER(widget->parent), widget);
+    }
+    gtk_object_destroy(GTK_OBJECT(tool->m_item));
+    tool->m_item = NULL;
+
+    InvalidateBestSize();
+    return true;
+}
+
+GSList* wxToolBar::GetRadioGroup(size_t pos)
+{
+    GSList* radioGroup = NULL;
+    GtkToolItem* item = NULL;
+    if (pos > 0)
+    {
+        item = gtk_toolbar_get_nth_item(m_toolbar, int(pos) - 1);
+        if (!GTK_IS_RADIO_TOOL_BUTTON(item))
+            item = NULL;
+    }
+    if (item == NULL && pos < m_tools.size())
+    {
+        item = gtk_toolbar_get_nth_item(m_toolbar, int(pos));
+        if (!GTK_IS_RADIO_TOOL_BUTTON(item))
+            item = NULL;
+    }
+    if (item)
+        radioGroup = gtk_radio_tool_button_get_group((GtkRadioToolButton*)item);
+    return radioGroup;
+}
+
+// ----------------------------------------------------------------------------
+// wxToolBar tools state
+// ----------------------------------------------------------------------------
+
+void wxToolBar::DoEnableTool(wxToolBarToolBase *toolBase, bool enable)
+{
+    wxToolBarTool* tool = static_cast<wxToolBarTool*>(toolBase);
+
+    if (tool->m_item)
+        gtk_widget_set_sensitive(GTK_WIDGET(tool->m_item), enable);
+}
+
+void wxToolBar::DoToggleTool( wxToolBarToolBase *toolBase, bool toggle )
+{
+    wxToolBarTool* tool = static_cast<wxToolBarTool*>(toolBase);
+
+    if (tool->m_item)
+    {
+        g_signal_handlers_block_by_func(tool->m_item, (void*)item_toggled, tool);
+
+        gtk_toggle_tool_button_set_active(
+            GTK_TOGGLE_TOOL_BUTTON(tool->m_item), toggle);
+
+        g_signal_handlers_unblock_by_func(tool->m_item, (void*)item_toggled, tool);
+    }
+}
+
+void wxToolBar::DoSetToggle(wxToolBarToolBase * WXUNUSED(tool),
+                            bool WXUNUSED(toggle))
+{
+    // VZ: absolutely no idea about how to do it
+    wxFAIL_MSG( wxT("not implemented") );
+}
+
+// ----------------------------------------------------------------------------
+// wxToolBar geometry
+// ----------------------------------------------------------------------------
+
+wxSize wxToolBar::DoGetBestSize() const
+{
+    // Unfortunately, if overflow arrow is enabled GtkToolbar only reports size
+    // of arrow. To get the real size, the arrow is temporarily disabled here.
+    // This is gross, since it will cause a queue_resize, and could potentially
+    // lead to an infinite loop. But there seems to be no alternative, short of
+    // disabling the arrow entirely.
+    gtk_toolbar_set_show_arrow(m_toolbar, false);
+    const wxSize size = wxToolBarBase::DoGetBestSize();
+    gtk_toolbar_set_show_arrow(m_toolbar, true);
+    return size;
+}
+
+wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord WXUNUSED(x),
+                                                  wxCoord WXUNUSED(y)) const
+{
+    // VZ: GTK+ doesn't seem to have such thing
+    wxFAIL_MSG( wxT("wxToolBar::FindToolForPosition() not implemented") );
+
+    return NULL;
+}
+
+void wxToolBar::SetToolShortHelp( int id, const wxString& helpString )
+{
+    wxToolBarTool* tool = static_cast<wxToolBarTool*>(FindById(id));
+
+    if ( tool )
+    {
+        (void)tool->SetShortHelp(helpString);
+        if (tool->m_item)
+        {
+            gtk_tool_item_set_tooltip(tool->m_item,
+                m_tooltips, wxGTK_CONV(helpString), "");
+        }
+    }
+}
+
+void wxToolBar::SetToolNormalBitmap( int id, const wxBitmap& bitmap )
+{
+    wxToolBarTool* tool = static_cast<wxToolBarTool*>(FindById(id));
+    if ( tool )
+    {
+        wxCHECK_RET( tool->IsButton(), wxT("Can only set bitmap on button tools."));
+
+        tool->SetNormalBitmap(bitmap);
+        tool->SetImage();
+    }
+}
+
+void wxToolBar::SetToolDisabledBitmap( int id, const wxBitmap& bitmap )
+{
+    wxToolBarTool* tool = static_cast<wxToolBarTool*>(FindById(id));
+    if ( tool )
+    {
+        wxCHECK_RET( tool->IsButton(), wxT("Can only set bitmap on button tools."));
+
+        tool->SetDisabledBitmap(bitmap);
+    }
+}
+
+// ----------------------------------------------------------------------------
+// wxToolBar idle handling
+// ----------------------------------------------------------------------------
+
+void wxToolBar::OnInternalIdle()
+{
+    // Check if we have to show window now
+    if (GTKShowFromOnIdle()) return;
+
+    wxCursor cursor = m_cursor;
+    if (g_globalCursor.Ok()) cursor = g_globalCursor;
+
+    if (cursor.Ok())
+    {
+        /* I now set the cursor the anew in every OnInternalIdle call
+           as setting the cursor in a parent window also effects the
+           windows above so that checking for the current cursor is
+           not possible. */
+
+        if (HasFlag(wxTB_DOCKABLE) && (m_widget->window))
+        {
+            /* if the toolbar is dockable, then m_widget stands for the
+               GtkHandleBox widget, which uses its own window so that we
+               can set the cursor for it. if the toolbar is not dockable,
+               m_widget comes from m_toolbar which uses its parent's
+               window ("windowless windows") and thus we cannot set the
+               cursor. */
+            gdk_window_set_cursor( m_widget->window, cursor.GetCursor() );
+        }
+
+        wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
+        while ( node )
+        {
+            wxToolBarTool *tool = (wxToolBarTool *)node->GetData();
+            node = node->GetNext();
+
+            if (tool->m_item)
+            {
+                GdkWindow* window = GTK_WIDGET(tool->m_item)->window;
+
+                if ( window )
+                {
+                    gdk_window_set_cursor( window, cursor.GetCursor() );
+                }
+            }
+        }
+    }
+
+    if (wxUpdateUIEvent::CanUpdate(this) && IsShownOnScreen())
+        UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
+}
+
+
+// ----------------------------------------------------------------------------
+
+// static
+wxVisualAttributes
+wxToolBar::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
+{
+    return GetDefaultAttributesFromGTKWidget(gtk_toolbar_new);
+}
+
+#endif // wxUSE_TOOLBAR_NATIVE
index beab0a9eedab816cc523ea22c9081055e5b3b2c9..b0c323cbad83a53c7b4f886fe8eb2cfd1f034f96 100644 (file)
@@ -87,7 +87,7 @@ OBJECTS0= \
        statbox.obj,\
        statline.obj,\
        stattext.obj,\
        statbox.obj,\
        statline.obj,\
        stattext.obj,\
-       tbargtk.obj,\
+       toolbar.obj,\
        textctrl.obj,\
        tglbtn.obj,\
        msgdlg.obj
        textctrl.obj,\
        tglbtn.obj,\
        msgdlg.obj
@@ -145,7 +145,7 @@ SOURCES =\
        statbox.cpp,\
        statline.cpp,\
        stattext.cpp,\
        statbox.cpp,\
        statline.cpp,\
        stattext.cpp,\
-       tbargtk.cpp,\
+       toolbar.cpp,\
        textctrl.cpp,\
        tglbtn.cpp,\
        timer.cpp,\
        textctrl.cpp,\
        tglbtn.cpp,\
        timer.cpp,\
@@ -220,7 +220,7 @@ statbmp.obj : statbmp.cpp
 statbox.obj : statbox.cpp
 statline.obj : statline.cpp
 stattext.obj : stattext.cpp
 statbox.obj : statbox.cpp
 statline.obj : statline.cpp
 stattext.obj : stattext.cpp
-tbargtk.obj : tbargtk.cpp
+toolbar.obj : toolbar.cpp
 textctrl.obj : textctrl.cpp
 tglbtn.obj : tglbtn.cpp
 timer.obj : timer.cpp
 textctrl.obj : textctrl.cpp
 tglbtn.obj : tglbtn.cpp
 timer.obj : timer.cpp
index 176dde8d1579d553155c2b2fb88e02fd8412967e..9970976eff9d4b89f28c0cd6220d279836345964 100644 (file)
@@ -668,7 +668,7 @@ void wxFont::DoSetNativeFontInfo( const wxNativeFontInfo& info )
 
 static GdkFont *g_systemDefaultGuiFont = NULL;
 
 
 static GdkFont *g_systemDefaultGuiFont = NULL;
 
-// this is also used from tbargtk.cpp and tooltip.cpp, hence extern
+// this is also used from toolbar.cpp and tooltip.cpp, hence extern
 extern GdkFont *GtkGetDefaultGuiFont()
 {
     if (!g_systemDefaultGuiFont)
 extern GdkFont *GtkGetDefaultGuiFont()
 {
     if (!g_systemDefaultGuiFont)
diff --git a/src/gtk1/tbargtk.cpp b/src/gtk1/tbargtk.cpp
deleted file mode 100644 (file)
index be2f5ff..0000000
+++ /dev/null
@@ -1,657 +0,0 @@
-/////////////////////////////////////////////////////////////////////////////
-// Name:        src/gtk1/tbargtk.cpp
-// Purpose:     GTK toolbar
-// Author:      Robert Roebling
-// Modified:    13.12.99 by VZ to derive from wxToolBarBase
-// RCS-ID:      $Id$
-// Copyright:   (c) Robert Roebling
-// Licence:     wxWindows licence
-/////////////////////////////////////////////////////////////////////////////
-
-// ============================================================================
-// declarations
-// ============================================================================
-
-// ----------------------------------------------------------------------------
-// headers
-// ----------------------------------------------------------------------------
-
-// For compilers that support precompilation, includes "wx.h".
-#include "wx/wxprec.h"
-
-#if wxUSE_TOOLBAR_NATIVE
-
-#include "wx/toolbar.h"
-
-#ifndef WX_PRECOMP
-    #include "wx/frame.h"
-#endif
-
-#include <glib.h>
-#include "wx/gtk1/private.h"
-
-// ----------------------------------------------------------------------------
-// globals
-// ----------------------------------------------------------------------------
-
-// idle system
-extern void wxapp_install_idle_handler();
-extern bool g_isIdle;
-
-// data
-extern bool       g_blockEventsOnDrag;
-extern wxCursor   g_globalCursor;
-
-// ----------------------------------------------------------------------------
-// private functions
-// ----------------------------------------------------------------------------
-
-// translate wxWidgets toolbar style flags to GTK orientation and style
-static void GetGtkStyle(long style,
-                        GtkOrientation *orient, GtkToolbarStyle *gtkStyle)
-{
-    *orient = style & wxTB_VERTICAL ? GTK_ORIENTATION_VERTICAL
-                                    : GTK_ORIENTATION_HORIZONTAL;
-
-
-    if ( style & wxTB_TEXT )
-    {
-        *gtkStyle = style & wxTB_NOICONS
-                        ? GTK_TOOLBAR_TEXT
-                        : GTK_TOOLBAR_BOTH;
-    }
-    else // no text, hence we must have the icons or what would we show?
-    {
-        *gtkStyle = GTK_TOOLBAR_ICONS;
-    }
-}
-
-// ----------------------------------------------------------------------------
-// wxToolBarTool
-// ----------------------------------------------------------------------------
-
-class wxToolBarTool : public wxToolBarToolBase
-{
-public:
-    wxToolBarTool(wxToolBar *tbar,
-                  int id,
-                  const wxString& label,
-                  const wxBitmap& bitmap1,
-                  const wxBitmap& bitmap2,
-                  wxItemKind kind,
-                  wxObject *clientData,
-                  const wxString& shortHelpString,
-                  const wxString& longHelpString)
-        : wxToolBarToolBase(tbar, id, label, bitmap1, bitmap2, kind,
-                            clientData, shortHelpString, longHelpString)
-    {
-        Init();
-    }
-
-    wxToolBarTool(wxToolBar *tbar, wxControl *control, const wxString& label)
-        : wxToolBarToolBase(tbar, control, label)
-    {
-        Init();
-    }
-
-    // is this a radio button?
-    //
-    // unlike GetKind(), can be called for any kind of tools, not just buttons
-    bool IsRadio() const { return IsButton() && GetKind() == wxITEM_RADIO; }
-
-    // this is only called for the normal buttons, i.e. not separators nor
-    // controls
-    GtkToolbarChildType GetGtkChildType() const
-    {
-        switch ( GetKind() )
-        {
-            case wxITEM_CHECK:
-                return GTK_TOOLBAR_CHILD_TOGGLEBUTTON;
-
-            case wxITEM_RADIO:
-                return GTK_TOOLBAR_CHILD_RADIOBUTTON;
-
-            default:
-                wxFAIL_MSG( wxT("unknown toolbar child type") );
-                // fall through
-
-            case wxITEM_NORMAL:
-                return GTK_TOOLBAR_CHILD_BUTTON;
-        }
-    }
-
-    void SetPixmap(const wxBitmap& bitmap)
-    {
-        if (bitmap.Ok())
-        {
-            GdkBitmap *mask = bitmap.GetMask() ? bitmap.GetMask()->GetBitmap()
-                                               : NULL;
-            gtk_pixmap_set( GTK_PIXMAP(m_pixmap), bitmap.GetPixmap(), mask );
-        }
-    }
-
-    GtkWidget            *m_item;
-    GtkWidget            *m_pixmap;
-
-protected:
-    void Init();
-};
-
-// ----------------------------------------------------------------------------
-// wxWin macros
-// ----------------------------------------------------------------------------
-
-IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxControl)
-
-// ============================================================================
-// implementation
-// ============================================================================
-
-//-----------------------------------------------------------------------------
-// "clicked" (internal from gtk_toolbar)
-//-----------------------------------------------------------------------------
-
-extern "C" {
-static void gtk_toolbar_callback( GtkWidget *WXUNUSED(widget),
-                                  wxToolBarTool *tool )
-{
-    if (g_isIdle)
-        wxapp_install_idle_handler();
-
-    wxToolBar *tbar = (wxToolBar *)tool->GetToolBar();
-
-    if (tbar->m_blockEvent) return;
-
-    if (g_blockEventsOnDrag) return;
-    if (!tool->IsEnabled()) return;
-
-    if (tool->CanBeToggled())
-    {
-        tool->Toggle();
-
-        tool->SetPixmap(tool->GetBitmap());
-
-        if ( tool->IsRadio() && !tool->IsToggled() )
-        {
-            // radio button went up, don't report this as a wxWin event
-            return;
-        }
-    }
-
-    if( !tbar->OnLeftClick( tool->GetId(), tool->IsToggled() ) && tool->CanBeToggled() )
-    {
-        // revert back
-        tool->Toggle();
-
-        tool->SetPixmap(tool->GetBitmap());
-    }
-}
-}
-
-//-----------------------------------------------------------------------------
-// "enter_notify_event" / "leave_notify_event"
-//-----------------------------------------------------------------------------
-
-extern "C" {
-static gint gtk_toolbar_tool_callback( GtkWidget *WXUNUSED(widget),
-                                       GdkEventCrossing *gdk_event,
-                                       wxToolBarTool *tool )
-{
-    if (g_isIdle) wxapp_install_idle_handler();
-
-    if (g_blockEventsOnDrag) return TRUE;
-
-    wxToolBar *tb = (wxToolBar *)tool->GetToolBar();
-
-    // emit the event
-    if( gdk_event->type == GDK_ENTER_NOTIFY )
-        tb->OnMouseEnter( tool->GetId() );
-    else
-        tb->OnMouseEnter( -1 );
-
-    return FALSE;
-}
-}
-
-//-----------------------------------------------------------------------------
-// InsertChild callback for wxToolBar
-//-----------------------------------------------------------------------------
-
-static void wxInsertChildInToolBar( wxToolBar* WXUNUSED(parent),
-                                    wxWindow* WXUNUSED(child) )
-{
-    // we don't do anything here
-}
-
-// ----------------------------------------------------------------------------
-// wxToolBarTool
-// ----------------------------------------------------------------------------
-
-void wxToolBarTool::Init()
-{
-    m_item =
-    m_pixmap = NULL;
-}
-
-wxToolBarToolBase *wxToolBar::CreateTool(int id,
-                                         const wxString& text,
-                                         const wxBitmap& bitmap1,
-                                         const wxBitmap& bitmap2,
-                                         wxItemKind kind,
-                                         wxObject *clientData,
-                                         const wxString& shortHelpString,
-                                         const wxString& longHelpString)
-{
-    return new wxToolBarTool(this, id, text, bitmap1, bitmap2, kind,
-                             clientData, shortHelpString, longHelpString);
-}
-
-wxToolBarToolBase *
-wxToolBar::CreateTool(wxControl *control, const wxString& label)
-{
-    return new wxToolBarTool(this, control, label);
-}
-
-//-----------------------------------------------------------------------------
-// wxToolBar construction
-//-----------------------------------------------------------------------------
-
-void wxToolBar::Init()
-{
-    m_toolbar = NULL;
-    m_blockEvent = false;
-    m_defaultWidth = 32;
-    m_defaultHeight = 32;
-}
-
-wxToolBar::~wxToolBar()
-{
-}
-
-bool wxToolBar::Create( wxWindow *parent,
-                        wxWindowID id,
-                        const wxPoint& pos,
-                        const wxSize& size,
-                        long style,
-                        const wxString& name )
-{
-    m_needParent = true;
-    m_insertCallback = (wxInsertChildFunction)wxInsertChildInToolBar;
-
-    if ( !PreCreation( parent, pos, size ) ||
-         !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
-    {
-        wxFAIL_MSG( wxT("wxToolBar creation failed") );
-
-        return false;
-    }
-
-    FixupStyle();
-
-    GtkOrientation orient;
-    GtkToolbarStyle gtkStyle;
-    GetGtkStyle(style, &orient, &gtkStyle);
-
-    m_toolbar = GTK_TOOLBAR( gtk_toolbar_new(orient, gtkStyle) );
-
-    SetToolSeparation(7);
-
-    if (style & wxTB_DOCKABLE)
-    {
-        m_widget = gtk_handle_box_new();
-        gtk_container_add( GTK_CONTAINER(m_widget), GTK_WIDGET(m_toolbar) );
-        gtk_widget_show( GTK_WIDGET(m_toolbar) );
-
-        if (style & wxTB_FLAT)
-            gtk_handle_box_set_shadow_type( GTK_HANDLE_BOX(m_widget), GTK_SHADOW_NONE );
-    }
-    else
-    {
-        m_widget = gtk_event_box_new();
-        gtk_container_add( GTK_CONTAINER(m_widget), GTK_WIDGET(m_toolbar) );
-        ConnectWidget( m_widget );
-        gtk_widget_show(GTK_WIDGET(m_toolbar));
-    }
-
-    gtk_toolbar_set_tooltips( GTK_TOOLBAR(m_toolbar), TRUE );
-
-    if (style & wxTB_FLAT)
-        gtk_toolbar_set_button_relief( GTK_TOOLBAR(m_toolbar), GTK_RELIEF_NONE );
-
-    m_parent->DoAddChild( this );
-
-    PostCreation(size);
-
-    return true;
-}
-
-void wxToolBar::GtkSetStyle()
-{
-    GtkOrientation orient;
-    GtkToolbarStyle style;
-    GetGtkStyle(GetWindowStyle(), &orient, &style);
-
-    gtk_toolbar_set_orientation(m_toolbar, orient);
-    gtk_toolbar_set_style(m_toolbar, style);
-}
-
-void wxToolBar::SetWindowStyleFlag( long style )
-{
-    wxToolBarBase::SetWindowStyleFlag(style);
-
-    if ( m_toolbar )
-        GtkSetStyle();
-}
-
-bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
-{
-    wxToolBarTool *tool = (wxToolBarTool *)toolBase;
-
-    // if we have inserted a space before all the tools we must change the GTK
-    // index by 1
-    size_t posGtk = m_xMargin > 1 ? pos + 1 : pos;
-
-    if ( tool->IsButton() )
-    {
-        if ( !HasFlag(wxTB_NOICONS) )
-        {
-            wxBitmap bitmap = tool->GetNormalBitmap();
-
-            wxCHECK_MSG( bitmap.Ok(), false,
-                         wxT("invalid bitmap for wxToolBar icon") );
-
-            wxCHECK_MSG( bitmap.GetBitmap() == NULL, false,
-                         wxT("wxToolBar doesn't support GdkBitmap") );
-
-            wxCHECK_MSG( bitmap.GetPixmap() != NULL, false,
-                         wxT("wxToolBar::Add needs a wxBitmap") );
-
-            GtkWidget *tool_pixmap = NULL;
-
-            GdkPixmap *pixmap = bitmap.GetPixmap();
-
-            GdkBitmap *mask = NULL;
-            if ( bitmap.GetMask() )
-                mask = bitmap.GetMask()->GetBitmap();
-
-            tool_pixmap = gtk_pixmap_new( pixmap, mask );
-            gtk_pixmap_set_build_insensitive( GTK_PIXMAP(tool_pixmap), TRUE );
-
-            gtk_misc_set_alignment( GTK_MISC(tool_pixmap), 0.5, 0.5 );
-
-            tool->m_pixmap = tool_pixmap;
-        }
-    }
-
-    switch ( tool->GetStyle() )
-    {
-        case wxTOOL_STYLE_BUTTON:
-            // for a radio button we need the widget which starts the radio
-            // group it belongs to, i.e. the first radio button immediately
-            // preceding this one
-            {
-                GtkWidget *widget = NULL;
-
-                if ( tool->IsRadio() )
-                {
-                    wxToolBarToolsList::compatibility_iterator node
-                        = wxToolBarToolsList::compatibility_iterator();
-                    if ( pos )
-                        node = m_tools.Item(pos - 1);
-
-                    while ( node )
-                    {
-                        wxToolBarTool *toolNext = (wxToolBarTool *)node->GetData();
-                        if ( !toolNext->IsRadio() )
-                            break;
-
-                        widget = toolNext->m_item;
-
-                        node = node->GetPrevious();
-                    }
-
-                    if ( !widget )
-                    {
-                        // this is the first button in the radio button group,
-                        // it will be toggled automatically by GTK so bring the
-                        // internal flag in sync
-                        tool->Toggle(true);
-                    }
-                }
-
-                tool->m_item = gtk_toolbar_insert_element
-                               (
-                                  m_toolbar,
-                                  tool->GetGtkChildType(),
-                                  widget,
-                                  tool->GetLabel().empty()
-                                    ? NULL
-                                    : (const char*) wxGTK_CONV( tool->GetLabel() ),
-                                  tool->GetShortHelp().empty()
-                                    ? NULL
-                                    : (const char*) wxGTK_CONV( tool->GetShortHelp() ),
-                                  "", // tooltip_private_text (?)
-                                  tool->m_pixmap,
-                                  (GtkSignalFunc)gtk_toolbar_callback,
-                                  (gpointer)tool,
-                                  posGtk
-                               );
-
-                if ( !tool->m_item )
-                {
-                    wxFAIL_MSG( wxT("gtk_toolbar_insert_element() failed") );
-
-                    return false;
-                }
-
-                gtk_signal_connect( GTK_OBJECT(tool->m_item),
-                                    "enter_notify_event",
-                                    GTK_SIGNAL_FUNC(gtk_toolbar_tool_callback),
-                                    (gpointer)tool );
-                gtk_signal_connect( GTK_OBJECT(tool->m_item),
-                                    "leave_notify_event",
-                                    GTK_SIGNAL_FUNC(gtk_toolbar_tool_callback),
-                                    (gpointer)tool );
-            }
-            break;
-
-        case wxTOOL_STYLE_SEPARATOR:
-            gtk_toolbar_insert_space( m_toolbar, posGtk );
-
-            // skip the rest
-            return true;
-
-        case wxTOOL_STYLE_CONTROL:
-            gtk_toolbar_insert_widget(
-                                       m_toolbar,
-                                       tool->GetControl()->m_widget,
-                                       (const char *) NULL,
-                                       (const char *) NULL,
-                                       posGtk
-                                      );
-            break;
-    }
-
-    GtkRequisition req;
-    (* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(m_widget) )->size_request )
-        (m_widget, &req );
-    m_width = req.width + m_xMargin;
-    m_height = req.height + 2*m_yMargin;
-    InvalidateBestSize();
-
-    return true;
-}
-
-bool wxToolBar::DoDeleteTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolBase)
-{
-    wxToolBarTool *tool = (wxToolBarTool *)toolBase;
-
-    switch ( tool->GetStyle() )
-    {
-        case wxTOOL_STYLE_CONTROL:
-            // don't destroy the control here as we can be called from
-            // RemoveTool() and then we need to keep the control alive;
-            // while if we're called from DeleteTool() the control will
-            // be destroyed when wxToolBarToolBase itself is deleted
-            break;
-
-        case wxTOOL_STYLE_BUTTON:
-            gtk_widget_destroy( tool->m_item );
-            break;
-
-        default:
-            wxFAIL_MSG( "unknown tool style" );
-            return false;
-    }
-
-    InvalidateBestSize();
-    return true;
-}
-
-// ----------------------------------------------------------------------------
-// wxToolBar tools state
-// ----------------------------------------------------------------------------
-
-void wxToolBar::DoEnableTool(wxToolBarToolBase *toolBase, bool enable)
-{
-    wxToolBarTool *tool = (wxToolBarTool *)toolBase;
-
-    if (tool->m_item)
-    {
-        gtk_widget_set_sensitive( tool->m_item, enable );
-    }
-}
-
-void wxToolBar::DoToggleTool( wxToolBarToolBase *toolBase, bool toggle )
-{
-    wxToolBarTool *tool = (wxToolBarTool *)toolBase;
-
-    GtkWidget *item = tool->m_item;
-    if ( item && GTK_IS_TOGGLE_BUTTON(item) )
-    {
-        tool->SetPixmap(tool->GetBitmap());
-
-        m_blockEvent = true;
-
-        gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(item), toggle );
-
-        m_blockEvent = false;
-    }
-}
-
-void wxToolBar::DoSetToggle(wxToolBarToolBase * WXUNUSED(tool),
-                            bool WXUNUSED(toggle))
-{
-    // VZ: absolutely no idea about how to do it
-    wxFAIL_MSG( wxT("not implemented") );
-}
-
-// ----------------------------------------------------------------------------
-// wxToolBar geometry
-// ----------------------------------------------------------------------------
-
-wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord WXUNUSED(x),
-                                                  wxCoord WXUNUSED(y)) const
-{
-    // VZ: GTK+ doesn't seem to have such thing
-    wxFAIL_MSG( wxT("wxToolBar::FindToolForPosition() not implemented") );
-
-    return NULL;
-}
-
-void wxToolBar::SetMargins( int x, int y )
-{
-    wxCHECK_RET( GetToolsCount() == 0,
-                 wxT("wxToolBar::SetMargins must be called before adding tools.") );
-
-    if (x > 1)
-        gtk_toolbar_append_space( m_toolbar );  // oh well
-
-    m_xMargin = x;
-    m_yMargin = y;
-}
-
-void wxToolBar::SetToolSeparation( int separation )
-{
-    gtk_toolbar_set_space_size( m_toolbar, separation );
-
-    m_toolSeparation = separation;
-}
-
-void wxToolBar::SetToolShortHelp( int id, const wxString& helpString )
-{
-    wxToolBarTool *tool = (wxToolBarTool *)FindById(id);
-
-    if ( tool )
-    {
-        (void)tool->SetShortHelp(helpString);
-        gtk_tooltips_set_tip(m_toolbar->tooltips, tool->m_item,
-                             wxGTK_CONV( helpString ), "");
-    }
-}
-
-// ----------------------------------------------------------------------------
-// wxToolBar idle handling
-// ----------------------------------------------------------------------------
-
-void wxToolBar::OnInternalIdle()
-{
-    wxCursor cursor = m_cursor;
-    if (g_globalCursor.Ok()) cursor = g_globalCursor;
-
-    if (cursor.Ok())
-    {
-        /* I now set the cursor the anew in every OnInternalIdle call
-           as setting the cursor in a parent window also effects the
-           windows above so that checking for the current cursor is
-           not possible. */
-
-        if (HasFlag(wxTB_DOCKABLE) && (m_widget->window))
-        {
-            /* if the toolbar is dockable, then m_widget stands for the
-               GtkHandleBox widget, which uses its own window so that we
-               can set the cursor for it. if the toolbar is not dockable,
-               m_widget comes from m_toolbar which uses its parent's
-               window ("windowless windows") and thus we cannot set the
-               cursor. */
-            gdk_window_set_cursor( m_widget->window, cursor.GetCursor() );
-        }
-
-        wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
-        while ( node )
-        {
-            wxToolBarTool *tool = (wxToolBarTool *)node->GetData();
-            node = node->GetNext();
-
-            GtkWidget *item = tool->m_item;
-            if ( item )
-            {
-                GdkWindow *window = item->window;
-
-                if ( window )
-                {
-                    gdk_window_set_cursor( window, cursor.GetCursor() );
-                }
-            }
-        }
-    }
-
-    if (wxUpdateUIEvent::CanUpdate(this))
-        UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
-}
-
-
-// ----------------------------------------------------------------------------
-
-// static
-wxVisualAttributes
-wxToolBar::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
-{
-    wxVisualAttributes attr;
-    GtkWidget* widget = gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH);
-    attr = GetDefaultAttributesFromGTKWidget(widget);
-    gtk_widget_destroy(widget);
-    return attr;
-}
-
-#endif // wxUSE_TOOLBAR_NATIVE
diff --git a/src/gtk1/toolbar.cpp b/src/gtk1/toolbar.cpp
new file mode 100644 (file)
index 0000000..21ed937
--- /dev/null
@@ -0,0 +1,657 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        src/gtk1/toolbar.cpp
+// Purpose:     GTK toolbar
+// Author:      Robert Roebling
+// Modified:    13.12.99 by VZ to derive from wxToolBarBase
+// RCS-ID:      $Id$
+// Copyright:   (c) Robert Roebling
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#if wxUSE_TOOLBAR_NATIVE
+
+#include "wx/toolbar.h"
+
+#ifndef WX_PRECOMP
+    #include "wx/frame.h"
+#endif
+
+#include <glib.h>
+#include "wx/gtk1/private.h"
+
+// ----------------------------------------------------------------------------
+// globals
+// ----------------------------------------------------------------------------
+
+// idle system
+extern void wxapp_install_idle_handler();
+extern bool g_isIdle;
+
+// data
+extern bool       g_blockEventsOnDrag;
+extern wxCursor   g_globalCursor;
+
+// ----------------------------------------------------------------------------
+// private functions
+// ----------------------------------------------------------------------------
+
+// translate wxWidgets toolbar style flags to GTK orientation and style
+static void GetGtkStyle(long style,
+                        GtkOrientation *orient, GtkToolbarStyle *gtkStyle)
+{
+    *orient = style & wxTB_VERTICAL ? GTK_ORIENTATION_VERTICAL
+                                    : GTK_ORIENTATION_HORIZONTAL;
+
+
+    if ( style & wxTB_TEXT )
+    {
+        *gtkStyle = style & wxTB_NOICONS
+                        ? GTK_TOOLBAR_TEXT
+                        : GTK_TOOLBAR_BOTH;
+    }
+    else // no text, hence we must have the icons or what would we show?
+    {
+        *gtkStyle = GTK_TOOLBAR_ICONS;
+    }
+}
+
+// ----------------------------------------------------------------------------
+// wxToolBarTool
+// ----------------------------------------------------------------------------
+
+class wxToolBarTool : public wxToolBarToolBase
+{
+public:
+    wxToolBarTool(wxToolBar *tbar,
+                  int id,
+                  const wxString& label,
+                  const wxBitmap& bitmap1,
+                  const wxBitmap& bitmap2,
+                  wxItemKind kind,
+                  wxObject *clientData,
+                  const wxString& shortHelpString,
+                  const wxString& longHelpString)
+        : wxToolBarToolBase(tbar, id, label, bitmap1, bitmap2, kind,
+                            clientData, shortHelpString, longHelpString)
+    {
+        Init();
+    }
+
+    wxToolBarTool(wxToolBar *tbar, wxControl *control, const wxString& label)
+        : wxToolBarToolBase(tbar, control, label)
+    {
+        Init();
+    }
+
+    // is this a radio button?
+    //
+    // unlike GetKind(), can be called for any kind of tools, not just buttons
+    bool IsRadio() const { return IsButton() && GetKind() == wxITEM_RADIO; }
+
+    // this is only called for the normal buttons, i.e. not separators nor
+    // controls
+    GtkToolbarChildType GetGtkChildType() const
+    {
+        switch ( GetKind() )
+        {
+            case wxITEM_CHECK:
+                return GTK_TOOLBAR_CHILD_TOGGLEBUTTON;
+
+            case wxITEM_RADIO:
+                return GTK_TOOLBAR_CHILD_RADIOBUTTON;
+
+            default:
+                wxFAIL_MSG( wxT("unknown toolbar child type") );
+                // fall through
+
+            case wxITEM_NORMAL:
+                return GTK_TOOLBAR_CHILD_BUTTON;
+        }
+    }
+
+    void SetPixmap(const wxBitmap& bitmap)
+    {
+        if (bitmap.Ok())
+        {
+            GdkBitmap *mask = bitmap.GetMask() ? bitmap.GetMask()->GetBitmap()
+                                               : NULL;
+            gtk_pixmap_set( GTK_PIXMAP(m_pixmap), bitmap.GetPixmap(), mask );
+        }
+    }
+
+    GtkWidget            *m_item;
+    GtkWidget            *m_pixmap;
+
+protected:
+    void Init();
+};
+
+// ----------------------------------------------------------------------------
+// wxWin macros
+// ----------------------------------------------------------------------------
+
+IMPLEMENT_DYNAMIC_CLASS(wxToolBar, wxControl)
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+//-----------------------------------------------------------------------------
+// "clicked" (internal from gtk_toolbar)
+//-----------------------------------------------------------------------------
+
+extern "C" {
+static void gtk_toolbar_callback( GtkWidget *WXUNUSED(widget),
+                                  wxToolBarTool *tool )
+{
+    if (g_isIdle)
+        wxapp_install_idle_handler();
+
+    wxToolBar *tbar = (wxToolBar *)tool->GetToolBar();
+
+    if (tbar->m_blockEvent) return;
+
+    if (g_blockEventsOnDrag) return;
+    if (!tool->IsEnabled()) return;
+
+    if (tool->CanBeToggled())
+    {
+        tool->Toggle();
+
+        tool->SetPixmap(tool->GetBitmap());
+
+        if ( tool->IsRadio() && !tool->IsToggled() )
+        {
+            // radio button went up, don't report this as a wxWin event
+            return;
+        }
+    }
+
+    if( !tbar->OnLeftClick( tool->GetId(), tool->IsToggled() ) && tool->CanBeToggled() )
+    {
+        // revert back
+        tool->Toggle();
+
+        tool->SetPixmap(tool->GetBitmap());
+    }
+}
+}
+
+//-----------------------------------------------------------------------------
+// "enter_notify_event" / "leave_notify_event"
+//-----------------------------------------------------------------------------
+
+extern "C" {
+static gint gtk_toolbar_tool_callback( GtkWidget *WXUNUSED(widget),
+                                       GdkEventCrossing *gdk_event,
+                                       wxToolBarTool *tool )
+{
+    if (g_isIdle) wxapp_install_idle_handler();
+
+    if (g_blockEventsOnDrag) return TRUE;
+
+    wxToolBar *tb = (wxToolBar *)tool->GetToolBar();
+
+    // emit the event
+    if( gdk_event->type == GDK_ENTER_NOTIFY )
+        tb->OnMouseEnter( tool->GetId() );
+    else
+        tb->OnMouseEnter( -1 );
+
+    return FALSE;
+}
+}
+
+//-----------------------------------------------------------------------------
+// InsertChild callback for wxToolBar
+//-----------------------------------------------------------------------------
+
+static void wxInsertChildInToolBar( wxToolBar* WXUNUSED(parent),
+                                    wxWindow* WXUNUSED(child) )
+{
+    // we don't do anything here
+}
+
+// ----------------------------------------------------------------------------
+// wxToolBarTool
+// ----------------------------------------------------------------------------
+
+void wxToolBarTool::Init()
+{
+    m_item =
+    m_pixmap = NULL;
+}
+
+wxToolBarToolBase *wxToolBar::CreateTool(int id,
+                                         const wxString& text,
+                                         const wxBitmap& bitmap1,
+                                         const wxBitmap& bitmap2,
+                                         wxItemKind kind,
+                                         wxObject *clientData,
+                                         const wxString& shortHelpString,
+                                         const wxString& longHelpString)
+{
+    return new wxToolBarTool(this, id, text, bitmap1, bitmap2, kind,
+                             clientData, shortHelpString, longHelpString);
+}
+
+wxToolBarToolBase *
+wxToolBar::CreateTool(wxControl *control, const wxString& label)
+{
+    return new wxToolBarTool(this, control, label);
+}
+
+//-----------------------------------------------------------------------------
+// wxToolBar construction
+//-----------------------------------------------------------------------------
+
+void wxToolBar::Init()
+{
+    m_toolbar = NULL;
+    m_blockEvent = false;
+    m_defaultWidth = 32;
+    m_defaultHeight = 32;
+}
+
+wxToolBar::~wxToolBar()
+{
+}
+
+bool wxToolBar::Create( wxWindow *parent,
+                        wxWindowID id,
+                        const wxPoint& pos,
+                        const wxSize& size,
+                        long style,
+                        const wxString& name )
+{
+    m_needParent = true;
+    m_insertCallback = (wxInsertChildFunction)wxInsertChildInToolBar;
+
+    if ( !PreCreation( parent, pos, size ) ||
+         !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name ))
+    {
+        wxFAIL_MSG( wxT("wxToolBar creation failed") );
+
+        return false;
+    }
+
+    FixupStyle();
+
+    GtkOrientation orient;
+    GtkToolbarStyle gtkStyle;
+    GetGtkStyle(style, &orient, &gtkStyle);
+
+    m_toolbar = GTK_TOOLBAR( gtk_toolbar_new(orient, gtkStyle) );
+
+    SetToolSeparation(7);
+
+    if (style & wxTB_DOCKABLE)
+    {
+        m_widget = gtk_handle_box_new();
+        gtk_container_add( GTK_CONTAINER(m_widget), GTK_WIDGET(m_toolbar) );
+        gtk_widget_show( GTK_WIDGET(m_toolbar) );
+
+        if (style & wxTB_FLAT)
+            gtk_handle_box_set_shadow_type( GTK_HANDLE_BOX(m_widget), GTK_SHADOW_NONE );
+    }
+    else
+    {
+        m_widget = gtk_event_box_new();
+        gtk_container_add( GTK_CONTAINER(m_widget), GTK_WIDGET(m_toolbar) );
+        ConnectWidget( m_widget );
+        gtk_widget_show(GTK_WIDGET(m_toolbar));
+    }
+
+    gtk_toolbar_set_tooltips( GTK_TOOLBAR(m_toolbar), TRUE );
+
+    if (style & wxTB_FLAT)
+        gtk_toolbar_set_button_relief( GTK_TOOLBAR(m_toolbar), GTK_RELIEF_NONE );
+
+    m_parent->DoAddChild( this );
+
+    PostCreation(size);
+
+    return true;
+}
+
+void wxToolBar::GtkSetStyle()
+{
+    GtkOrientation orient;
+    GtkToolbarStyle style;
+    GetGtkStyle(GetWindowStyle(), &orient, &style);
+
+    gtk_toolbar_set_orientation(m_toolbar, orient);
+    gtk_toolbar_set_style(m_toolbar, style);
+}
+
+void wxToolBar::SetWindowStyleFlag( long style )
+{
+    wxToolBarBase::SetWindowStyleFlag(style);
+
+    if ( m_toolbar )
+        GtkSetStyle();
+}
+
+bool wxToolBar::DoInsertTool(size_t pos, wxToolBarToolBase *toolBase)
+{
+    wxToolBarTool *tool = (wxToolBarTool *)toolBase;
+
+    // if we have inserted a space before all the tools we must change the GTK
+    // index by 1
+    size_t posGtk = m_xMargin > 1 ? pos + 1 : pos;
+
+    if ( tool->IsButton() )
+    {
+        if ( !HasFlag(wxTB_NOICONS) )
+        {
+            wxBitmap bitmap = tool->GetNormalBitmap();
+
+            wxCHECK_MSG( bitmap.Ok(), false,
+                         wxT("invalid bitmap for wxToolBar icon") );
+
+            wxCHECK_MSG( bitmap.GetBitmap() == NULL, false,
+                         wxT("wxToolBar doesn't support GdkBitmap") );
+
+            wxCHECK_MSG( bitmap.GetPixmap() != NULL, false,
+                         wxT("wxToolBar::Add needs a wxBitmap") );
+
+            GtkWidget *tool_pixmap = NULL;
+
+            GdkPixmap *pixmap = bitmap.GetPixmap();
+
+            GdkBitmap *mask = NULL;
+            if ( bitmap.GetMask() )
+                mask = bitmap.GetMask()->GetBitmap();
+
+            tool_pixmap = gtk_pixmap_new( pixmap, mask );
+            gtk_pixmap_set_build_insensitive( GTK_PIXMAP(tool_pixmap), TRUE );
+
+            gtk_misc_set_alignment( GTK_MISC(tool_pixmap), 0.5, 0.5 );
+
+            tool->m_pixmap = tool_pixmap;
+        }
+    }
+
+    switch ( tool->GetStyle() )
+    {
+        case wxTOOL_STYLE_BUTTON:
+            // for a radio button we need the widget which starts the radio
+            // group it belongs to, i.e. the first radio button immediately
+            // preceding this one
+            {
+                GtkWidget *widget = NULL;
+
+                if ( tool->IsRadio() )
+                {
+                    wxToolBarToolsList::compatibility_iterator node
+                        = wxToolBarToolsList::compatibility_iterator();
+                    if ( pos )
+                        node = m_tools.Item(pos - 1);
+
+                    while ( node )
+                    {
+                        wxToolBarTool *toolNext = (wxToolBarTool *)node->GetData();
+                        if ( !toolNext->IsRadio() )
+                            break;
+
+                        widget = toolNext->m_item;
+
+                        node = node->GetPrevious();
+                    }
+
+                    if ( !widget )
+                    {
+                        // this is the first button in the radio button group,
+                        // it will be toggled automatically by GTK so bring the
+                        // internal flag in sync
+                        tool->Toggle(true);
+                    }
+                }
+
+                tool->m_item = gtk_toolbar_insert_element
+                               (
+                                  m_toolbar,
+                                  tool->GetGtkChildType(),
+                                  widget,
+                                  tool->GetLabel().empty()
+                                    ? NULL
+                                    : (const char*) wxGTK_CONV( tool->GetLabel() ),
+                                  tool->GetShortHelp().empty()
+                                    ? NULL
+                                    : (const char*) wxGTK_CONV( tool->GetShortHelp() ),
+                                  "", // tooltip_private_text (?)
+                                  tool->m_pixmap,
+                                  (GtkSignalFunc)gtk_toolbar_callback,
+                                  (gpointer)tool,
+                                  posGtk
+                               );
+
+                if ( !tool->m_item )
+                {
+                    wxFAIL_MSG( wxT("gtk_toolbar_insert_element() failed") );
+
+                    return false;
+                }
+
+                gtk_signal_connect( GTK_OBJECT(tool->m_item),
+                                    "enter_notify_event",
+                                    GTK_SIGNAL_FUNC(gtk_toolbar_tool_callback),
+                                    (gpointer)tool );
+                gtk_signal_connect( GTK_OBJECT(tool->m_item),
+                                    "leave_notify_event",
+                                    GTK_SIGNAL_FUNC(gtk_toolbar_tool_callback),
+                                    (gpointer)tool );
+            }
+            break;
+
+        case wxTOOL_STYLE_SEPARATOR:
+            gtk_toolbar_insert_space( m_toolbar, posGtk );
+
+            // skip the rest
+            return true;
+
+        case wxTOOL_STYLE_CONTROL:
+            gtk_toolbar_insert_widget(
+                                       m_toolbar,
+                                       tool->GetControl()->m_widget,
+                                       (const char *) NULL,
+                                       (const char *) NULL,
+                                       posGtk
+                                      );
+            break;
+    }
+
+    GtkRequisition req;
+    (* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(m_widget) )->size_request )
+        (m_widget, &req );
+    m_width = req.width + m_xMargin;
+    m_height = req.height + 2*m_yMargin;
+    InvalidateBestSize();
+
+    return true;
+}
+
+bool wxToolBar::DoDeleteTool(size_t WXUNUSED(pos), wxToolBarToolBase *toolBase)
+{
+    wxToolBarTool *tool = (wxToolBarTool *)toolBase;
+
+    switch ( tool->GetStyle() )
+    {
+        case wxTOOL_STYLE_CONTROL:
+            // don't destroy the control here as we can be called from
+            // RemoveTool() and then we need to keep the control alive;
+            // while if we're called from DeleteTool() the control will
+            // be destroyed when wxToolBarToolBase itself is deleted
+            break;
+
+        case wxTOOL_STYLE_BUTTON:
+            gtk_widget_destroy( tool->m_item );
+            break;
+
+        default:
+            wxFAIL_MSG( "unknown tool style" );
+            return false;
+    }
+
+    InvalidateBestSize();
+    return true;
+}
+
+// ----------------------------------------------------------------------------
+// wxToolBar tools state
+// ----------------------------------------------------------------------------
+
+void wxToolBar::DoEnableTool(wxToolBarToolBase *toolBase, bool enable)
+{
+    wxToolBarTool *tool = (wxToolBarTool *)toolBase;
+
+    if (tool->m_item)
+    {
+        gtk_widget_set_sensitive( tool->m_item, enable );
+    }
+}
+
+void wxToolBar::DoToggleTool( wxToolBarToolBase *toolBase, bool toggle )
+{
+    wxToolBarTool *tool = (wxToolBarTool *)toolBase;
+
+    GtkWidget *item = tool->m_item;
+    if ( item && GTK_IS_TOGGLE_BUTTON(item) )
+    {
+        tool->SetPixmap(tool->GetBitmap());
+
+        m_blockEvent = true;
+
+        gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(item), toggle );
+
+        m_blockEvent = false;
+    }
+}
+
+void wxToolBar::DoSetToggle(wxToolBarToolBase * WXUNUSED(tool),
+                            bool WXUNUSED(toggle))
+{
+    // VZ: absolutely no idea about how to do it
+    wxFAIL_MSG( wxT("not implemented") );
+}
+
+// ----------------------------------------------------------------------------
+// wxToolBar geometry
+// ----------------------------------------------------------------------------
+
+wxToolBarToolBase *wxToolBar::FindToolForPosition(wxCoord WXUNUSED(x),
+                                                  wxCoord WXUNUSED(y)) const
+{
+    // VZ: GTK+ doesn't seem to have such thing
+    wxFAIL_MSG( wxT("wxToolBar::FindToolForPosition() not implemented") );
+
+    return NULL;
+}
+
+void wxToolBar::SetMargins( int x, int y )
+{
+    wxCHECK_RET( GetToolsCount() == 0,
+                 wxT("wxToolBar::SetMargins must be called before adding tools.") );
+
+    if (x > 1)
+        gtk_toolbar_append_space( m_toolbar );  // oh well
+
+    m_xMargin = x;
+    m_yMargin = y;
+}
+
+void wxToolBar::SetToolSeparation( int separation )
+{
+    gtk_toolbar_set_space_size( m_toolbar, separation );
+
+    m_toolSeparation = separation;
+}
+
+void wxToolBar::SetToolShortHelp( int id, const wxString& helpString )
+{
+    wxToolBarTool *tool = (wxToolBarTool *)FindById(id);
+
+    if ( tool )
+    {
+        (void)tool->SetShortHelp(helpString);
+        gtk_tooltips_set_tip(m_toolbar->tooltips, tool->m_item,
+                             wxGTK_CONV( helpString ), "");
+    }
+}
+
+// ----------------------------------------------------------------------------
+// wxToolBar idle handling
+// ----------------------------------------------------------------------------
+
+void wxToolBar::OnInternalIdle()
+{
+    wxCursor cursor = m_cursor;
+    if (g_globalCursor.Ok()) cursor = g_globalCursor;
+
+    if (cursor.Ok())
+    {
+        /* I now set the cursor the anew in every OnInternalIdle call
+           as setting the cursor in a parent window also effects the
+           windows above so that checking for the current cursor is
+           not possible. */
+
+        if (HasFlag(wxTB_DOCKABLE) && (m_widget->window))
+        {
+            /* if the toolbar is dockable, then m_widget stands for the
+               GtkHandleBox widget, which uses its own window so that we
+               can set the cursor for it. if the toolbar is not dockable,
+               m_widget comes from m_toolbar which uses its parent's
+               window ("windowless windows") and thus we cannot set the
+               cursor. */
+            gdk_window_set_cursor( m_widget->window, cursor.GetCursor() );
+        }
+
+        wxToolBarToolsList::compatibility_iterator node = m_tools.GetFirst();
+        while ( node )
+        {
+            wxToolBarTool *tool = (wxToolBarTool *)node->GetData();
+            node = node->GetNext();
+
+            GtkWidget *item = tool->m_item;
+            if ( item )
+            {
+                GdkWindow *window = item->window;
+
+                if ( window )
+                {
+                    gdk_window_set_cursor( window, cursor.GetCursor() );
+                }
+            }
+        }
+    }
+
+    if (wxUpdateUIEvent::CanUpdate(this))
+        UpdateWindowUI(wxUPDATE_UI_FROMIDLE);
+}
+
+
+// ----------------------------------------------------------------------------
+
+// static
+wxVisualAttributes
+wxToolBar::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant))
+{
+    wxVisualAttributes attr;
+    GtkWidget* widget = gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH);
+    attr = GetDefaultAttributesFromGTKWidget(widget);
+    gtk_widget_destroy(widget);
+    return attr;
+}
+
+#endif // wxUSE_TOOLBAR_NATIVE