]> git.saurik.com Git - wxWidgets.git/commitdiff
GTK
authorRobert Roebling <robert@roebling.de>
Thu, 28 May 1998 22:05:55 +0000 (22:05 +0000)
committerRobert Roebling <robert@roebling.de>
Thu, 28 May 1998 22:05:55 +0000 (22:05 +0000)
  moved main() to app.cpp
  added wxGauge
  added wxStaticBitmap

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

14 files changed:
include/wx/gtk/gauge.h
include/wx/gtk/statbmp.h
include/wx/gtk1/gauge.h
include/wx/gtk1/statbmp.h
src/Makefile.in
src/gtk/app.cpp
src/gtk/bmpbuttn.cpp
src/gtk/gauge.cpp [new file with mode: 0644]
src/gtk/statbmp.cpp [new file with mode: 0644]
src/gtk1/app.cpp
src/gtk1/bmpbuttn.cpp
src/gtk1/gauge.cpp [new file with mode: 0644]
src/gtk1/statbmp.cpp [new file with mode: 0644]
user/wxTest/Makefile.in

index 49e031fea2094678178c91813c3dee6b6da9c279..802e60fff7da35a01020f8de0dc9a9029ebb4383 100644 (file)
 
 class wxGauge;
 
+//-----------------------------------------------------------------------------
+// global data
+//-----------------------------------------------------------------------------
+
+extern const char* wxGaugeNameStr;
+
 //-----------------------------------------------------------------------------
 // wxGaugeBox
 //-----------------------------------------------------------------------------
 
+class wxGauge: public wxControl
+{
+  DECLARE_DYNAMIC_CLASS(wxGauge)
+  
+  public:
+    inline wxGauge(void) { m_rangeMax = 0; m_gaugePos = 0; m_useProgressBar = TRUE; }
+
+  inline wxGauge(wxWindow *parent, const wxWindowID id,
+           const int range,
+           const wxPoint& pos = wxDefaultPosition,
+           const wxSize& size = wxDefaultSize,
+           const long style = wxGA_HORIZONTAL,
+           const wxString& name = wxGaugeNameStr)
+  {
+    Create(parent, id, range, pos, size, style, name);
+  };
+
+  bool Create(wxWindow *parent, const wxWindowID id,
+           const int range,
+           const wxPoint& pos = wxDefaultPosition,
+           const wxSize& size = wxDefaultSize,
+           const long style = wxGA_HORIZONTAL,
+           const wxString& name = wxGaugeNameStr );
+
+  void SetShadowWidth( const int WXUNUSED(w) ) {};
+  void SetBezelFace( const int WXUNUSED(w) ) {};
+  void SetRange( const int r );
+  void SetValue( const int pos );
+  int GetShadowWidth(void) const { return 0; };
+  int GetBezelFace(void) const { return 0; };
+  int GetRange(void) const;
+  int GetValue(void) const;
+
+  // Are we a Win95/GTK progress bar, or a normal gauge?
+  inline bool GetProgressBar(void) const { return m_useProgressBar; }
+
+ protected:
+   int      m_rangeMax;
+   int      m_gaugePos;
+   bool     m_useProgressBar;
+};
+
 #endif // __GTKGAUGEH__
index d6731e42d691ebf0473a334a0a21cbbfe875ed68..ec24d42deadbc85d6528958b85c30a43b73fabe0 100644 (file)
@@ -18,7 +18,6 @@
 
 #include "wx/defs.h"
 #include "wx/object.h"
-#include "wx/list.h"
 #include "wx/control.h"
 
 //-----------------------------------------------------------------------------
 
 class wxStaticBitmap;
 
+//-----------------------------------------------------------------------------
+// global data
+//-----------------------------------------------------------------------------
+
+extern const char* wxStaticBitmapNameStr;
+
 //-----------------------------------------------------------------------------
 // wxStaticBitmap
 //-----------------------------------------------------------------------------
 
