]> git.saurik.com Git - wxWidgets.git/commitdiff
GTK wxBitmapButton added
authorRobert Roebling <robert@roebling.de>
Thu, 28 May 1998 17:44:04 +0000 (17:44 +0000)
committerRobert Roebling <robert@roebling.de>
Thu, 28 May 1998 17:44:04 +0000 (17:44 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/file.h
include/wx/gtk/bitmap.h
include/wx/gtk/bmpbuttn.h
include/wx/gtk1/bitmap.h
include/wx/gtk1/bmpbuttn.h
install/gtk/configure.in
src/Makefile.in
src/gtk/bmpbuttn.cpp [new file with mode: 0644]
src/gtk1/bmpbuttn.cpp [new file with mode: 0644]
user/wxTest/Makefile.in

index 8f0f734bed092b072fadb769cd4201de5498dcee..bf58ce69c079df7aa3235ad9a29f3ad8d192d0b0 100644 (file)
@@ -21,7 +21,8 @@
 // simple types
 // ----------------------------------------------------------------------------
 
-#include  <wx/filefn.h>
+#include  "wx/string.h"
+#include  "wx/filefn.h"
 
 // define off_t
 #include  <sys/types.h>
index 1d6260c5fca6ce6de6af981494f75f91a59d7d05..3d7e90c69b83b9ce7b780f3c67df55fc699dfcea 100644 (file)
 // classes
 //-----------------------------------------------------------------------------
 
-class wxDC;
-class wxPaintDC;
-class wxMemoryDC;
-class wxToolBarGTK;
-
 class wxMask;
 class wxBitmap;
 
@@ -49,13 +44,8 @@ class wxMask: public wxObject
     wxMask( const wxBitmap& bitmap );
     ~wxMask(void);
 
-  private:
+  public:
   
-    friend wxBitmap;
-    friend wxDC;
-    friend wxPaintDC;
-    friend wxToolBarGTK;
-    
     GdkBitmap *GetBitmap(void) const;
     
   protected:
@@ -103,12 +93,7 @@ class wxBitmap: public wxObject
     wxPalette *GetColourMap(void) const
       { return GetPalette(); };
 
-  private:
-  
-    friend wxDC;
-    friend wxPaintDC;
-    friend wxMemoryDC;
-    friend wxToolBarGTK;
+  public:
 
     GdkPixmap *GetPixmap(void) const;
     
index c8dbaba78d4a0b0e331f0876b519f435a92fc220..57bc2c387327dcf375911e10aa652a48f1a2b189 100644 (file)
 
 class wxBitmapButton;
 
+//-----------------------------------------------------------------------------
+// global data
+//-----------------------------------------------------------------------------
+
+extern const char *wxButtonNameStr;
+
 //-----------------------------------------------------------------------------
 // wxBitmapButton
 //-----------------------------------------------------------------------------
 
+class wxBitmapButton: public wxControl
+{
+  DECLARE_DYNAMIC_CLASS(wxBitmapButton)
+
+  public:
+
+    wxBitmapButton(void);
+    wxBitmapButton( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap,
+      const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, 
+      const long style = 0, const wxString &name = wxButtonNameStr  );
+    bool Create(  wxWindow *parent, wxWindowID id, const wxBitmap &bitmap,
+      const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, 
+      const long style = 0, const wxString &name = wxButtonNameStr  );
+    void SetDefault(void);
+    void SetLabel( const wxString &label );
+    wxString GetLabel(void) const;
+    
+  public:
+  
+    wxBitmap   m_bitmap;    
+    
+};
 #endif // __BMPBUTTONH__
index 1d6260c5fca6ce6de6af981494f75f91a59d7d05..3d7e90c69b83b9ce7b780f3c67df55fc699dfcea 100644 (file)
 // classes
 //-----------------------------------------------------------------------------
 
-class wxDC;
-class wxPaintDC;
-class wxMemoryDC;
-class wxToolBarGTK;
-
 class wxMask;
 class wxBitmap;
 
@@ -49,13 +44,8 @@ class wxMask: public wxObject
     wxMask( const wxBitmap& bitmap );
     ~wxMask(void);
 
-  private:
+  public:
   
-    friend wxBitmap;
-    friend wxDC;
-    friend wxPaintDC;
-    friend wxToolBarGTK;
-    
     GdkBitmap *GetBitmap(void) const;
     
   protected:
@@ -103,12 +93,7 @@ class wxBitmap: public wxObject
     wxPalette *GetColourMap(void) const
       { return GetPalette(); };
 
-  private:
-  
-    friend wxDC;
-    friend wxPaintDC;
-    friend wxMemoryDC;
-    friend wxToolBarGTK;
+  public:
 
     GdkPixmap *GetPixmap(void) const;
     
index c8dbaba78d4a0b0e331f0876b519f435a92fc220..57bc2c387327dcf375911e10aa652a48f1a2b189 100644 (file)
 
 class wxBitmapButton;
 
+//-----------------------------------------------------------------------------
+// global data
+//-----------------------------------------------------------------------------
+
+extern const char *wxButtonNameStr;
+
 //-----------------------------------------------------------------------------
 // wxBitmapButton
 //-----------------------------------------------------------------------------
 
+class wxBitmapButton: public wxControl
+{
+  DECLARE_DYNAMIC_CLASS(wxBitmapButton)
+
+  public:
+
+    wxBitmapButton(void);
+    wxBitmapButton( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap,
+      const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, 
+      const long style = 0, const wxString &name = wxButtonNameStr  );
+    bool Create(  wxWindow *parent, wxWindowID id, const wxBitmap &bitmap,
+      const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, 
+      const long style = 0, const wxString &name = wxButtonNameStr  );
+    void SetDefault(void);
+    void SetLabel( const wxString &label );
+    wxString GetLabel(void) const;
+    
+  public:
+  
+    wxBitmap   m_bitmap;    
+    
+};
 #endif // __BMPBUTTONH__
index 119a69dd70ae149ca83f21e96b8d5b871b31c90b..220adc215fb9d6248f43bf09b71d3bb59921fcf0 100644 (file)
@@ -679,7 +679,7 @@ DEFAULT_USE_WXTREE=0
 DEFAULT_USE_ENHANCED_DIALOG=0
 
 DEFAULT_USE_FORM=0
-DEFAULT_USE_PROLOGIO=0
+DEFAULT_USE_PROLOGIO=1
 DEFAULT_USE_RPC=0
 DEFAULT_USE_WX_RESOURCES=1
 
index 10507f8fb42dc5017df4697badd23fad0b60b322..c363c1326412fc8d883f9263a6ef538f1b5027d9 100644 (file)
@@ -58,6 +58,7 @@ LIB_CPP_SRC=\
 \
  gtk/app.cpp \
  gtk/bitmap.cpp \
+ gtk/bmpbuttn.cpp \
  gtk/brush.cpp \
  gtk/button.cpp \
  gtk/checkbox.cpp \
diff --git a/src/gtk/bmpbuttn.cpp b/src/gtk/bmpbuttn.cpp
new file mode 100644 (file)
index 0000000..680b11b
--- /dev/null
@@ -0,0 +1,103 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        bmpbuttn.cpp
+// Purpose:
+// Author:      Robert Roebling
+// Created:     01/02/97
+// Id:
+// Copyright:   (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
+// Licence:    wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+#pragma implementation "bmpbuttn.h"
+#endif
+
+#include "wx/bmpbuttn.h"
+
+//-----------------------------------------------------------------------------
+// classes
+//-----------------------------------------------------------------------------
+
+class wxBitmapButton;
+
+//-----------------------------------------------------------------------------
+// wxBitmapButton
+//-----------------------------------------------------------------------------
+
+IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton,wxControl)
+
+void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), gpointer data )
+{
+  wxBitmapButton *button = (wxBitmapButton*)data;
+  wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId());
+  event.SetEventObject(button);
+  button->ProcessEvent(event);
+};
+
+//-----------------------------------------------------------------------------
+
+wxBitmapButton::wxBitmapButton(void)
+{
+};
+
+wxBitmapButton::wxBitmapButton( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap,
+      const wxPoint &pos, const wxSize &size, 
+      const long style, const wxString &name )
+{
+  Create( parent, id, bitmap, pos, size, style, name );
+};
+
+bool wxBitmapButton::Create(  wxWindow *parent, wxWindowID id, const wxBitmap &bitmap,
+      const wxPoint &pos, const wxSize &size, 
+      const long style, const wxString &name )
+{
+  m_needParent = TRUE;
+  
+  wxSize newSize = size;
+
+  PreCreation( parent, id, pos, newSize, style, name );
+  
+  m_bitmap = bitmap;
+  m_label = "";
+  
+  m_widget = gtk_button_new();
+  
+  if (m_bitmap.Ok())
+  {
+    GdkBitmap *mask = NULL;
+    if (m_bitmap.GetMask()) mask = m_bitmap.GetMask()->GetBitmap();
+    GtkWidget *pixmap = gtk_pixmap_new( m_bitmap.GetPixmap(), mask );
+    
+    gtk_widget_show( pixmap );
+    gtk_container_add( GTK_CONTAINER(m_widget), pixmap );
+  };
+  
+  
+  
+  if (newSize.x == -1) newSize.x = m_bitmap.GetHeight()+10;
+  if (newSize.y == -1) newSize.y = m_bitmap.GetWidth()+10;
+  SetSize( newSize.x, newSize.y );
+  
+  gtk_signal_connect( GTK_OBJECT(m_widget), "clicked", 
+    GTK_SIGNAL_FUNC(gtk_button_clicked_callback), (gpointer*)this );
+
+  PostCreation();
+  
+  Show( TRUE );
+    
+  return TRUE;
+};
+      
+void wxBitmapButton::SetDefault(void)
+{
+};
+
+void wxBitmapButton::SetLabel( const wxString &label )
+{
+  wxControl::SetLabel( label );
+};
+
+wxString wxBitmapButton::GetLabel(void) const
+{
+  return wxControl::GetLabel();
+};
diff --git a/src/gtk1/bmpbuttn.cpp b/src/gtk1/bmpbuttn.cpp
new file mode 100644 (file)
index 0000000..680b11b
--- /dev/null
@@ -0,0 +1,103 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        bmpbuttn.cpp
+// Purpose:
+// Author:      Robert Roebling
+// Created:     01/02/97
+// Id:
+// Copyright:   (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
+// Licence:    wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+#pragma implementation "bmpbuttn.h"
+#endif
+
+#include "wx/bmpbuttn.h"
+
+//-----------------------------------------------------------------------------
+// classes
+//-----------------------------------------------------------------------------
+
+class wxBitmapButton;
+
+//-----------------------------------------------------------------------------
+// wxBitmapButton
+//-----------------------------------------------------------------------------
+
+IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton,wxControl)
+
+void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), gpointer data )
+{
+  wxBitmapButton *button = (wxBitmapButton*)data;
+  wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId());
+  event.SetEventObject(button);
+  button->ProcessEvent(event);
+};
+
+//-----------------------------------------------------------------------------
+
+wxBitmapButton::wxBitmapButton(void)
+{
+};
+
+wxBitmapButton::wxBitmapButton( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap,
+      const wxPoint &pos, const wxSize &size, 
+      const long style, const wxString &name )
+{
+  Create( parent, id, bitmap, pos, size, style, name );
+};
+
+bool wxBitmapButton::Create(  wxWindow *parent, wxWindowID id, const wxBitmap &bitmap,
+      const wxPoint &pos, const wxSize &size, 
+      const long style, const wxString &name )
+{
+  m_needParent = TRUE;
+  
+  wxSize newSize = size;
+
+  PreCreation( parent, id, pos, newSize, style, name );
+  
+  m_bitmap = bitmap;
+  m_label = "";
+  
+  m_widget = gtk_button_new();
+  
+  if (m_bitmap.Ok())
+  {
+    GdkBitmap *mask = NULL;
+    if (m_bitmap.GetMask()) mask = m_bitmap.GetMask()->GetBitmap();
+    GtkWidget *pixmap = gtk_pixmap_new( m_bitmap.GetPixmap(), mask );
+    
+    gtk_widget_show( pixmap );
+    gtk_container_add( GTK_CONTAINER(m_widget), pixmap );
+  };
+  
+  
+  
+  if (newSize.x == -1) newSize.x = m_bitmap.GetHeight()+10;
+  if (newSize.y == -1) newSize.y = m_bitmap.GetWidth()+10;
+  SetSize( newSize.x, newSize.y );
+  
+  gtk_signal_connect( GTK_OBJECT(m_widget), "clicked", 
+    GTK_SIGNAL_FUNC(gtk_button_clicked_callback), (gpointer*)this );
+
+  PostCreation();
+  
+  Show( TRUE );
+    
+  return TRUE;
+};
+      
+void wxBitmapButton::SetDefault(void)
+{
+};
+
+void wxBitmapButton::SetLabel( const wxString &label )
+{
+  wxControl::SetLabel( label );
+};
+
+wxString wxBitmapButton::GetLabel(void) const
+{
+  return wxControl::GetLabel();
+};
index a962e10290d5974d8a96ec0202c36b71c97f7dad..5762eaa6cb0df74ad51d61d0602cff2565e4efd7 100644 (file)
@@ -10,11 +10,11 @@ RULE=bin
 BIN_TARGET=wxTest
 # define library sources
 BIN_SRC=\
-wxTest.cpp
+wxTest.cpp stream.cpp
 
 #define library objects
 BIN_OBJ=\
-wxTest.o
+wxTest.o stream.o
 
 # additional things needed to link
 BIN_LINK=