GTK wxBitmapButton added

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling 1998-05-28 17:44:04 +00:00
parent ef77f91e5b
commit 151ccd11af
10 changed files with 272 additions and 38 deletions

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

View File

@ -25,11 +25,6 @@
// classes
//-----------------------------------------------------------------------------
class wxDC;
class wxPaintDC;
class wxMemoryDC;
class wxToolBarGTK;
class wxMask;
class wxBitmap;
@ -49,12 +44,7 @@ class wxMask: public wxObject
wxMask( const wxBitmap& bitmap );
~wxMask(void);
private:
friend wxBitmap;
friend wxDC;
friend wxPaintDC;
friend wxToolBarGTK;
public:
GdkBitmap *GetBitmap(void) const;
@ -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;

View File

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

View File

@ -25,11 +25,6 @@
// classes
//-----------------------------------------------------------------------------
class wxDC;
class wxPaintDC;
class wxMemoryDC;
class wxToolBarGTK;
class wxMask;
class wxBitmap;
@ -49,12 +44,7 @@ class wxMask: public wxObject
wxMask( const wxBitmap& bitmap );
~wxMask(void);
private:
friend wxBitmap;
friend wxDC;
friend wxPaintDC;
friend wxToolBarGTK;
public:
GdkBitmap *GetBitmap(void) const;
@ -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;

View File

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

View 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

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

103
src/gtk/bmpbuttn.cpp Normal file
View File

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

103
src/gtk1/bmpbuttn.cpp Normal file
View File

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

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