+class wxStaticBitmap: public wxControl
+{
+  DECLARE_DYNAMIC_CLASS(wxStaticBitmap)
+  
+  public:
+  
+    wxStaticBitmap(void);
+    wxStaticBitmap( wxWindow *parent, const wxWindowID id, const wxBitmap& label,
+      const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
+      const long style = 0, const wxString& name = wxStaticBitmapNameStr );
+    bool Create( wxWindow *parent, const wxWindowID id, const wxBitmap& label,
+      const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
+      const long style = 0, const wxString& name = wxStaticBitmapNameStr);
+    virtual void SetBitmap( const wxBitmap& bitmap );
+    wxBitmap& GetBitmap(void) const { return (wxBitmap&)m_bitmap; }
+
+ private:
+   wxBitmap   m_bitmap;
+};
+
 #endif // __GTKSTATICBITMAPH__
index 49e031fea2094678178c91813c3dee6b6da9c279..802e60fff7da35a01020f8de0dc9a9029ebb4383 100644 (file)
 
 class wxGauge;
 
+//-----------------------------------------------------------------------------
+// global data
+//-----------------------------------------------------------------------------
+
+extern const char* wxGaugeNameStr;
+
 //-----------------------------------------------------------------------------
 // wxGaugeBox
 //-----------------------------------------------------------------------------
 
+class wxGauge: public wxControl
+{
+  DECLARE_DYNAMIC_CLASS(wxGauge)
+  
+  public:
+    inline wxGauge(void) { m_rangeMax = 0; m_gaugePos = 0; m_useProgressBar = TRUE; }
+
+  inline wxGauge(wxWindow *parent, const wxWindowID id,
+           const int range,
+           const wxPoint& pos = wxDefaultPosition,
+           const wxSize& size = wxDefaultSize,
+           const long style = wxGA_HORIZONTAL,
+           const wxString& name = wxGaugeNameStr)
+  {
+    Create(parent, id, range, pos, size, style, name);
+  };
+
+  bool Create(wxWindow *parent, const wxWindowID id,
+           const int range,
+           const wxPoint& pos = wxDefaultPosition,
+           const wxSize& size = wxDefaultSize,
+           const long style = wxGA_HORIZONTAL,
+           const wxString& name = wxGaugeNameStr );
+
+  void SetShadowWidth( const int WXUNUSED(w) ) {};
+  void SetBezelFace( const int WXUNUSED(w) ) {};
+  void SetRange( const int r );
+  void SetValue( const int pos );
+  int GetShadowWidth(void) const { return 0; };
+  int GetBezelFace(void) const { return 0; };
+  int GetRange(void) const;
+  int GetValue(void) const;
+
+  // Are we a Win95/GTK progress bar, or a normal gauge?
+  inline bool GetProgressBar(void) const { return m_useProgressBar; }
+
+ protected:
+   int      m_rangeMax;
+   int      m_gaugePos;
+   bool     m_useProgressBar;
+};
+
 #endif // __GTKGAUGEH__
index d6731e42d691ebf0473a334a0a21cbbfe875ed68..ec24d42deadbc85d6528958b85c30a43b73fabe0 100644 (file)
@@ -18,7 +18,6 @@
 
 #include "wx/defs.h"
 #include "wx/object.h"
-#include "wx/list.h"
 #include "wx/control.h"
 
 //-----------------------------------------------------------------------------
 
 class wxStaticBitmap;
 
+//-----------------------------------------------------------------------------
+// global data
+//-----------------------------------------------------------------------------
+
+extern const char* wxStaticBitmapNameStr;
+
 //-----------------------------------------------------------------------------
 // wxStaticBitmap
 //-----------------------------------------------------------------------------
 
