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
This commit is contained in:
Robert Roebling
1998-05-28 22:05:55 +00:00
parent 6f65e33794
commit 1a56f55c02
14 changed files with 488 additions and 8 deletions

View File

@@ -27,8 +27,57 @@
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__

View File

@@ -18,7 +18,6 @@
#include "wx/defs.h"
#include "wx/object.h"
#include "wx/list.h"
#include "wx/control.h"
//-----------------------------------------------------------------------------
@@ -27,8 +26,35 @@
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__

View File

@@ -27,8 +27,57 @@
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__

View File

@@ -18,7 +18,6 @@
#include "wx/defs.h"
#include "wx/object.h"
#include "wx/list.h"
#include "wx/control.h"
//-----------------------------------------------------------------------------
@@ -27,8 +26,35 @@
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__

View 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 \

View 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

View 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 );

71
src/gtk/gauge.cpp Normal file
View File

@@ -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;
};

79
src/gtk/statbmp.cpp Normal file
View File

@@ -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 );
}
};

View 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

View 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 );

71
src/gtk1/gauge.cpp Normal file
View File

@@ -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;
};

79
src/gtk1/statbmp.cpp Normal file
View File

@@ -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 );
}
};

View 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=