+class wxStaticBitmap: public wxControl
+{
+  DECLARE_DYNAMIC_CLASS(wxStaticBitmap)
+  
+  public:
+  
+    wxStaticBitmap(void);
+    wxStaticBitmap( wxWindow *parent, const wxWindowID id, const wxBitmap& label,
+      const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
+      const long style = 0, const wxString& name = wxStaticBitmapNameStr );
+    bool Create( wxWindow *parent, const wxWindowID id, const wxBitmap& label,
+      const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
+      const long style = 0, const wxString& name = wxStaticBitmapNameStr);
+    virtual void SetBitmap( const wxBitmap& bitmap );
+    wxBitmap& GetBitmap(void) const { return (wxBitmap&)m_bitmap; }
+
+ private:
+   wxBitmap   m_bitmap;
+};
+
 #endif // __GTKSTATICBITMAPH__
index c363c1326412fc8d883f9263a6ef538f1b5027d9..876e27bd9249c620e58ed7798fea902c23f612c8 100644 (file)
@@ -76,6 +76,7 @@ LIB_CPP_SRC=\
  gtk/filedlg.cpp \
  gtk/font.cpp \
  gtk/frame.cpp \
+ gtk/gauge.cpp \
  gtk/gdiobj.cpp \
  gtk/icon.cpp \
  gtk/listbox.cpp \
@@ -90,6 +91,7 @@ LIB_CPP_SRC=\
  gtk/settings.cpp \
  gtk/slider.cpp \
  gtk/statbox.cpp \
+ gtk/statbmp.cpp \
  gtk/stattext.cpp \
  gtk/tbargtk.cpp \
  gtk/textctrl.cpp \
index 47c1ee0a72863525b172dee6c4af8740ff78796b..391f5a8d1c7219b01508f0d4c4a3f43dda16ba42 100644 (file)
@@ -277,3 +277,19 @@ int wxEntry( int argc, char *argv[] )
   
   return retValue;
 };
+
+//-----------------------------------------------------------------------------
+// main()
+//-----------------------------------------------------------------------------
+
+#if defined(AIX) || defined(AIX4) /* || defined(____HPUX__) */
+
+ // main in IMPLEMENT_WX_MAIN in IMPLEMENT_APP in app.h
+
+#else
+
+  int main(int argc, char *argv[]) { return wxEntry(argc, argv); }
+
+#endif
+
+
index 680b11b4e3353289d0ffb3818604feb829653f21..23909f6f3f3bab10c99502957292523f3df4c986 100644 (file)
@@ -72,8 +72,6 @@ bool wxBitmapButton::Create(  wxWindow *parent, wxWindowID id, const wxBitmap &b
     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 );
diff --git a/src/gtk/gauge.cpp b/src/gtk/gauge.cpp
new file mode 100644 (file)
index 0000000..bd679ff
--- /dev/null
@@ -0,0 +1,71 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        gauge.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 "gauge.h"
+#endif
+
+#include "wx/gauge.h"
+
+//-----------------------------------------------------------------------------
+// wxGauge
+//-----------------------------------------------------------------------------
+
+IMPLEMENT_DYNAMIC_CLASS(wxGauge,wxControl)
+
+bool wxGauge::Create( wxWindow *parent, const wxWindowID id,  const int range,
+    const wxPoint& pos, const wxSize& size,
+    const long style, const wxString& name )
+{
+  m_needParent = TRUE;
+  
+  wxSize newSize = size;
+  
+  PreCreation( parent, id, pos, size, style, name );
+  
+  m_rangeMax = range;
+  m_gaugePos = 0;
+  m_useProgressBar = TRUE;
+  
+  m_widget = gtk_progress_bar_new();
+  
+  PostCreation();
+  
+  Show( TRUE );
+    
+  return TRUE;
+};
+
+void wxGauge::SetRange( const int r )
+{
+  m_rangeMax = r;
+  if (m_gaugePos > m_rangeMax) m_gaugePos = m_rangeMax;
+  
+  gtk_progress_bar_update( GTK_PROGRESS_BAR(m_widget), (float)(m_rangeMax/m_gaugePos) );
+};
+
+void wxGauge::SetValue( const int pos )
+{
+  m_gaugePos = pos;
+  if (m_gaugePos > m_rangeMax) m_gaugePos = m_rangeMax;
+  
+  gtk_progress_bar_update( GTK_PROGRESS_BAR(m_widget), (float)(m_rangeMax/m_gaugePos) );
+};
+
+int wxGauge::GetRange(void) const
+{
+  return m_rangeMax;
+};
+
+int wxGauge::GetValue(void) const
+{
+  return m_gaugePos;
+};
+
diff --git a/src/gtk/statbmp.cpp b/src/gtk/statbmp.cpp
new file mode 100644 (file)
index 0000000..9b8d050
--- /dev/null
@@ -0,0 +1,79 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        statbmp.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 "statbmp.h"
+#endif
+
+#include "wx/statbmp.h"
+
+//-----------------------------------------------------------------------------
+// wxStaticBitmap
+//-----------------------------------------------------------------------------
+
+IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap,wxControl)
+
+wxStaticBitmap::wxStaticBitmap(void)
+{
+};
+
+wxStaticBitmap::wxStaticBitmap( 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 wxStaticBitmap::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, size, style, name );
+
+  m_bitmap = bitmap;
+    
+  if (m_bitmap.Ok())
+  {
+    GdkBitmap *mask = NULL;
+    if (m_bitmap.GetMask()) mask = m_bitmap.GetMask()->GetBitmap();
+    m_widget = gtk_pixmap_new( m_bitmap.GetPixmap(), mask );
+    
+    if (newSize.x == -1) newSize.x = m_bitmap.GetWidth();
+    if (newSize.y == -1) newSize.y = m_bitmap.GetHeight();
+    SetSize( newSize.x, newSize.y );
+  }
+  else
+  {
+    m_widget = gtk_label_new( "Bitmap" );
+  }
+  
+  PostCreation();
+  
+  Show( TRUE );
+    
+  return TRUE;
+};
+
+void wxStaticBitmap::SetBitmap( const wxBitmap &bitmap ) 
+{
+  m_bitmap = bitmap;
+  
+  if (m_bitmap.Ok())
+  {
+    GdkBitmap *mask = NULL;
+    if (m_bitmap.GetMask()) mask = m_bitmap.GetMask()->GetBitmap();
+    gtk_pixmap_set( GTK_PIXMAP(m_widget), m_bitmap.GetPixmap(), mask );
+  }
+};
+
index 47c1ee0a72863525b172dee6c4af8740ff78796b..391f5a8d1c7219b01508f0d4c4a3f43dda16ba42 100644 (file)
@@ -277,3 +277,19 @@ int wxEntry( int argc, char *argv[] )
   
   return retValue;
 };
+
+//-----------------------------------------------------------------------------
+// main()
+//-----------------------------------------------------------------------------
+
+#if defined(AIX) || defined(AIX4) /* || defined(____HPUX__) */
+
+ // main in IMPLEMENT_WX_MAIN in IMPLEMENT_APP in app.h
+
+#else
+
+  int main(int argc, char *argv[]) { return wxEntry(argc, argv); }
+
+#endif
+
+
index 680b11b4e3353289d0ffb3818604feb829653f21..23909f6f3f3bab10c99502957292523f3df4c986 100644 (file)
@@ -72,8 +72,6 @@ bool wxBitmapButton::Create(  wxWindow *parent, wxWindowID id, const wxBitmap &b
     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 );
diff --git a/src/gtk1/gauge.cpp b/src/gtk1/gauge.cpp
new file mode 100644 (file)
index 0000000..bd679ff
--- /dev/null
@@ -0,0 +1,71 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        gauge.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 "gauge.h"
+#endif
+
+#include "wx/gauge.h"
+
+//-----------------------------------------------------------------------------
+// wxGauge
+//-----------------------------------------------------------------------------
+
+IMPLEMENT_DYNAMIC_CLASS(wxGauge,wxControl)
+
+bool wxGauge::Create( wxWindow *parent, const wxWindowID id,  const int range,
+    const wxPoint& pos, const wxSize& size,
+    const long style, const wxString& name )
+{
+  m_needParent = TRUE;
+  
+  wxSize newSize = size;
+  
+  PreCreation( parent, id, pos, size, style, name );
+  
+  m_rangeMax = range;
+  m_gaugePos = 0;
+  m_useProgressBar = TRUE;
+  
+  m_widget = gtk_progress_bar_new();
+  
+  PostCreation();
+  
+  Show( TRUE );
+    
+  return TRUE;
+};
+
+void wxGauge::SetRange( const int r )
+{
+  m_rangeMax = r;
+  if (m_gaugePos > m_rangeMax) m_gaugePos = m_rangeMax;
+  
+  gtk_progress_bar_update( GTK_PROGRESS_BAR(m_widget), (float)(m_rangeMax/m_gaugePos) );
+};
+
+void wxGauge::SetValue( const int pos )
+{
+  m_gaugePos = pos;
+  if (m_gaugePos > m_rangeMax) m_gaugePos = m_rangeMax;
+  
+  gtk_progress_bar_update( GTK_PROGRESS_BAR(m_widget), (float)(m_rangeMax/m_gaugePos) );
+};
+
+int wxGauge::GetRange(void) const
+{
+  return m_rangeMax;
+};
+
+int wxGauge::GetValue(void) const
+{
+  return m_gaugePos;
+};
+
diff --git a/src/gtk1/statbmp.cpp b/src/gtk1/statbmp.cpp
new file mode 100644 (file)
index 0000000..9b8d050
--- /dev/null
@@ -0,0 +1,79 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        statbmp.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 "statbmp.h"
+#endif
+
+#include "wx/statbmp.h"
+
+//-----------------------------------------------------------------------------
+// wxStaticBitmap
+//-----------------------------------------------------------------------------
+
+IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap,wxControl)
+
+wxStaticBitmap::wxStaticBitmap(void)
+{
+};
+
+wxStaticBitmap::wxStaticBitmap( 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 wxStaticBitmap::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, size, style, name );
+
+  m_bitmap = bitmap;
+    
+  if (m_bitmap.Ok())
+  {
+    GdkBitmap *mask = NULL;
+    if (m_bitmap.GetMask()) mask = m_bitmap.GetMask()->GetBitmap();
+    m_widget = gtk_pixmap_new( m_bitmap.GetPixmap(), mask );
+    
+    if (newSize.x == -1) newSize.x = m_bitmap.GetWidth();
+    if (newSize.y == -1) newSize.y = m_bitmap.GetHeight();
+    SetSize( newSize.x, newSize.y );
+  }
+  else
+  {
+    m_widget = gtk_label_new( "Bitmap" );
+  }
+  
+  PostCreation();
+  
+  Show( TRUE );
+    
+  return TRUE;
+};
+
+void wxStaticBitmap::SetBitmap( const wxBitmap &bitmap ) 
+{
+  m_bitmap = bitmap;
+  
+  if (m_bitmap.Ok())
+  {
+    GdkBitmap *mask = NULL;
+    if (m_bitmap.GetMask()) mask = m_bitmap.GetMask()->GetBitmap();
+    gtk_pixmap_set( GTK_PIXMAP(m_widget), m_bitmap.GetPixmap(), mask );
+  }
+};
+
index 5762eaa6cb0df74ad51d61d0602cff2565e4efd7..a962e10290d5974d8a96ec0202c36b71c97f7dad 100644 (file)
@@ -10,11 +10,11 @@ RULE=bin
 BIN_TARGET=wxTest
 # define library sources
 BIN_SRC=\
-wxTest.cpp stream.cpp
+wxTest.cpp
 
 #define library objects
 BIN_OBJ=\
-wxTest.o stream.o
+wxTest.o
 
 # additional things needed to link
 BIN_LINK=