Initial revision

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@2 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Karsten Ballüder
1998-05-20 14:01:55 +00:00
parent 1b66e7e5ab
commit c801d85f15
779 changed files with 172138 additions and 0 deletions

279
src/gtk1/app.cpp Normal file
View File

@@ -0,0 +1,279 @@
/////////////////////////////////////////////////////////////////////////////
// Name: app.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 "app.h"
#endif
#include "wx/app.h"
#include "wx/gdicmn.h"
#include "wx/utils.h"
#include "wx/postscrp.h"
#include "wx/intl.h"
#include "wx/log.h"
#include "unistd.h"
#ifdef USE_GDK_IMLIB
#include "gdk_imlib.h"
#endif
//-----------------------------------------------------------------------------
// global data
//-----------------------------------------------------------------------------
wxApp *wxTheApp = NULL;
wxAppInitializerFunction wxApp::m_appInitFn = (wxAppInitializerFunction) NULL;
extern wxList wxPendingDelete;
//-----------------------------------------------------------------------------
// local functions
//-----------------------------------------------------------------------------
extern void wxFlushResources(void);
//-----------------------------------------------------------------------------
// global functions
//-----------------------------------------------------------------------------
void wxExit(void)
{
gtk_main_quit();
};
bool wxYield(void)
{
while (gtk_events_pending() > 0) gtk_main_iteration();
return TRUE;
};
//-----------------------------------------------------------------------------
// wxApp
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxApp,wxEvtHandler)
gint wxapp_idle_callback( gpointer WXUNUSED(data) )
{
if (wxTheApp) wxTheApp->OnIdle();
usleep( 10000 );
return TRUE;
};
wxApp::wxApp()
{
m_idleTag = 0;
m_topWindow = NULL;
m_exitOnFrameDelete = TRUE;
};
wxApp::~wxApp(void)
{
gtk_idle_remove( m_idleTag );
};
bool wxApp::OnInit(void)
{
return TRUE;
};
bool wxApp::OnInitGui(void)
{
m_idleTag = gtk_idle_add( wxapp_idle_callback, NULL );
return TRUE;
};
int wxApp::OnRun(void)
{
return MainLoop();
};
bool wxApp::OnIdle(void)
{
DeletePendingObjects();
return FALSE;
};
int wxApp::OnExit(void)
{
return 0;
};
int wxApp::MainLoop(void)
{
gtk_main();
return 0;
};
void wxApp::ExitMainLoop(void)
{
gtk_main_quit();
};
bool wxApp::Initialized(void)
{
return m_initialized;
};
bool wxApp::Pending(void)
{
return FALSE;
};
void wxApp::Dispatch(void)
{
};
void wxApp::DeletePendingObjects(void)
{
wxNode *node = wxPendingDelete.First();
while (node)
{
wxObject *obj = (wxObject *)node->Data();
delete obj;
if (wxPendingDelete.Member(obj))
delete node;
node = wxPendingDelete.First();
};
};
wxWindow *wxApp::GetTopWindow(void)
{
if (m_topWindow) return m_topWindow;
wxNode *node = wxTopLevelWindows.First();
if (!node) return NULL;
return (wxWindow*)node->Data();
};
void wxApp::SetTopWindow( wxWindow *win )
{
m_topWindow = win;
};
void wxApp::CommonInit(void)
{
/*
#if USE_RESOURCES
(void) wxGetResource("wxWindows", "OsVersion", &wxOsVersion);
#endif
*/
wxTheColourDatabase = new wxColourDatabase(wxKEY_STRING);
wxTheColourDatabase->Initialize();
wxInitializeStockObjects();
// For PostScript printing
#if USE_POSTSCRIPT
wxInitializePrintSetupData();
wxThePrintPaperDatabase = new wxPrintPaperDatabase;
wxThePrintPaperDatabase->CreateDatabase();
#endif
/*
wxBitmap::InitStandardHandlers();
g_globalCursor = new wxCursor;
*/
wxInitializeStockObjects();
};
void wxApp::CommonCleanUp(void)
{
wxDeleteStockObjects();
wxFlushResources();
};
wxLog *wxApp::CreateLogTarget()
{
return new wxLogGui;
}
//-----------------------------------------------------------------------------
// wxEntry
//-----------------------------------------------------------------------------
int wxEntry( int argc, char *argv[] )
{
wxBuffer = new char[BUFSIZ + 512];
wxClassInfo::InitializeClasses();
if (!wxTheApp)
{
if (!wxApp::GetInitializerFunction())
{
printf( "wxWindows error: No initializer - use IMPLEMENT_APP macro.\n" );
return 0;
};
wxAppInitializerFunction app_ini = wxApp::GetInitializerFunction();
wxObject *test_app = app_ini();
wxTheApp = (wxApp*) test_app;
// wxTheApp = (wxApp*)( app_ini() );
};
if (!wxTheApp)
{
printf( "wxWindows error: wxTheApp == NULL\n" );
return 0;
};
// printf( "Programmstart.\n" );
wxTheApp->argc = argc;
wxTheApp->argv = argv;
gtk_init( &argc, &argv );
#ifdef USE_GDK_IMLIB
gdk_imlib_init();
gtk_widget_push_visual(gdk_imlib_get_visual());
gtk_widget_push_colormap(gdk_imlib_get_colormap());
#endif
wxApp::CommonInit();
wxTheApp->OnInitGui();
// Here frames insert themselves automatically
// into wxTopLevelWindows by getting created
// in OnInit().
if (!wxTheApp->OnInit()) return 0;
wxTheApp->m_initialized = (wxTopLevelWindows.Number() > 0);
int retValue = 0;
if (wxTheApp->Initialized()) retValue = wxTheApp->OnRun();
wxTheApp->DeletePendingObjects();
wxTheApp->OnExit();
wxApp::CommonCleanUp();
return retValue;
};

6
src/gtk1/bdiag.xbm Normal file
View File

@@ -0,0 +1,6 @@
#define bdiag_width 16
#define bdiag_height 16
static char bdiag_bits[] = {
0x80, 0x80, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x04, 0x04,
0x02, 0x02, 0x01, 0x01, 0x80, 0x80, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10,
0x08, 0x08, 0x04, 0x04, 0x02, 0x02, 0x01, 0x01};

293
src/gtk1/bitmap.cpp Normal file
View File

@@ -0,0 +1,293 @@
/////////////////////////////////////////////////////////////////////////////
// Name: bitmap.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 "bitmap.h"
#endif
#include "wx/bitmap.h"
#include "gdk/gdkprivate.h"
#ifdef USE_GDK_IMLIB
#include "gdk_imlib.h"
#endif
//-----------------------------------------------------------------------------
// wxMask
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxMask,wxObject)
wxMask::wxMask(void)
{
m_bitmap = NULL;
};
wxMask::wxMask( const wxBitmap& WXUNUSED(bitmap), const wxColour& WXUNUSED(colour) )
{
};
wxMask::wxMask( const wxBitmap& WXUNUSED(bitmap), const int WXUNUSED(paletteIndex) )
{
};
wxMask::wxMask( const wxBitmap& WXUNUSED(bitmap) )
{
};
wxMask::~wxMask(void)
{
#ifdef USE_GDK_IMLIB
// do not delete the mask, gdk_imlib does it for you
#else
if (m_bitmap) gdk_bitmap_unref( m_bitmap );
#endif
};
GdkBitmap *wxMask::GetBitmap(void) const
{
return m_bitmap;
};
//-----------------------------------------------------------------------------
// wxBitmap
//-----------------------------------------------------------------------------
class wxBitmapRefData: public wxObjectRefData
{
public:
wxBitmapRefData(void);
~wxBitmapRefData(void);
GdkPixmap *m_pixmap;
wxMask *m_mask;
int m_width;
int m_height;
int m_bpp;
wxPalette *m_palette;
};
wxBitmapRefData::wxBitmapRefData(void)
{
m_pixmap = NULL;
m_mask = NULL;
m_width = 0;
m_height = 0;
m_bpp = 0;
m_palette = NULL;
};
wxBitmapRefData::~wxBitmapRefData(void)
{
#ifdef USE_GDK_IMLIB
if (m_pixmap) gdk_imlib_free_pixmap( m_pixmap );
#else
if (m_pixmap) gdk_pixmap_unref( m_pixmap );
#endif
if (m_mask) delete m_mask;
if (m_palette) delete m_palette;
};
//-----------------------------------------------------------------------------
#define M_BMPDATA ((wxBitmapRefData *)m_refData)
IMPLEMENT_DYNAMIC_CLASS(wxBitmap,wxGDIObject)
wxBitmap::wxBitmap(void)
{
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
};
wxBitmap::wxBitmap( const int width, const int height, const int depth )
{
m_refData = new wxBitmapRefData();
M_BMPDATA->m_mask = NULL;
M_BMPDATA->m_pixmap =
gdk_pixmap_new( (GdkWindow*) &gdk_root_parent, width, height, depth );
gdk_window_get_size( M_BMPDATA->m_pixmap, &(M_BMPDATA->m_width), &(M_BMPDATA->m_height) );
M_BMPDATA->m_bpp = depth;
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
};
wxBitmap::wxBitmap( char **bits )
{
m_refData = new wxBitmapRefData();
GdkBitmap *mask = NULL;
#ifndef USE_GDK_IMLIB
M_BMPDATA->m_pixmap =
gdk_pixmap_create_from_xpm_d( (GdkWindow*) &gdk_root_parent, &mask, NULL, (gchar **) bits );
#else
M_BMPDATA->m_pixmap = NULL;
int res = gdk_imlib_data_to_pixmap( bits, &M_BMPDATA->m_pixmap, &mask );
#endif
if (mask)
{
M_BMPDATA->m_mask = new wxMask();
M_BMPDATA->m_mask->m_bitmap = mask;
};
gdk_window_get_size( M_BMPDATA->m_pixmap, &(M_BMPDATA->m_width), &(M_BMPDATA->m_height) );
M_BMPDATA->m_bpp = 24; // ?
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
};
wxBitmap::wxBitmap( const wxBitmap& bmp )
{
Ref( bmp );
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
};
wxBitmap::wxBitmap( const wxBitmap* bmp )
{
if (bmp) Ref( *bmp );
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
};
wxBitmap::wxBitmap( const wxString &filename, const int type )
{
LoadFile( filename, type );
};
wxBitmap::~wxBitmap(void)
{
if (wxTheBitmapList) wxTheBitmapList->DeleteObject(this);
};
wxBitmap& wxBitmap::operator = ( const wxBitmap& bmp )
{
if (*this == bmp) return (*this);
Ref( bmp );
return *this;
};
bool wxBitmap::operator == ( const wxBitmap& bmp )
{
return m_refData == bmp.m_refData;
};
bool wxBitmap::operator != ( const wxBitmap& bmp )
{
return m_refData != bmp.m_refData;
};
bool wxBitmap::Ok(void) const
{
return m_refData != NULL;
};
int wxBitmap::GetHeight(void) const
{
if (!Ok()) return 0;
return M_BMPDATA->m_height;
};
int wxBitmap::GetWidth(void) const
{
if (!Ok()) return 0;
return M_BMPDATA->m_width;
};
int wxBitmap::GetDepth(void) const
{
if (!Ok()) return 0;
return M_BMPDATA->m_bpp;
};
void wxBitmap::SetHeight( const int height )
{
if (!Ok()) return;
M_BMPDATA->m_height = height;
};
void wxBitmap::SetWidth( const int width )
{
if (!Ok()) return;
M_BMPDATA->m_width = width;
};
void wxBitmap::SetDepth( const int depth )
{
if (!Ok()) return;
M_BMPDATA->m_bpp = depth;
};
wxMask *wxBitmap::GetMask(void) const
{
if (!Ok()) return NULL;
return M_BMPDATA->m_mask;
};
void wxBitmap::SetMask( wxMask *mask )
{
if (!Ok()) return;
if (M_BMPDATA->m_mask) delete M_BMPDATA->m_mask;
M_BMPDATA->m_mask = mask;
};
bool wxBitmap::SaveFile( const wxString &WXUNUSED(name), const int WXUNUSED(type),
wxPalette *WXUNUSED(palette) )
{
return FALSE;
};
bool wxBitmap::LoadFile( const wxString &name, const int WXUNUSED(type) )
{
#ifdef USE_GDK_IMLIB
UnRef();
m_refData = new wxBitmapRefData();
M_BMPDATA->m_mask = NULL;
GdkBitmap *mask = NULL;
int res = gdk_imlib_load_file_to_pixmap( WXSTRINGCAST name, &M_BMPDATA->m_pixmap, &mask );
if (res != 1)
{
UnRef();
return FALSE;
};
if (mask)
{
M_BMPDATA->m_mask = new wxMask();
M_BMPDATA->m_mask->m_bitmap = mask;
}
gdk_window_get_size( M_BMPDATA->m_pixmap, &(M_BMPDATA->m_width), &(M_BMPDATA->m_height) );
M_BMPDATA->m_bpp = 24; // ?
return TRUE;
#endif
return FALSE;
};
wxPalette *wxBitmap::GetPalette(void) const
{
if (!Ok()) return NULL;
return M_BMPDATA->m_palette;
};
GdkPixmap *wxBitmap::GetPixmap(void) const
{
if (!Ok()) return NULL;
return M_BMPDATA->m_pixmap;
};

132
src/gtk1/brush.cpp Normal file
View File

@@ -0,0 +1,132 @@
/////////////////////////////////////////////////////////////////////////////
// Name: brush.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 "brush.h"
#endif
#include "wx/brush.h"
//-----------------------------------------------------------------------------
// wxBrush
//-----------------------------------------------------------------------------
class wxBrushRefData: public wxObjectRefData
{
public:
wxBrushRefData(void);
int m_style;
wxBitmap m_stipple;
wxColour m_colour;
};
wxBrushRefData::wxBrushRefData(void)
{
m_style = 0;
};
//-----------------------------------------------------------------------------
#define M_BRUSHDATA ((wxBrushRefData *)m_refData)
IMPLEMENT_DYNAMIC_CLASS(wxBrush,wxGDIObject)
wxBrush::wxBrush(void)
{
if (wxTheBrushList) wxTheBrushList->AddBrush( this );
};
wxBrush::wxBrush( const wxColour &colour, const int style )
{
m_refData = new wxBrushRefData();
M_BRUSHDATA->m_style = style;
M_BRUSHDATA->m_colour = colour;
if (wxTheBrushList) wxTheBrushList->AddBrush( this );
};
wxBrush::wxBrush( const wxString &colourName, const int style )
{
m_refData = new wxBrushRefData();
M_BRUSHDATA->m_style = style;
M_BRUSHDATA->m_colour = colourName;
if (wxTheBrushList) wxTheBrushList->AddBrush( this );
};
wxBrush::wxBrush( const wxBitmap &stippleBitmap )
{
m_refData = new wxBrushRefData();
M_BRUSHDATA->m_style = wxSTIPPLE;
M_BRUSHDATA->m_colour = *wxBLACK;
M_BRUSHDATA->m_stipple = stippleBitmap;
if (wxTheBrushList) wxTheBrushList->AddBrush( this );
};
wxBrush::wxBrush( const wxBrush &brush )
{
Ref( brush );
if (wxTheBrushList) wxTheBrushList->AddBrush( this );
};
wxBrush::wxBrush( const wxBrush *brush )
{
if (brush) Ref( *brush );
if (wxTheBrushList) wxTheBrushList->Append( this );
};
wxBrush::~wxBrush(void)
{
if (wxTheBrushList) wxTheBrushList->RemoveBrush( this );
};
wxBrush& wxBrush::operator = ( const wxBrush& brush )
{
if (*this == brush) return (*this);
Ref( brush );
return *this;
};
bool wxBrush::operator == ( const wxBrush& brush )
{
return m_refData == brush.m_refData;
};
bool wxBrush::operator != ( const wxBrush& brush )
{
return m_refData != brush.m_refData;
};
bool wxBrush::Ok(void) const
{
return ((m_refData) && M_BRUSHDATA->m_colour.Ok());
};
int wxBrush::GetStyle(void) const
{
return M_BRUSHDATA->m_style;
};
wxColour &wxBrush::GetColour(void) const
{
return M_BRUSHDATA->m_colour;
};
wxBitmap *wxBrush::GetStipple(void) const
{
return &M_BRUSHDATA->m_stipple;
};

89
src/gtk1/button.cpp Normal file
View File

@@ -0,0 +1,89 @@
/////////////////////////////////////////////////////////////////////////////
// Name: button.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 "button.h"
#endif
#include "wx/button.h"
//-----------------------------------------------------------------------------
// classes
//-----------------------------------------------------------------------------
class wxButton;
//-----------------------------------------------------------------------------
// wxButton
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxButton,wxControl)
void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), gpointer data )
{
wxButton *button = (wxButton*)data;
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId());
event.SetEventObject(button);
button->ProcessEvent(event);
};
//-----------------------------------------------------------------------------
wxButton::wxButton(void)
{
};
wxButton::wxButton( wxWindow *parent, wxWindowID id, const wxString &label,
const wxPoint &pos, const wxSize &size,
const long style, const wxString &name )
{
Create( parent, id, label, pos, size, style, name );
};
bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label,
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_label = label;
m_widget = gtk_button_new_with_label( label );
if (newSize.x == -1) newSize.x = 15+gdk_string_measure( m_widget->style->font, label );
if (newSize.y == -1) newSize.y = 26;
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 wxButton::SetDefault(void)
{
};
void wxButton::SetLabel( const wxString &label )
{
wxControl::SetLabel( label );
};
wxString wxButton::GetLabel(void) const
{
return wxControl::GetLabel();
};

6
src/gtk1/cdiag.xbm Normal file
View File

@@ -0,0 +1,6 @@
#define cdiag_width 16
#define cdiag_height 16
static char cdiag_bits[] = {
0x81, 0x81, 0x42, 0x42, 0x24, 0x24, 0x18, 0x18, 0x18, 0x18, 0x24, 0x24,
0x42, 0x42, 0x81, 0x81, 0x81, 0x81, 0x42, 0x42, 0x24, 0x24, 0x18, 0x18,
0x18, 0x18, 0x24, 0x24, 0x42, 0x42, 0x81, 0x81};

84
src/gtk1/checkbox.cpp Normal file
View File

@@ -0,0 +1,84 @@
/////////////////////////////////////////////////////////////////////////////
// Name: checkbox.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 "checkbox.h"
#endif
#include "wx/checkbox.h"
//-----------------------------------------------------------------------------
// wxCheckBox
//-----------------------------------------------------------------------------
void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), gpointer data )
{
wxCheckBox *cb = (wxCheckBox*)data;
wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, cb->GetId());
event.SetInt( cb->GetValue() );
event.SetEventObject(cb);
cb->ProcessEvent(event);
};
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxCheckBox,wxControl)
wxCheckBox::wxCheckBox(void)
{
};
wxCheckBox::wxCheckBox( wxWindow *parent, wxWindowID id, const wxString &label,
const wxPoint &pos, const wxSize &size,
const long style, const wxString &name )
{
Create( parent, id, label, pos, size, style, name );
};
bool wxCheckBox::Create( wxWindow *parent, wxWindowID id, const wxString &label,
const wxPoint &pos, const wxSize &size,
const long style, const wxString &name )
{
m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name );
m_widget = gtk_check_button_new_with_label( label );
wxSize newSize = size;
if (newSize.x == -1) newSize.x = 25+gdk_string_measure( m_widget->style->font, label );
if (newSize.y == -1) newSize.y = 26;
SetSize( newSize.x, newSize.y );
gtk_signal_connect( GTK_OBJECT(m_widget), "clicked",
GTK_SIGNAL_FUNC(gtk_checkbox_clicked_callback), (gpointer*)this );
PostCreation();
Show( TRUE );
return TRUE;
};
void wxCheckBox::SetValue( const bool state )
{
if (state)
gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), GTK_STATE_ACTIVE );
else
gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), GTK_STATE_NORMAL );
};
bool wxCheckBox::GetValue(void) const
{
GtkToggleButton *tb = GTK_TOGGLE_BUTTON(m_widget);
return tb->active;
};

198
src/gtk1/choice.cpp Normal file
View File

@@ -0,0 +1,198 @@
/////////////////////////////////////////////////////////////////////////////
// Name: choice.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 "choice.h"
#endif
#include "wx/choice.h"
//-----------------------------------------------------------------------------
// wxChoice
//-----------------------------------------------------------------------------
void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), gpointer data )
{
wxChoice *choice = (wxChoice*)data;
wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, choice->GetId());
event.SetInt( choice->GetSelection() );
wxString tmp( choice->GetStringSelection() );
event.SetString( WXSTRINGCAST(tmp) );
event.SetEventObject(choice);
choice->ProcessEvent(event);
};
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxChoice,wxWindow)
wxChoice::wxChoice(void)
{
};
wxChoice::wxChoice( wxWindow *parent, const wxWindowID id,
const wxPoint &pos, const wxSize &size,
const int n, const wxString choices[],
const long style, const wxString &name )
{
Create( parent, id, pos, size, n, choices, style, name );
};
bool wxChoice::Create( wxWindow *parent, const wxWindowID id,
const wxPoint &pos, const wxSize &size,
const int n, const wxString choices[],
const long style, const wxString &name )
{
m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name );
m_widget = gtk_option_menu_new();
wxSize newSize = size;
if (newSize.x == -1) newSize.x = 80;
if (newSize.y == -1) newSize.y = 26;
SetSize( newSize.x, newSize.y );
GtkWidget *menu;
menu = gtk_menu_new();
for (int i = 0; i < n; i++)
{
GtkWidget *item;
item = gtk_menu_item_new_with_label( choices[i] );
gtk_signal_connect( GTK_OBJECT( item ), "activate",
GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this );
gtk_menu_append( GTK_MENU(menu), item );
gtk_widget_show( item );
};
gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu );
PostCreation();
Show( TRUE );
return TRUE;
};
void wxChoice::Append( const wxString &item )
{
GtkWidget *menu = gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) );
GtkWidget *menu_item;
menu_item = gtk_menu_item_new_with_label( item );
gtk_signal_connect( GTK_OBJECT( menu_item ), "activate",
GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this );
gtk_menu_append( GTK_MENU(menu), menu_item );
gtk_widget_show( menu_item );
};
void wxChoice::Clear(void)
{
gtk_option_menu_remove_menu( GTK_OPTION_MENU(m_widget) );
GtkWidget *menu = gtk_menu_new();
gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu );
};
int wxChoice::FindString( const wxString &string ) const
{
// If you read this code once and you think you undestand
// it, then you are very wrong. RR
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
int count = 0;
GList *child = menu_shell->children;
while (child)
{
GtkBin *bin = GTK_BIN( child->data );
GtkLabel *label = GTK_LABEL(bin->child);
if (!label) label = GTK_LABEL( GTK_BUTTON(m_widget)->child );
if (string == label->label) return count;
child = child->next;
count++;
};
return -1;
};
int wxChoice::GetColumns(void) const
{
return 1;
};
int wxChoice::GetSelection(void)
{
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
int count = 0;
GList *child = menu_shell->children;
while (child)
{
GtkBin *bin = GTK_BIN( child->data );
if (!bin->child) return count;
child = child->next;
count++;
};
return -1;
};
wxString wxChoice::GetString( const int n ) const
{
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
int count = 0;
GList *child = menu_shell->children;
while (child)
{
GtkBin *bin = GTK_BIN( child->data );
if (count == n)
{
GtkLabel *label = GTK_LABEL(bin->child);
if (!label) label = GTK_LABEL( GTK_BUTTON(m_widget)->child );
return label->label;
};
child = child->next;
count++;
};
return "";
};
wxString wxChoice::GetStringSelection(void) const
{
GtkLabel *label = GTK_LABEL( GTK_BUTTON(m_widget)->child );
return label->label;
};
int wxChoice::Number(void) const
{
GtkMenu *menu = GTK_MENU( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
int count = 0;
GList *child = menu->children;
while (child)
{
count++;
child = child->next;
};
return count;
};
void wxChoice::SetColumns( const int WXUNUSED(n) )
{
};
void wxChoice::SetSelection( const int n )
{
int tmp = n;
gtk_option_menu_set_history( GTK_OPTION_MENU(m_widget), (gint)tmp );
};
void wxChoice::SetStringSelection( const wxString &string )
{
int n = FindString( string );
if (n != -1) SetSelection( n );
};

225
src/gtk1/colour.cpp Normal file
View File

@@ -0,0 +1,225 @@
/////////////////////////////////////////////////////////////////////////////
// Name: colour.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 "colour.h"
#endif
#include "wx/gdicmn.h"
#ifdef USE_GDK_IMLIB
#include "gdk_imlib.h"
#endif
//-----------------------------------------------------------------------------
// wxColour
//-----------------------------------------------------------------------------
class wxColourRefData: public wxObjectRefData
{
public:
wxColourRefData(void);
~wxColourRefData(void);
void FreeColour(void);
GdkColor m_color;
GdkColormap *m_colormap;
bool m_hasPixel;
friend wxColour;
};
wxColourRefData::wxColourRefData(void)
{
m_color.red = 0;
m_color.green = 0;
m_color.blue = 0;
m_color.pixel = 0;
m_colormap = NULL;
m_hasPixel = FALSE;
};
wxColourRefData::~wxColourRefData(void)
{
FreeColour();
};
void wxColourRefData::FreeColour(void)
{
// if (m_hasPixel) gdk_colors_free( m_colormap, &m_color, 1, 0 );
};
//-----------------------------------------------------------------------------
#define M_COLDATA ((wxColourRefData *)m_refData)
#define SHIFT (8*(sizeof(short int)-sizeof(char)))
IMPLEMENT_DYNAMIC_CLASS(wxColour,wxGDIObject)
wxColour::wxColour(void)
{
};
wxColour::wxColour( char red, char green, char blue )
{
m_refData = new wxColourRefData();
M_COLDATA->m_color.red = ((unsigned short)red) << SHIFT;
M_COLDATA->m_color.green = ((unsigned short)green) << SHIFT;
M_COLDATA->m_color.blue = ((unsigned short)blue) << SHIFT;
M_COLDATA->m_color.pixel = 0;
};
wxColour::wxColour( const wxString &colourName )
{
wxNode *node = NULL;
if ( (wxTheColourDatabase) && (node = wxTheColourDatabase->Find(colourName)) )
{
wxColour *col = (wxColour*)node->Data();
UnRef();
if (col) Ref( *col );
}
else
{
m_refData = new wxColourRefData();
if (!gdk_color_parse( colourName, &M_COLDATA->m_color ))
{
delete m_refData;
m_refData = NULL;
};
};
};
wxColour::wxColour( const wxColour& col )
{
Ref( col );
};
wxColour::wxColour( const wxColour* col )
{
if (col) Ref( *col );
};
wxColour::~wxColour(void)
{
};
wxColour& wxColour::operator = ( const wxColour& col )
{
if (*this == col) return (*this);
Ref( col );
return *this;
};
wxColour& wxColour::operator = ( const wxString& colourName )
{
UnRef();
wxNode *node = NULL;
if ((wxTheColourDatabase) && (node = wxTheColourDatabase->Find(colourName)) )
{
wxColour *col = (wxColour*)node->Data();
if (col) Ref( *col );
}
else
{
m_refData = new wxColourRefData();
if (!gdk_color_parse( colourName, &M_COLDATA->m_color ))
{
delete m_refData;
m_refData = NULL;
};
};
return *this;
};
bool wxColour::operator == ( const wxColour& col )
{
return m_refData == col.m_refData;
};
bool wxColour::operator != ( const wxColour& col)
{
return m_refData != col.m_refData;
};
void wxColour::Set( const unsigned char red, const unsigned char green, const unsigned char blue )
{
UnRef();
m_refData = new wxColourRefData();
M_COLDATA->m_color.red = ((unsigned short)red) << SHIFT;
M_COLDATA->m_color.green = ((unsigned short)green) << SHIFT;
M_COLDATA->m_color.blue = ((unsigned short)blue) << SHIFT;
M_COLDATA->m_color.pixel = 0;
};
unsigned char wxColour::Red(void) const
{
if (!Ok()) return 0;
return (unsigned char)(M_COLDATA->m_color.red >> SHIFT);
};
unsigned char wxColour::Green(void) const
{
if (!Ok()) return 0;
return (unsigned char)(M_COLDATA->m_color.green >> SHIFT);
};
unsigned char wxColour::Blue(void) const
{
if (!Ok()) return 0;
return (unsigned char)(M_COLDATA->m_color.blue >> SHIFT);
};
bool wxColour::Ok(void) const
{
return (m_refData);
};
void wxColour::CalcPixel( GdkColormap *cmap )
{
if (!Ok()) return;
if ((M_COLDATA->m_hasPixel) && (M_COLDATA->m_colormap == cmap)) return;
M_COLDATA->FreeColour();
#ifdef USE_GDK_IMLIB
int r = M_COLDATA->m_color.red >> SHIFT;
int g = M_COLDATA->m_color.green >> SHIFT;
int b = M_COLDATA->m_color.blue >> SHIFT;
M_COLDATA->m_hasPixel = TRUE;
M_COLDATA->m_color.pixel = gdk_imlib_best_color_match( &r, &g, &b );
#else
M_COLDATA->m_hasPixel = gdk_color_alloc( cmap, &M_COLDATA->m_color );
#endif
M_COLDATA->m_colormap = cmap;
};
int wxColour::GetPixel(void)
{
if (!Ok()) return 0;
return M_COLDATA->m_color.pixel;
};
GdkColor *wxColour::GetColor(void)
{
if (!Ok()) return NULL;
return &M_COLDATA->m_color;
};

51
src/gtk1/control.cpp Normal file
View File

@@ -0,0 +1,51 @@
/////////////////////////////////////////////////////////////////////////////
// Name: control.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 "control.h"
#endif
#include "wx/control.h"
//-----------------------------------------------------------------------------
// wxControl
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxControl,wxWindow)
wxControl::wxControl(void)
{
m_label = "";
m_needParent = TRUE;
};
wxControl::wxControl( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size,
const long style, const wxString &name ) :
wxWindow( parent, id, pos, size, style, name )
{
};
void wxControl::Command( wxCommandEvent &WXUNUSED(event) )
{
};
void wxControl::SetLabel( const wxString &label )
{
m_label = label;
};
wxString wxControl::GetLabel(void) const
{
return m_label;
};

6
src/gtk1/cross.xbm Normal file
View File

@@ -0,0 +1,6 @@
#define cross_width 15
#define cross_height 15
static char cross_bits[] = {
0x84, 0x10, 0x84, 0x10, 0xff, 0x7f, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10,
0x84, 0x10, 0xff, 0x7f, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10,
0xff, 0x7f, 0x84, 0x10, 0x84, 0x10};

173
src/gtk1/cursor.cpp Normal file
View File

@@ -0,0 +1,173 @@
/////////////////////////////////////////////////////////////////////////////
// Name: cursor.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 "cursor.h"
#endif
#include "wx/cursor.h"
//-----------------------------------------------------------------------------
// wxCursor
//-----------------------------------------------------------------------------
class wxCursorRefData: public wxObjectRefData
{
public:
wxCursorRefData(void);
~wxCursorRefData(void);
GdkCursor *m_cursor;
};
wxCursorRefData::wxCursorRefData(void)
{
m_cursor = NULL;
};
wxCursorRefData::~wxCursorRefData(void)
{
if (m_cursor) gdk_cursor_destroy( m_cursor );
};
//-----------------------------------------------------------------------------
#define M_CURSORDATA ((wxCursorRefData *)m_refData)
IMPLEMENT_DYNAMIC_CLASS(wxCursor,wxObject)
wxCursor::wxCursor(void)
{
};
wxCursor::wxCursor( const int cursorId )
{
m_refData = new wxCursorRefData();
GdkCursorType gdk_cur = GDK_LEFT_PTR;
switch (cursorId)
{
case wxCURSOR_HAND: gdk_cur = GDK_HAND1; break;
case wxCURSOR_CROSS: gdk_cur = GDK_CROSSHAIR; break;
case wxCURSOR_SIZEWE: gdk_cur = GDK_SB_H_DOUBLE_ARROW; break;
case wxCURSOR_SIZENS: gdk_cur = GDK_SB_V_DOUBLE_ARROW; break;
case wxCURSOR_WAIT: gdk_cur = GDK_WATCH; break;
case wxCURSOR_WATCH: gdk_cur = GDK_WATCH; break;
case wxCURSOR_SIZING: gdk_cur = GDK_SIZING; break;
case wxCURSOR_SPRAYCAN: gdk_cur = GDK_SPRAYCAN; break;
case wxCURSOR_IBEAM: gdk_cur = GDK_XTERM; break;
case wxCURSOR_PENCIL: gdk_cur = GDK_PENCIL; break;
case wxCURSOR_NO_ENTRY: gdk_cur = GDK_PIRATE; break;
};
M_CURSORDATA->m_cursor = gdk_cursor_new( gdk_cur );
/*
do that yourself
wxCURSOR_BULLSEYE,
wxCURSOR_CHAR,
wxCURSOR_LEFT_BUTTON,
wxCURSOR_MAGNIFIER,
wxCURSOR_MIDDLE_BUTTON,
wxCURSOR_NO_ENTRY,
wxCURSOR_PAINT_BRUSH,
wxCURSOR_POINT_LEFT,
wxCURSOR_POINT_RIGHT,
wxCURSOR_QUESTION_ARROW,
wxCURSOR_RIGHT_BUTTON,
wxCURSOR_SIZENESW,
wxCURSOR_SIZENS,
wxCURSOR_SIZENWSE,
wxCURSOR_SIZEWE,
wxCURSOR_BLANK
,
wxCURSOR_CROSS_REVERSE,
wxCURSOR_DOUBLE_ARROW,
wxCURSOR_BASED_ARROW_UP,
wxCURSOR_BASED_ARROW_DOWN
*/
};
wxCursor::wxCursor( const wxCursor &cursor )
{
Ref( cursor );
};
wxCursor::wxCursor( const wxCursor *cursor )
{
UnRef();
if (cursor) Ref( *cursor );
};
wxCursor::~wxCursor(void)
{
};
wxCursor& wxCursor::operator = ( const wxCursor& cursor )
{
if (*this == cursor) return (*this);
Ref( cursor );
return *this;
};
bool wxCursor::operator == ( const wxCursor& cursor )
{
return m_refData == cursor.m_refData;
};
bool wxCursor::operator != ( const wxCursor& cursor )
{
return m_refData != cursor.m_refData;
};
bool wxCursor::Ok(void) const
{
return TRUE;
};
GdkCursor *wxCursor::GetCursor(void) const
{
return M_CURSORDATA->m_cursor;
};
//-----------------------------------------------------------------------------
// busy cursor routines
//-----------------------------------------------------------------------------
bool g_isBusy = FALSE;
void wxEndBusyCursor(void)
{
g_isBusy = FALSE;
};
void wxBeginBusyCursor( wxCursor *WXUNUSED(cursor) )
{
g_isBusy = TRUE;
};
bool wxIsBusy(void)
{
return g_isBusy;
};
void wxSetCursor( const wxCursor& cursor )
{
extern wxCursor *g_globalCursor;
if (g_globalCursor) (*g_globalCursor) = cursor;
if (cursor.Ok()) {};
};

705
src/gtk1/data.cpp Normal file
View File

@@ -0,0 +1,705 @@
/////////////////////////////////////////////////////////////////////////////
// Name: data.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
#endif
#include "wx/wx.h"
#define _MAXPATHLEN 500
// Used for X resources
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xresource.h>
wxList wxResourceCache(wxKEY_STRING);
XrmDatabase wxResourceDatabase;
// Useful buffer, initialized in wxCommonInit
char *wxBuffer = NULL;
// Windows List
wxList wxTopLevelWindows;
// List of windows pending deletion
wxList wxPendingDelete;
// Current cursor, in order to hang on to
// cursor handle when setting the cursor globally
wxCursor *g_globalCursor = NULL;
// Don't allow event propagation during drag
bool g_blockEventsOnDrag = FALSE;
// Message Strings for Internationalization
char **wx_msg_str = (char**)NULL;
// Custom OS version, as optionally placed in wx.ini/.wxrc
// Currently this can be Win95, Windows, Win32s, WinNT.
// For some systems, you can't tell until run-time what services you
// have. See wxGetOsVersion, which uses this string if present.
char *wxOsVersion = NULL;
// For printing several pages
int wxPageNumber;
wxPrintPaperDatabase* wxThePrintPaperDatabase = NULL;
// GDI Object Lists
wxBrushList *wxTheBrushList = NULL;
wxPenList *wxThePenList = NULL;
wxFontList *wxTheFontList = NULL;
wxColourDatabase *wxTheColourDatabase = NULL;
wxBitmapList *wxTheBitmapList = NULL;
// X only font names
wxFontNameDirectory wxTheFontNameDirectory;
// Stock objects
wxFont *wxNORMAL_FONT;
wxFont *wxSMALL_FONT;
wxFont *wxITALIC_FONT;
wxFont *wxSWISS_FONT;
wxPen *wxRED_PEN;
wxPen *wxCYAN_PEN;
wxPen *wxGREEN_PEN;
wxPen *wxBLACK_PEN;
wxPen *wxWHITE_PEN;
wxPen *wxTRANSPARENT_PEN;
wxPen *wxBLACK_DASHED_PEN;
wxPen *wxGREY_PEN;
wxPen *wxMEDIUM_GREY_PEN;
wxPen *wxLIGHT_GREY_PEN;
wxBrush *wxBLUE_BRUSH;
wxBrush *wxGREEN_BRUSH;
wxBrush *wxWHITE_BRUSH;
wxBrush *wxBLACK_BRUSH;
wxBrush *wxTRANSPARENT_BRUSH;
wxBrush *wxCYAN_BRUSH;
wxBrush *wxRED_BRUSH;
wxBrush *wxGREY_BRUSH;
wxBrush *wxMEDIUM_GREY_BRUSH;
wxBrush *wxLIGHT_GREY_BRUSH;
wxColour *wxBLACK;
wxColour *wxWHITE;
wxColour *wxGREY; // Robert Roebling
wxColour *wxRED;
wxColour *wxBLUE;
wxColour *wxGREEN;
wxColour *wxCYAN;
wxColour *wxLIGHT_GREY;
wxCursor *wxSTANDARD_CURSOR = NULL;
wxCursor *wxHOURGLASS_CURSOR = NULL;
wxCursor *wxCROSS_CURSOR = NULL;
// 'Null' objects
wxBitmap wxNullBitmap;
wxIcon wxNullIcon;
wxCursor wxNullCursor;
wxPen wxNullPen;
wxBrush wxNullBrush;
wxFont wxNullFont;
wxColour wxNullColour;
wxPalette wxNullPalette;
// Default window names
const char *wxButtonNameStr = "button";
const char *wxCanvasNameStr = "canvas";
const char *wxCheckBoxNameStr = "check";
const char *wxChoiceNameStr = "choice";
const char *wxComboBoxNameStr = "comboBox";
const char *wxDialogNameStr = "dialog";
const char *wxFrameNameStr = "frame";
const char *wxGaugeNameStr = "gauge";
const char *wxStaticBoxNameStr = "groupBox";
const char *wxListBoxNameStr = "listBox";
const char *wxStaticTextNameStr = "message";
const char *wxStaticBitmapNameStr = "message";
const char *wxMultiTextNameStr = "multitext";
const char *wxPanelNameStr = "panel";
const char *wxRadioBoxNameStr = "radioBox";
const char *wxRadioButtonNameStr = "radioButton";
const char *wxBitmapRadioButtonNameStr = "radioButton";
const char *wxScrollBarNameStr = "scrollBar";
const char *wxSliderNameStr = "slider";
const char *wxStaticNameStr = "static";
const char *wxTextCtrlWindowNameStr = "textWindow";
const char *wxTextCtrlNameStr = "text";
const char *wxVirtListBoxNameStr = "virtListBox";
const char *wxButtonBarNameStr = "buttonbar";
const char *wxEnhDialogNameStr = "Shell";
const char *wxToolBarNameStr = "toolbar";
const char *wxStatusLineNameStr = "status_line";
const char *wxEmptyString = "";
const char *wxGetTextFromUserPromptStr = "Input Text";
const char *wxMessageBoxCaptionStr = "Message";
const char *wxFileSelectorPromptStr = "Select a file";
const char *wxFileSelectorDefaultWildcardStr = "*.*";
const char *wxInternalErrorStr = "wxWindows Internal Error";
const char *wxFatalErrorStr = "wxWindows Fatal Error";
// See wx/utils.h
const char *wxFloatToStringStr = "%.2f";
const char *wxDoubleToStringStr = "%.2f";
#ifdef wx_msw
const char *wxUserResourceStr = "TEXT";
#endif
#if USE_SHARED_LIBRARY
/*
* For wxWindows to be made into a dynamic library (e.g. Sun),
* all IMPLEMENT_... macros must be in one place.
* But normally, the definitions are in the appropriate places.
*/
// Hand-coded IMPLEMENT... macro for wxObject (define static data)
wxClassInfo wxObject::classwxObject("wxObject", NULL, NULL, sizeof(wxObject), NULL);
wxClassInfo *wxClassInfo::first = NULL;
#include "wx/button.h"
#include "wx/bmpbuttn.h"
IMPLEMENT_DYNAMIC_CLASS(wxButton, wxControl)
IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton, wxButton)
#include "wx/checkbox.h"
IMPLEMENT_DYNAMIC_CLASS(wxCheckBox, wxControl)
IMPLEMENT_DYNAMIC_CLASS(wxBitmapCheckBox, wxCheckBox)
#include "wx/choice.h"
IMPLEMENT_DYNAMIC_CLASS(wxChoice, wxControl)
#if USE_CLIPBOARD
#include "wx/clipbrd.h"
IMPLEMENT_DYNAMIC_CLASS(wxClipboard, wxObject)
IMPLEMENT_ABSTRACT_CLASS(wxClipboardClient, wxObject)
#endif
#if USE_COMBOBOX
#include "wx/combobox.h"
IMPLEMENT_DYNAMIC_CLASS(wxComboBox, wxControl)
#endif
#include "wx/dc.h"
#include "wx/dcmemory.h"
#include "wx/dcclient.h"
#include "wx/dcscreen.h"
IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxClientDC, wxDC)
IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC)
IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxDC)
IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC, wxDC)
IMPLEMENT_DYNAMIC_CLASS(wxScreenDC, wxWindowDC)
#if defined(wx_msw)
#include "wx/dcprint.h"
IMPLEMENT_CLASS(wxPrinterDC, wxDC)
#endif
#include "wx/dialog.h"
IMPLEMENT_DYNAMIC_CLASS(wxDialog, wxWindow)
#include "wx/frame.h"
IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxWindow)
#include "wx/mdi.h"
IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame, wxFrame)
IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame, wxFrame)
IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow, wxWindow)
#include "wx/cmndata.h"
IMPLEMENT_DYNAMIC_CLASS(wxColourData, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxFontData, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxPrintData, wxObject)
#include "wx/colordlg.h"
#include "wx/fontdlg.h"
#if !defined(wx_msw) || USE_GENERIC_DIALOGS_IN_MSW
#include "wx/generic/colordlg.h"
#include "wx/generic/fontdlg.h"
IMPLEMENT_DYNAMIC_CLASS(wxGenericColourDialog, wxDialog)
IMPLEMENT_DYNAMIC_CLASS(wxGenericFontDialog, wxDialog)
#endif
// X defines wxColourDialog to be wxGenericColourDialog
#ifndef wx_x
IMPLEMENT_DYNAMIC_CLASS(wxColourDialog, wxDialog)
IMPLEMENT_DYNAMIC_CLASS(wxFontDialog, wxDialog)
#endif
#include "wx/gdicmn.h"
#include "wx/pen.h"
#include "wx/brush.h"
#include "wx/font.h"
#include "wx/palette.h"
#include "wx/icon.h"
#include "wx/cursor.h"
IMPLEMENT_DYNAMIC_CLASS(wxColour, wxObject)
IMPLEMENT_CLASS(wxColourDatabase, wxList)
IMPLEMENT_DYNAMIC_CLASS(wxFontList, wxList)
IMPLEMENT_DYNAMIC_CLASS(wxPenList, wxList)
IMPLEMENT_DYNAMIC_CLASS(wxBrushList, wxList)
IMPLEMENT_DYNAMIC_CLASS(wxBitmapList, wxList)
#if (!USE_TYPEDEFS)
IMPLEMENT_DYNAMIC_CLASS(wxPoint, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxIntPoint, wxObject)
#endif
#if defined(wx_x) || (defined(wx_msw) && USE_PORTABLE_FONTS_IN_MSW)
IMPLEMENT_DYNAMIC_CLASS(wxFontNameDirectory, wxObject)
#endif
#include "wx/hash.h"
IMPLEMENT_DYNAMIC_CLASS(wxHashTable, wxObject)
#include "wx/help.h"
IMPLEMENT_DYNAMIC_CLASS(wxHelpInstance, wxClient)
IMPLEMENT_CLASS(wxHelpConnection, wxConnection)
#include "wx/list.h"
IMPLEMENT_DYNAMIC_CLASS(wxNode, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxList, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxStringList, wxList)
#if USE_PRINTING_ARCHITECTURE
#include "wx/print.h"
IMPLEMENT_DYNAMIC_CLASS(wxPrintDialog, wxDialog)
IMPLEMENT_DYNAMIC_CLASS(wxPrinterBase, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxPostScriptPrinter, wxPrinterBase)
IMPLEMENT_DYNAMIC_CLASS(wxWindowsPrinter, wxPrinterBase)
IMPLEMENT_ABSTRACT_CLASS(wxPrintout, wxObject)
IMPLEMENT_CLASS(wxPreviewCanvas, wxWindow)
IMPLEMENT_CLASS(wxPreviewControlBar, wxWindow)
IMPLEMENT_CLASS(wxPreviewFrame, wxFrame)
IMPLEMENT_CLASS(wxPrintPreviewBase, wxObject)
IMPLEMENT_CLASS(wxPostScriptPrintPreview, wxPrintPreviewBase)
IMPLEMENT_CLASS(wxWindowsPrintPreview, wxPrintPreviewBase)
IMPLEMENT_CLASS(wxGenericPrintDialog, wxDialog)
IMPLEMENT_CLASS(wxGenericPrintSetupDialog, wxDialog)
#endif
#if USE_POSTSCRIPT
#include "wx/postscrp.h"
IMPLEMENT_DYNAMIC_CLASS(wxPostScriptDC, wxDC)
IMPLEMENT_DYNAMIC_CLASS(wxPrintSetupData, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxPageSetupData, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxPrintPaperType, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxPrintPaperDatabase, wxList)
#endif
#if USE_WX_RESOURCES
#include "wx/resource.h"
IMPLEMENT_DYNAMIC_CLASS(wxItemResource, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxResourceTable, wxHashTable)
#endif
#include "wx/event.h"
IMPLEMENT_DYNAMIC_CLASS(wxEvtHandler, wxObject)
IMPLEMENT_ABSTRACT_CLASS(wxEvent, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxCommandEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxScrollEvent, wxCommandEvent)
IMPLEMENT_DYNAMIC_CLASS(wxMouseEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxKeyEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxSizeEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxPaintEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxEraseEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxMoveEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxFocusEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxCloseEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxMenuEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxJoystickEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxDropFilesEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxActivateEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxInitDialogEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxSysColourChangedEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxIdleEvent, wxEvent)
IMPLEMENT_DYNAMIC_CLASS(wxUpdateUIEvent, wxEvent)
#include "wx/utils.h"
IMPLEMENT_DYNAMIC_CLASS(wxPathList, wxList)
IMPLEMENT_DYNAMIC_CLASS(wxRect, wxObject)
#if USE_TIMEDATE
#include "wx/date.h"
IMPLEMENT_DYNAMIC_CLASS(wxDate, wxObject)
#endif
#if USE_DOC_VIEW_ARCHITECTURE
#include "wx/docview.h"
//IMPLEMENT_ABSTRACT_CLASS(wxDocItem, wxObject)
IMPLEMENT_ABSTRACT_CLASS(wxDocument, wxEvtHandler)
IMPLEMENT_ABSTRACT_CLASS(wxView, wxEvtHandler)
IMPLEMENT_ABSTRACT_CLASS(wxDocTemplate, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxDocManager, wxEvtHandler)
IMPLEMENT_CLASS(wxDocChildFrame, wxFrame)
IMPLEMENT_CLASS(wxDocParentFrame, wxFrame)
#if USE_PRINTING_ARCHITECTURE
IMPLEMENT_DYNAMIC_CLASS(wxDocPrintout, wxPrintout)
#endif
IMPLEMENT_CLASS(wxCommand, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxCommandProcessor, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxFileHistory, wxObject)
#endif
#if USE_CONSTRAINTS
#include "wx/layout.h"
IMPLEMENT_DYNAMIC_CLASS(wxIndividualLayoutConstraint, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxLayoutConstraints, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxSizer, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxRowColSizer, wxSizer)
#endif
#if USE_TOOLBAR
#include "wx/tbarbase.h"
IMPLEMENT_DYNAMIC_CLASS(wxToolBarTool, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxToolBarBase, wxControl)
#include "wx/tbarsmpl.h"
IMPLEMENT_DYNAMIC_CLASS(wxToolBarSimple, wxToolBarBase)
#ifdef wx_msw
#include "wx/tbarmsw.h"
IMPLEMENT_DYNAMIC_CLASS(wxToolBarMSW, wxToolBarBase)
#include "wx/tbar95.h"
IMPLEMENT_DYNAMIC_CLASS(wxToolBar95, wxToolBarBase)
#endif
#endif
#include "wx/statusbr.h"
IMPLEMENT_DYNAMIC_CLASS(wxStatusBar, wxWindow)
BEGIN_EVENT_TABLE(wxStatusBar, wxWindow)
EVT_PAINT(wxStatusBar::OnPaint)
EVT_SYS_COLOUR_CHANGED(wxStatusBar::OnSysColourChanged)
END_EVENT_TABLE()
#if USE_TIMEDATE
#include "wx/time.h"
IMPLEMENT_DYNAMIC_CLASS(wxTime, wxObject)
#endif
#if !USE_GNU_WXSTRING
#include "wx/string.h"
IMPLEMENT_DYNAMIC_CLASS(wxString, wxObject)
#endif
#ifdef wx_motif
IMPLEMENT_DYNAMIC_CLASS(wxXColormap, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxXFont, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxXCursor, wxObject)
#endif
IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject)
IMPLEMENT_DYNAMIC_CLASS(wxPalette, wxGDIObject)
IMPLEMENT_DYNAMIC_CLASS(wxPen, wxGDIObject)
IMPLEMENT_DYNAMIC_CLASS(wxBrush, wxGDIObject)
IMPLEMENT_DYNAMIC_CLASS(wxIcon, wxBitmap)
IMPLEMENT_DYNAMIC_CLASS(wxCursor, wxBitmap)
IMPLEMENT_DYNAMIC_CLASS(wxBitmap, wxGDIObject)
IMPLEMENT_DYNAMIC_CLASS(wxMask, wxObject)
// This will presumably be implemented on other platforms too
#ifdef wx_msw
IMPLEMENT_DYNAMIC_CLASS(wxBitmapHandler, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxBMPResourceHandler, wxBitmapHandler)
IMPLEMENT_DYNAMIC_CLASS(wxBMPFileHandler, wxBitmapHandler)
IMPLEMENT_DYNAMIC_CLASS(wxXPMFileHandler, wxBitmapHandler)
IMPLEMENT_DYNAMIC_CLASS(wxXPMDataHandler, wxBitmapHandler)
IMPLEMENT_DYNAMIC_CLASS(wxICOFileHandler, wxBitmapHandler)
IMPLEMENT_DYNAMIC_CLASS(wxICOResourceHandler, wxBitmapHandler)
#endif
#include "wx/statbox.h"
IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl)
#if USE_IPC
#include "wx/dde.h"
IMPLEMENT_ABSTRACT_CLASS(wxDDEObject, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxDDEServer, wxDDEObject)
IMPLEMENT_DYNAMIC_CLASS(wxDDEClient, wxDDEObject)
IMPLEMENT_CLASS(wxDDEConnection, wxObject)
#endif
IMPLEMENT_ABSTRACT_CLASS(wxControl, wxWindow)
#include "wx/listbox.h"
IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl)
IMPLEMENT_DYNAMIC_CLASS(wxApp, wxEvtHandler)
#include "wx/menu.h"
IMPLEMENT_DYNAMIC_CLASS(wxMenu, wxWindow)
IMPLEMENT_DYNAMIC_CLASS(wxMenuItem, wxObject)
IMPLEMENT_DYNAMIC_CLASS(wxMenuBar, wxWindow)
#include "wx/stattext.h"
#include "wx/statbmp.h"
IMPLEMENT_DYNAMIC_CLASS(wxStaticText, wxControl)
IMPLEMENT_DYNAMIC_CLASS(wxStaticBitmap, wxControl)
#if USE_METAFILE
#include "wx/metafile.h"
IMPLEMENT_DYNAMIC_CLASS(wxMetaFile, wxObject)
IMPLEMENT_ABSTRACT_CLASS(wxMetaFileDC, wxDC)
#endif
#include "wx/radiobox.h"
#include "wx/radiobut.h"
IMPLEMENT_DYNAMIC_CLASS(wxRadioBox, wxControl)
IMPLEMENT_DYNAMIC_CLASS(wxRadioButton, wxControl)
// IMPLEMENT_DYNAMIC_CLASS(wxBitmapRadioButton, wxRadioButton)
#include "wx/scrolbar.h"
IMPLEMENT_DYNAMIC_CLASS(wxScrollBar, wxControl)
#if WXWIN_COMPATIBILITY
BEGIN_EVENT_TABLE(wxScrollBar, wxControl)
EVT_SCROLL(wxScrollBar::OnScroll)
END_EVENT_TABLE()
#endif
#include "wx/slider.h"
IMPLEMENT_DYNAMIC_CLASS(wxSlider, wxControl)
#if WXWIN_COMPATIBILITY
BEGIN_EVENT_TABLE(wxSlider, wxControl)
EVT_SCROLL(wxSlider::OnScroll)
END_EVENT_TABLE()
#endif
#include "wx/timer.h"
IMPLEMENT_ABSTRACT_CLASS(wxTimer, wxObject)
#include "wx/textctrl.h"
IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl, wxControl)
#include "wx/window.h"
IMPLEMENT_DYNAMIC_CLASS(wxWindow, wxEvtHandler)
#include "wx/scrolwin.h"
IMPLEMENT_DYNAMIC_CLASS(wxScrolledWindow, wxWindow)
#include "wx/panel.h"
IMPLEMENT_DYNAMIC_CLASS(wxPanel, wxWindow)
#include "wx/msgbxdlg.h"
#include "wx/textdlg.h"
#include "wx/filedlg.h"
#include "wx/dirdlg.h"
#include "wx/choicdlg.h"
#if !defined(wx_msw) || USE_GENERIC_DIALOGS_IN_MSW
#include "wx/generic/msgdlgg.h"
IMPLEMENT_CLASS(wxGenericMessageDialog, wxDialog)
#endif
IMPLEMENT_CLASS(wxTextEntryDialog, wxDialog)
IMPLEMENT_CLASS(wxSingleChoiceDialog, wxDialog)
IMPLEMENT_CLASS(wxFileDialog, wxDialog)
IMPLEMENT_CLASS(wxDirDialog, wxDialog)
#ifdef wx_msw
IMPLEMENT_CLASS(wxMessageDialog)
#endif
#if USE_GAUGE
#ifdef wx_motif
#include "../../contrib/xmgauge/gauge.h"
#endif
#include "wx_gauge.h"
IMPLEMENT_DYNAMIC_CLASS(wxGauge, wxControl)
#endif
#include "wx/grid.h"
IMPLEMENT_DYNAMIC_CLASS(wxGenericGrid, wxPanel)
///// Event tables (also must be in one, statically-linked file for shared libraries)
// This is the base, wxEvtHandler 'bootstrap' code which is expanded manually here
const wxEventTable *wxEvtHandler::GetEventTable() const { return &wxEvtHandler::sm_eventTable; }
const wxEventTable wxEvtHandler::sm_eventTable =
{ NULL, &wxEvtHandler::sm_eventTableEntries[0] };
const wxEventTableEntry wxEvtHandler::sm_eventTableEntries[] = { { 0, 0, 0, NULL } };
BEGIN_EVENT_TABLE(wxFrame, wxWindow)
EVT_ACTIVATE(wxFrame::OnActivate)
EVT_SIZE(wxFrame::OnSize)
EVT_MENU_HIGHLIGHT_ALL(wxFrame::OnMenuHighlight)
EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged)
EVT_IDLE(wxFrame::OnIdle)
EVT_CLOSE(wxFrame::OnCloseWindow)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxDialog, wxPanel)
EVT_BUTTON(wxID_OK, wxDialog::OnOK)
EVT_BUTTON(wxID_APPLY, wxDialog::OnApply)
EVT_BUTTON(wxID_CANCEL, wxDialog::OnCancel)
EVT_CHAR_HOOK(wxDialog::OnCharHook)
EVT_SYS_COLOUR_CHANGED(wxDialog::OnSysColourChanged)
EVT_CLOSE(wxDialog::OnCloseWindow)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxWindow, wxEvtHandler)
EVT_CHAR(wxWindow::OnChar)
EVT_SIZE(wxWindow::Size)
EVT_ERASE_BACKGROUND(wxWindow::OnEraseBackground)
EVT_SYS_COLOUR_CHANGED(wxWindow::OnSysColourChanged)
EVT_INIT_DIALOG(wxWindow::OnInitDialog)
EVT_IDLE(wxWindow::OnIdle)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxScrolledWindow, wxWindow)
EVT_SCROLL(wxScrolledWindow::OnScroll)
EVT_SIZE(wxScrolledWindow::OnSize)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxPanel, wxWindow)
EVT_SYS_COLOUR_CHANGED(wxPanel::OnSysColourChanged)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
EVT_CHAR(wxTextCtrl::OnChar)
EVT_DROP_FILES(wxTextCtrl::OnDropFiles)
EVT_ERASE_BACKGROUND(wxTextCtrl::OnEraseBackground)
END_EVENT_TABLE()
#ifdef wx_msw
BEGIN_EVENT_TABLE(wxMDIParentWindow, wxFrame)
EVT_SIZE(wxMDIParentWindow::OnSize)
EVT_ACTIVATE(wxMDIParentWindow::OnActivate)
EVT_SYS_COLOUR_CHANGED(wxMDIParentWindow::OnSysColourChanged)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxMDIClientWindow, wxWindow)
EVT_SCROLL(wxMDIClientWindow::OnScroll)
END_EVENT_TABLE()
#endif
BEGIN_EVENT_TABLE(wxToolBarBase, wxControl)
EVT_SCROLL(wxToolBarBase::OnScroll)
EVT_SIZE(wxToolBarBase::OnSize)
EVT_IDLE(wxToolBarBase::OnIdle)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxToolBarSimple, wxToolBarBase)
EVT_SIZE(wxToolBarSimple::OnSize)
EVT_PAINT(wxToolBarSimple::OnPaint)
EVT_KILL_FOCUS(wxToolBarSimple::OnKillFocus)
EVT_MOUSE_EVENTS(wxToolBarSimple::OnMouseEvent)
END_EVENT_TABLE()
#ifdef wx_msw
BEGIN_EVENT_TABLE(wxToolBarMSW, wxToolBarBase)
EVT_SIZE(wxToolBarMSW::OnSize)
EVT_PAINT(wxToolBarMSW::OnPaint)
EVT_MOUSE_EVENTS(wxToolBarMSW::OnMouseEvent)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxToolBar95, wxToolBarBase)
EVT_SIZE(wxToolBar95::OnSize)
EVT_PAINT(wxToolBar95::OnPaint)
EVT_KILL_FOCUS(wxToolBar95::OnKillFocus)
EVT_MOUSE_EVENTS(wxToolBar95::OnMouseEvent)
EVT_SYS_COLOUR_CHANGED(wxToolBar95::OnSysColourChanged)
END_EVENT_TABLE()
#endif
BEGIN_EVENT_TABLE(wxGenericGrid, wxPanel)
EVT_SIZE(wxGenericGrid::OnSize)
EVT_PAINT(wxGenericGrid::OnPaint)
EVT_MOUSE_EVENTS(wxGenericGrid::OnMouseEvent)
EVT_TEXT(wxGRID_TEXT_CTRL, wxGenericGrid::OnText)
EVT_COMMAND_SCROLL(wxGRID_HSCROLL, wxGenericGrid::OnGridScroll)
EVT_COMMAND_SCROLL(wxGRID_VSCROLL, wxGenericGrid::OnGridScroll)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxControl, wxWindow)
EVT_ERASE_BACKGROUND(wxControl::OnEraseBackground)
END_EVENT_TABLE()
#if !defined(wx_msw) || USE_GENERIC_DIALOGS_IN_MSW
BEGIN_EVENT_TABLE(wxGenericMessageDialog, wxDialog)
EVT_BUTTON(wxID_YES, wxGenericMessageDialog::OnYes)
EVT_BUTTON(wxID_NO, wxGenericMessageDialog::OnNo)
EVT_BUTTON(wxID_CANCEL, wxGenericMessageDialog::OnCancel)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxGenericColourDialog, wxDialog)
EVT_BUTTON(wxID_ADD_CUSTOM, wxGenericColourDialog::OnAddCustom)
EVT_SLIDER(wxID_RED_SLIDER, wxGenericColourDialog::OnRedSlider)
EVT_SLIDER(wxID_GREEN_SLIDER, wxGenericColourDialog::OnGreenSlider)
EVT_SLIDER(wxID_BLUE_SLIDER, wxGenericColourDialog::OnBlueSlider)
EVT_PAINT(wxGenericColourDialog::OnPaint)
EVT_MOUSE_EVENTS(wxGenericColourDialog::OnMouseEvent)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxGenericFontDialog, wxDialog)
EVT_CHECKBOX(wxID_FONT_UNDERLINE, wxGenericFontDialog::OnChangeFont)
EVT_CHOICE(wxID_FONT_STYLE, wxGenericFontDialog::OnChangeFont)
EVT_CHOICE(wxID_FONT_WEIGHT, wxGenericFontDialog::OnChangeFont)
EVT_CHOICE(wxID_FONT_FAMILY, wxGenericFontDialog::OnChangeFont)
EVT_CHOICE(wxID_FONT_COLOUR, wxGenericFontDialog::OnChangeFont)
EVT_CHOICE(wxID_FONT_SIZE, wxGenericFontDialog::OnChangeFont)
EVT_PAINT(wxGenericFontDialog::OnPaint)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxGenericPrintDialog, wxDialog)
EVT_BUTTON(wxID_OK, wxGenericPrintDialog::OnOK)
EVT_BUTTON(wxPRINTID_SETUP, wxGenericPrintDialog::OnSetup)
EVT_RADIOBOX(wxPRINTID_RANGE, wxGenericPrintDialog::OnRange)
END_EVENT_TABLE()
#endif
BEGIN_EVENT_TABLE(wxTextEntryDialog, wxDialog)
EVT_BUTTON(wxID_OK, wxTextEntryDialog::OnOK)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxSingleChoiceDialog, wxDialog)
EVT_BUTTON(wxID_OK, wxSingleChoiceDialog::OnOK)
END_EVENT_TABLE()
#include "wx/prntbase.h"
BEGIN_EVENT_TABLE(wxPrintAbortDialog, wxDialog)
EVT_BUTTON(wxID_CANCEL, wxPrintAbortDialog::OnCancel)
END_EVENT_TABLE()
BEGIN_EVENT_TABLE(wxPreviewControlBar, wxWindow)
EVT_BUTTON(wxID_PREVIEW_CLOSE, wxPreviewControlBar::OnClose)
EVT_BUTTON(wxID_PREVIEW_PRINT, wxPreviewControlBar::OnPrint)
EVT_BUTTON(wxID_PREVIEW_PREVIOUS, wxPreviewControlBar::OnPrevious)
EVT_BUTTON(wxID_PREVIEW_NEXT, wxPreviewControlBar::OnNext)
EVT_CHOICE(wxID_PREVIEW_ZOOM, wxPreviewControlBar::OnZoom)
END_EVENT_TABLE()
#endif
const wxSize wxDefaultSize(-1, -1);
const wxPoint wxDefaultPosition(-1, -1);

370
src/gtk1/dc.cpp Normal file
View File

@@ -0,0 +1,370 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dc.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 "dc.h"
#endif
#include "wx/dc.h"
//-----------------------------------------------------------------------------
// constants
//-----------------------------------------------------------------------------
#define mm2inches 0.0393700787402
#define inches2mm 25.4
#define mm2twips 56.6929133859
#define twips2mm 0.0176388888889
#define mm2pt 2.83464566929
#define pt2mm 0.352777777778
//-----------------------------------------------------------------------------
// wxDC
//-----------------------------------------------------------------------------
IMPLEMENT_ABSTRACT_CLASS(wxDC,wxObject)
wxDC::wxDC(void)
{
m_ok = FALSE;
m_optimize = FALSE;
m_autoSetting = FALSE;
m_colour = TRUE;
m_clipping = FALSE;
m_mm_to_pix_x = 1.0;
m_mm_to_pix_y = 1.0;
m_logicalOriginX = 0;
m_logicalOriginY = 0;
m_deviceOriginX = 0;
m_deviceOriginY = 0;
m_internalDeviceOriginX = 0;
m_internalDeviceOriginY = 0;
m_externalDeviceOriginX = 0;
m_externalDeviceOriginY = 0;
m_logicalScaleX = 1.0;
m_logicalScaleY = 1.0;
m_userScaleX = 1.0;
m_userScaleY = 1.0;
m_scaleX = 1.0;
m_scaleY = 1.0;
m_mappingMode = MM_TEXT;
m_needComputeScaleX = FALSE;
m_needComputeScaleY = FALSE;
m_signX = 1; // default x-axis left to right
m_signY = 1; // default y-axis top down
m_maxX = m_maxY = -100000;
m_minY = m_minY = 100000;
m_logicalFunction = wxCOPY;
// m_textAlignment = wxALIGN_TOP_LEFT;
m_backgroundMode = wxTRANSPARENT;
m_textForegroundColour = *wxBLACK;
m_textBackgroundColour = *wxWHITE;
m_pen = *wxBLACK_PEN;
m_font = *wxNORMAL_FONT;
m_brush = *wxTRANSPARENT_BRUSH;
m_backgroundBrush = *wxWHITE_BRUSH;
// m_palette = wxAPP_COLOURMAP;
};
wxDC::~wxDC(void)
{
};
void wxDC::DrawArc( long WXUNUSED(x1), long WXUNUSED(y1), long WXUNUSED(x2), long WXUNUSED(y2),
double WXUNUSED(xc), double WXUNUSED(yc) )
{
};
void wxDC::DrawIcon( const wxIcon &WXUNUSED(icon), long WXUNUSED(x), long WXUNUSED(y), bool WXUNUSED(useMask) )
{
};
void wxDC::DrawPoint( wxPoint& point )
{
DrawPoint( point.x, point.y );
};
void wxDC::DrawPolygon( wxList *list, long xoffset, long yoffset, int fillStyle )
{
int n = list->Number();
wxPoint *points = new wxPoint[n];
int i = 0;
for( wxNode *node = list->First(); node; node = node->Next() )
{
wxPoint *point = (wxPoint *)node->Data();
points[i].x = point->x;
points[i++].y = point->y;
};
DrawPolygon( n, points, xoffset, yoffset, fillStyle );
delete[] points;
};
void wxDC::DrawLines( wxList *list, long xoffset, long yoffset )
{
int n = list->Number();
wxPoint *points = new wxPoint[n];
int i = 0;
for( wxNode *node = list->First(); node; node = node->Next() )
{
wxPoint *point = (wxPoint *)node->Data();
points[i].x = point->x;
points[i++].y = point->y;
};
DrawLines( n, points, xoffset, yoffset );
delete []points;
};
void wxDC::DrawSpline( long x1, long y1, long x2, long y2, long x3, long y3 )
{
wxList list;
list.DeleteContents(TRUE);
list.Append( new wxPoint(x1, y1) );
list.Append( new wxPoint(x2, y2) );
list.Append( new wxPoint(x3, y3) );
DrawSpline(&list);
};
void wxDC::DrawSpline( wxList *points )
{
DrawOpenSpline( points );
};
void wxDC::DrawSpline( int n, wxPoint points[] )
{
wxList list;
for (int i = 0; i < n; i++) list.Append( (wxObject*)&points[i] );
DrawSpline( &list );
};
void wxDC::SetClippingRegion( long x, long y, long width, long height )
{
m_clipping = TRUE;
m_clipX1 = x;
m_clipY1 = y;
m_clipX2 = x + width;
m_clipY2 = y + height;
};
void wxDC::DestroyClippingRegion(void)
{
m_clipping = FALSE;
};
void wxDC::GetClippingBox( long *x, long *y, long *width, long *height ) const
{
if (m_clipping)
{
if (x) *x = m_clipX1;
if (y) *y = m_clipY1;
if (width) *width = (m_clipX2 - m_clipX1);
if (height) *height = (m_clipY2 - m_clipY1);
}
else
*x = *y = *width = *height = 0;
};
void wxDC::GetSize( int* width, int* height ) const
{
*width = m_maxX-m_minX;
*height = m_maxY-m_minY;
};
void wxDC::GetSizeMM( long* width, long* height ) const
{
int w = 0;
int h = 0;
GetSize( &w, &h );
*width = long( double(w) / (m_scaleX*m_mm_to_pix_x) );
*height = long( double(h) / (m_scaleY*m_mm_to_pix_y) );
};
void wxDC::SetTextForeground( const wxColour &col )
{
if (!Ok()) return;
m_textForegroundColour = col;
};
void wxDC::SetTextBackground( const wxColour &col )
{
if (!Ok()) return;
m_textBackgroundColour = col;
};
void wxDC::SetMapMode( int mode )
{
switch (mode)
{
case MM_TWIPS:
SetLogicalScale( twips2mm*m_mm_to_pix_x, twips2mm*m_mm_to_pix_y );
break;
case MM_POINTS:
SetLogicalScale( pt2mm*m_mm_to_pix_x, pt2mm*m_mm_to_pix_y );
break;
case MM_METRIC:
SetLogicalScale( m_mm_to_pix_x, m_mm_to_pix_y );
break;
case MM_LOMETRIC:
SetLogicalScale( m_mm_to_pix_x/10.0, m_mm_to_pix_y/10.0 );
break;
default:
case MM_TEXT:
SetLogicalScale( 1.0, 1.0 );
break;
};
if (mode != MM_TEXT)
{
m_needComputeScaleX = TRUE;
m_needComputeScaleY = TRUE;
};
};
void wxDC::SetUserScale( double x, double y )
{
// allow negative ? -> no
m_userScaleX = x;
m_userScaleY = y;
ComputeScaleAndOrigin();
};
void wxDC::GetUserScale( double *x, double *y )
{
if (x) *x = m_userScaleX;
if (y) *y = m_userScaleY;
};
void wxDC::SetLogicalScale( double x, double y )
{
// allow negative ?
m_logicalScaleX = x;
m_logicalScaleY = y;
ComputeScaleAndOrigin();
};
void wxDC::GetLogicalScale( double *x, double *y )
{
if (x) *x = m_logicalScaleX;
if (y) *y = m_logicalScaleY;
};
void wxDC::SetLogicalOrigin( long x, long y )
{
m_logicalOriginX = x * m_signX; // is this still correct ?
m_logicalOriginY = y * m_signY;
ComputeScaleAndOrigin();
};
void wxDC::GetLogicalOrigin( long *x, long *y )
{
if (x) *x = m_logicalOriginX;
if (y) *y = m_logicalOriginY;
};
void wxDC::SetDeviceOrigin( long x, long y )
{
m_externalDeviceOriginX = x;
m_externalDeviceOriginY = y;
ComputeScaleAndOrigin();
};
void wxDC::GetDeviceOrigin( long *x, long *y )
{
if (x) *x = m_externalDeviceOriginX;
if (y) *y = m_externalDeviceOriginY;
};
void wxDC::SetInternalDeviceOrigin( long x, long y )
{
m_internalDeviceOriginX = x;
m_internalDeviceOriginY = y;
ComputeScaleAndOrigin();
};
void wxDC::GetInternalDeviceOrigin( long *x, long *y )
{
if (x) *x = m_internalDeviceOriginX;
if (y) *y = m_internalDeviceOriginY;
};
void wxDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
{
m_signX = (xLeftRight ? 1 : -1);
m_signY = (yBottomUp ? -1 : 1);
ComputeScaleAndOrigin();
};
long wxDC::DeviceToLogicalX(long x) const
{
return XDEV2LOG(x);
};
long wxDC::DeviceToLogicalY(long y) const
{
return YDEV2LOG(y);
};
long wxDC::DeviceToLogicalXRel(long x) const
{
return XDEV2LOGREL(x);
};
long wxDC::DeviceToLogicalYRel(long y) const
{
return YDEV2LOGREL(y);
};
long wxDC::LogicalToDeviceX(long x) const
{
return XLOG2DEV(x);
};
long wxDC::LogicalToDeviceY(long y) const
{
return YLOG2DEV(y);
};
long wxDC::LogicalToDeviceXRel(long x) const
{
return XLOG2DEVREL(x);
};
long wxDC::LogicalToDeviceYRel(long y) const
{
return YLOG2DEVREL(y);
};
void wxDC::CalcBoundingBox( long x, long y )
{
if (x < m_minX) m_minX = x;
if (y < m_minY) m_minY = y;
if (x > m_maxX) m_maxX = x;
if (y > m_maxY) m_maxY = y;
};
void wxDC::ComputeScaleAndOrigin(void)
{
m_scaleX = m_logicalScaleX * m_userScaleX;
m_scaleY = m_logicalScaleY * m_userScaleY;
m_deviceOriginX = m_internalDeviceOriginX + m_externalDeviceOriginX;
m_deviceOriginY = m_internalDeviceOriginY + m_externalDeviceOriginY;
};

773
src/gtk1/dcclient.cpp Normal file
View File

@@ -0,0 +1,773 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dcclient.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 "dcclient.h"
#endif
#include "wx/dcclient.h"
//-----------------------------------------------------------------------------
// local data
//-----------------------------------------------------------------------------
#include "bdiag.xbm"
#include "fdiag.xbm"
#include "cdiag.xbm"
#include "horiz.xbm"
#include "verti.xbm"
#include "cross.xbm"
#define num_hatches 6
static GdkPixmap *hatches[num_hatches];
static GdkPixmap **hatch_bitmap = NULL;
//-----------------------------------------------------------------------------
// constants
//-----------------------------------------------------------------------------
#define RAD2DEG 57.2957795131
//-----------------------------------------------------------------------------
// wxPaintDC
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxPaintDC,wxDC)
wxPaintDC::wxPaintDC(void)
{
};
wxPaintDC::wxPaintDC( wxWindow *window )
{
if (!window) return;
GtkWidget *widget = window->m_wxwindow;
if (!widget) return;
m_window = widget->window;
if (!m_window) return;
if (window->m_wxwindow)
m_cmap = gtk_widget_get_colormap( window->m_wxwindow );
else
m_cmap = gtk_widget_get_colormap( window->m_widget );
SetUpDC();
long x = 0;
long y = 0;
window->GetDrawingOffset( &x, &y );
SetInternalDeviceOrigin( -x, -y );
};
wxPaintDC::~wxPaintDC(void)
{
};
void wxPaintDC::FloodFill( long WXUNUSED(x1), long WXUNUSED(y1),
wxColour *WXUNUSED(col), int WXUNUSED(style) )
{
};
bool wxPaintDC::GetPixel( long WXUNUSED(x1), long WXUNUSED(y1), wxColour *WXUNUSED(col) ) const
{
return FALSE;
};
void wxPaintDC::DrawLine( long x1, long y1, long x2, long y2 )
{
if (!Ok()) return;
if (m_pen.GetStyle() != wxTRANSPARENT)
{
gdk_draw_line( m_window, m_penGC,
XLOG2DEV(x1), YLOG2DEV(y1), XLOG2DEV(x2), YLOG2DEV(y2) );
};
};
void wxPaintDC::CrossHair( long x, long y )
{
if (!Ok()) return;
if (m_pen.GetStyle() != wxTRANSPARENT)
{
int w = 0;
int h = 0;
GetSize( &w, &h );
long xx = XLOG2DEV(x);
long yy = YLOG2DEV(y);
gdk_draw_line( m_window, m_penGC,
0, yy, XLOG2DEVREL(w), yy );
gdk_draw_line( m_window, m_penGC,
xx, 0, xx, YLOG2DEVREL(h) );
};
};
void wxPaintDC::DrawArc( long x1, long y1, long x2, long y2, double xc, double yc )
{
if (!Ok()) return;
long xx1 = XLOG2DEV(x1);
long yy1 = YLOG2DEV(y1);
long xx2 = XLOG2DEV(x2);
long yy2 = YLOG2DEV(y2);
long xxc = XLOG2DEV((long)xc);
long yyc = YLOG2DEV((long)yc);
double dx = xx1 - xxc;
double dy = yy1 - yyc;
double radius = sqrt(dx*dx+dy*dy);
long r = (long)radius;
double radius1, radius2;
if (xx1 == xx2 && yy1 == yy2)
{
radius1 = 0.0;
radius2 = 360.0;
}
else
if (radius == 0.0)
{
radius1 = radius2 = 0.0;
}
else
{
radius1 = (xx1 - xxc == 0) ?
(yy1 - yyc < 0) ? 90.0 : -90.0 :
-atan2(double(yy1-yyc), double(xx1-xxc)) * RAD2DEG;
radius2 = (xx2 - xxc == 0) ?
(yy2 - yyc < 0) ? 90.0 : -90.0 :
-atan2(double(yy2-yyc), double(xx2-xxc)) * RAD2DEG;
};
long alpha1 = long(radius1 * 64.0);
long alpha2 = long((radius2 - radius1) * 64.0);
while (alpha2 <= 0) alpha2 += 360*64;
while (alpha1 > 360*64) alpha1 -= 360*64;
if (m_brush.GetStyle() != wxTRANSPARENT)
gdk_draw_arc( m_window, m_brushGC, TRUE, xxc-r, yyc-r, 2*r,2*r, alpha1, alpha2 );
if (m_pen.GetStyle() != wxTRANSPARENT)
gdk_draw_arc( m_window, m_penGC, FALSE, xxc-r, yyc-r, 2*r,2*r, alpha1, alpha2 );
};
void wxPaintDC::DrawEllipticArc( long x, long y, long width, long height, double sa, double ea )
{
if (!Ok()) return;
if (width<0) { width=-width; x=x-width; }
if (height<0) { height=-height; y=y-height; }
long xx = XLOG2DEV(x);
long yy = YLOG2DEV(y);
long ww = XLOG2DEVREL(width);
long hh = YLOG2DEVREL(height);
if (m_brush.GetStyle() != wxTRANSPARENT)
gdk_draw_arc( m_window, m_brushGC, TRUE, xx, yy, ww-1, hh-1, 0, long(sa*64) );
if (m_pen.GetStyle() != wxTRANSPARENT)
gdk_draw_arc( m_window, m_penGC, FALSE, xx, yy, ww, hh, 0, long(ea*64) );
};
void wxPaintDC::DrawPoint( long x, long y )
{
if (!Ok()) return;
if (m_pen.GetStyle() != wxTRANSPARENT)
gdk_draw_point( m_window, m_penGC, XLOG2DEV(x), YLOG2DEV(y) );
};
void wxPaintDC::DrawLines( int n, wxPoint points[], long xoffset, long yoffset )
{
if (!Ok()) return;
if (m_pen.GetStyle() == wxTRANSPARENT) return;
for (int i = 0; i < n-1; i++)
{
long x1 = XLOG2DEV(points[i].x + xoffset);
long x2 = XLOG2DEV(points[i+1].x + xoffset);
long y1 = YLOG2DEV(points[i].y + yoffset); // oh, what a waste
long y2 = YLOG2DEV(points[i+1].y + yoffset);
gdk_draw_line( m_window, m_brushGC, x1, y1, x2, y2 );
};
};
void wxPaintDC::DrawLines( wxList *points, long xoffset, long yoffset )
{
if (!Ok()) return;
if (m_pen.GetStyle() == wxTRANSPARENT) return;
wxNode *node = points->First();
while (node->Next())
{
wxPoint *point = (wxPoint*)node->Data();
wxPoint *npoint = (wxPoint*)node->Next()->Data();
long x1 = XLOG2DEV(point->x + xoffset);
long x2 = XLOG2DEV(npoint->x + xoffset);
long y1 = YLOG2DEV(point->y + yoffset); // and again...
long y2 = YLOG2DEV(npoint->y + yoffset);
gdk_draw_line( m_window, m_brushGC, x1, y1, x2, y2 );
node = node->Next();
};
};
void wxPaintDC::DrawPolygon( int WXUNUSED(n), wxPoint WXUNUSED(points)[],
long WXUNUSED(xoffset), long WXUNUSED(yoffset), int WXUNUSED(fillStyle) )
{
if (!Ok()) return;
};
void wxPaintDC::DrawPolygon( wxList *WXUNUSED(lines), long WXUNUSED(xoffset),
long WXUNUSED(yoffset), int WXUNUSED(fillStyle) )
{
if (!Ok()) return;
};
void wxPaintDC::DrawRectangle( long x, long y, long width, long height )
{
if (!Ok()) return;
long xx = XLOG2DEV(x);
long yy = YLOG2DEV(y);
long ww = XLOG2DEVREL(width);
long hh = YLOG2DEVREL(height);
if (m_brush.GetStyle() != wxTRANSPARENT)
gdk_draw_rectangle( m_window, m_brushGC, TRUE, xx, yy, ww, hh );
if (m_pen.GetStyle() != wxTRANSPARENT)
gdk_draw_rectangle( m_window, m_penGC, FALSE, xx, yy, ww-1, hh-1 );
};
void wxPaintDC::DrawRoundedRectangle( long x, long y, long width, long height, double radius )
{
if (!Ok()) return;
if (width<0) { width=-width; x=x-width; }
if (height<0) { height=-height; y=y-height; }
if (radius < 0.0) radius = - radius * ((width < height) ? width : height);
long xx = XLOG2DEV(x);
long yy = YLOG2DEV(y);
long ww = XLOG2DEVREL(width);
long hh = YLOG2DEVREL(height);
long rr = XLOG2DEVREL((long)radius);
long dd = 2 * rr;
if (m_brush.GetStyle() != wxTRANSPARENT)
{
gdk_draw_rectangle( m_window, m_brushGC, TRUE, xx+rr, yy, ww-dd, hh );
gdk_draw_rectangle( m_window, m_brushGC, TRUE, xx, yy+rr, ww, hh-dd );
gdk_draw_arc( m_window, m_brushGC, TRUE, xx, yy, dd, dd, 90*64, 90*64 );
gdk_draw_arc( m_window, m_brushGC, TRUE, xx+ww-dd, yy, dd, dd, 0, 90*64 );
gdk_draw_arc( m_window, m_brushGC, TRUE, xx+ww-dd, yy+hh-dd, dd, dd, 270*64, 90*64 );
gdk_draw_arc( m_window, m_brushGC, TRUE, xx, yy+hh-dd, dd, dd, 180*64, 90*64 );
};
if (m_pen.GetStyle() != wxTRANSPARENT)
{
gdk_draw_line( m_window, m_penGC, xx+rr, yy, xx+ww-rr, yy );
gdk_draw_line( m_window, m_penGC, xx+rr, yy+hh, xx+ww-rr, yy+hh );
gdk_draw_line( m_window, m_penGC, xx, yy+rr, xx, yy+hh-rr );
gdk_draw_line( m_window, m_penGC, xx+ww, yy+rr, xx+ww, yy+hh-rr );
gdk_draw_arc( m_window, m_penGC, FALSE, xx, yy, dd, dd, 90*64, 90*64 );
gdk_draw_arc( m_window, m_penGC, FALSE, xx+ww-dd, yy, dd, dd, 0, 90*64 );
gdk_draw_arc( m_window, m_penGC, FALSE, xx+ww-dd, yy+hh-dd, dd, dd, 270*64, 90*64 );
gdk_draw_arc( m_window, m_penGC, FALSE, xx, yy+hh-dd, dd, dd, 180*64, 90*64 );
};
};
void wxPaintDC::DrawEllipse( long x, long y, long width, long height )
{
if (!Ok()) return;
if (width<0) { width=-width; x=x-width; }
if (height<0) { height=-height; y=y-height; }
long xx = XLOG2DEV(x);
long yy = YLOG2DEV(y);
long ww = XLOG2DEVREL(width);
long hh = YLOG2DEVREL(height);
if (m_brush.GetStyle() != wxTRANSPARENT)
gdk_draw_arc( m_window, m_brushGC, TRUE, xx, yy, ww, hh, 0, 360*64 );
if (m_pen.GetStyle() != wxTRANSPARENT)
gdk_draw_arc( m_window, m_penGC, FALSE, xx, yy, ww, hh, 0, 360*64 );
};
bool wxPaintDC::CanDrawBitmap(void) const
{
return TRUE;
};
void wxPaintDC::DrawIcon( const wxIcon &icon, long x, long y, bool useMask )
{
if (!Ok()) return;
if (!icon.Ok()) return;
int xx = XLOG2DEV(x);
int yy = YLOG2DEV(y);
GdkBitmap *mask = NULL;
if (icon.GetMask()) mask = icon.GetMask()->GetBitmap();
if (useMask && mask)
{
gdk_gc_set_clip_mask( m_penGC, mask );
gdk_gc_set_clip_origin( m_penGC, xx, yy );
};
GdkPixmap *pm = icon.GetPixmap();
gdk_draw_pixmap( m_window, m_penGC, pm, 0, 0, xx, yy, -1, -1 );
if (useMask && mask)
{
gdk_gc_set_clip_mask( m_penGC, NULL );
gdk_gc_set_clip_origin( m_penGC, 0, 0 );
};
};
bool wxPaintDC::Blit( long xdest, long ydest, long width, long height,
wxDC *source, long xsrc, long ysrc, int WXUNUSED(logical_func), bool WXUNUSED(useMask) )
{
if (!Ok()) return FALSE;
wxClientDC *csrc = (wxClientDC*)source;
gdk_window_copy_area ( m_window, m_penGC,
XLOG2DEV(xdest), YLOG2DEV(ydest),
csrc->GetWindow(),
source->DeviceToLogicalX(xsrc), source->DeviceToLogicalY(ysrc),
source->DeviceToLogicalXRel(width), source->DeviceToLogicalYRel(height) );
/*
gdk_window_copy_area ( m_window, m_penGC,
XLOG2DEV(xdest), YLOG2DEV(ydest),
csrc->GetWindow(),
xsrc, ysrc,
width, height );
*/
return TRUE;
};
void wxPaintDC::DrawText( const wxString &text, long x, long y, bool WXUNUSED(use16) )
{
if (!Ok()) return;
GdkFont *font = m_font.GetInternalFont( m_scaleY );
gdk_draw_string( m_window, font, m_textGC,
XLOG2DEV(x),
YLOG2DEV(y) + font->ascent, text );
};
bool wxPaintDC::CanGetTextExtent(void) const
{
return TRUE;
};
void wxPaintDC::GetTextExtent( const wxString &string, long *width, long *height,
long *WXUNUSED(descent), long *WXUNUSED(externalLeading),
wxFont *WXUNUSED(theFont), bool WXUNUSED(use16) )
{
if (!Ok()) return;
GdkFont *font = m_font.GetInternalFont( m_scaleY );
if (width) (*width) = gdk_string_width( font, string );
if (height) (*height) = font->ascent + font->descent;
};
long wxPaintDC::GetCharWidth(void)
{
if (!Ok()) return 0;
GdkFont *font = m_font.GetInternalFont( m_scaleY );
return gdk_string_width( font, "H" );
};
long wxPaintDC::GetCharHeight(void)
{
if (!Ok()) return 0;
GdkFont *font = m_font.GetInternalFont( m_scaleY );
return font->ascent + font->descent;
};
void wxPaintDC::Clear(void)
{
if (!Ok()) return;
DestroyClippingRegion();
gdk_window_clear( m_window );
};
void wxPaintDC::SetFont( const wxFont &font )
{
if (!Ok()) return;
m_font = font;
};
void wxPaintDC::SetPen( const wxPen &pen )
{
if (!Ok()) return;
if (m_pen == pen) return;
m_pen = pen;
if (!m_pen.Ok()) return;
gint width = m_pen.GetWidth();
GdkLineStyle lineStyle = GDK_LINE_SOLID;
switch (m_pen.GetStyle())
{
case wxSOLID: { lineStyle = GDK_LINE_SOLID; break; };
case wxDOT: { lineStyle = GDK_LINE_ON_OFF_DASH; break; };
case wxLONG_DASH: { lineStyle = GDK_LINE_ON_OFF_DASH; break; };
case wxSHORT_DASH: { lineStyle = GDK_LINE_ON_OFF_DASH; break; };
case wxDOT_DASH: { lineStyle = GDK_LINE_DOUBLE_DASH; break; };
};
GdkCapStyle capStyle = GDK_CAP_ROUND;
switch (m_pen.GetCap())
{
case wxCAP_ROUND: { capStyle = GDK_CAP_ROUND; break; };
case wxCAP_PROJECTING: { capStyle = GDK_CAP_PROJECTING; break; };
case wxCAP_BUTT: { capStyle = GDK_CAP_BUTT; break; };
};
GdkJoinStyle joinStyle = GDK_JOIN_ROUND;
switch (m_pen.GetJoin())
{
case wxJOIN_BEVEL: { joinStyle = GDK_JOIN_BEVEL; break; };
case wxJOIN_ROUND: { joinStyle = GDK_JOIN_ROUND; break; };
case wxJOIN_MITER: { joinStyle = GDK_JOIN_MITER; break; };
};
gdk_gc_set_line_attributes( m_penGC, width, lineStyle, capStyle, joinStyle );
m_pen.GetColour().CalcPixel( m_cmap );
gdk_gc_set_foreground( m_penGC, m_pen.GetColour().GetColor() );
};
void wxPaintDC::SetBrush( const wxBrush &brush )
{
if (!Ok()) return;
if (m_brush == brush) return;
m_brush = brush;
if (!m_brush.Ok()) return;
m_brush.GetColour().CalcPixel( m_cmap );
gdk_gc_set_foreground( m_brushGC, m_brush.GetColour().GetColor() );
GdkFill fillStyle = GDK_SOLID;
switch (m_brush.GetStyle())
{
case wxSOLID:
case wxTRANSPARENT:
break;
default:
fillStyle = GDK_STIPPLED;
};
gdk_gc_set_fill( m_brushGC, fillStyle );
if (m_brush.GetStyle() == wxSTIPPLE)
{
gdk_gc_set_stipple( m_brushGC, m_brush.GetStipple()->GetPixmap() );
};
if (IS_HATCH(m_brush.GetStyle()))
{
int num = m_brush.GetStyle() - wxBDIAGONAL_HATCH;
gdk_gc_set_stipple( m_brushGC, hatches[num] );
};
};
void wxPaintDC::SetLogicalFunction( int function )
{
if (m_logicalFunction == function) return;
GdkFunction mode = GDK_COPY;
switch (function)
{
case wxXOR: mode = GDK_INVERT; break;
case wxINVERT: mode = GDK_INVERT; break;
default: break;
};
m_logicalFunction = function;
gdk_gc_set_function( m_penGC, mode );
gdk_gc_set_function( m_brushGC, mode );
};
void wxPaintDC::SetTextForeground( const wxColour &col )
{
if (!Ok()) return;
if (m_textForegroundColour == col) return;
m_textForegroundColour = col;
if (!m_textForegroundColour.Ok()) return;
m_textForegroundColour.CalcPixel( m_cmap );
gdk_gc_set_foreground( m_textGC, m_textForegroundColour.GetColor() );
};
void wxPaintDC::SetTextBackground( const wxColour &col )
{
if (!Ok()) return;
if (m_textBackgroundColour == col) return;
m_textBackgroundColour = col;
if (!m_textBackgroundColour.Ok()) return;
m_textBackgroundColour.CalcPixel( m_cmap );
gdk_gc_set_background( m_textGC, m_textBackgroundColour.GetColor() );
};
void wxPaintDC::SetBackgroundMode( int WXUNUSED(mode) )
{
};
void wxPaintDC::SetPalette( const wxPalette& WXUNUSED(palette) )
{
};
void wxPaintDC::SetClippingRegion( long x, long y, long width, long height )
{
wxDC::SetClippingRegion( x, y, width, height );
GdkRectangle rect;
rect.x = XLOG2DEV(x);
rect.y = YLOG2DEV(y);
rect.width = XLOG2DEV(x+width);
rect.height = YLOG2DEV(y+height);
gdk_gc_set_clip_rectangle( m_penGC, &rect );
gdk_gc_set_clip_rectangle( m_brushGC, &rect );
gdk_gc_set_clip_rectangle( m_textGC, &rect );
gdk_gc_set_clip_rectangle( m_bgGC, &rect );
};
void wxPaintDC::DestroyClippingRegion(void)
{
wxDC::DestroyClippingRegion();
gdk_gc_set_clip_rectangle( m_penGC, NULL );
gdk_gc_set_clip_rectangle( m_brushGC, NULL );
gdk_gc_set_clip_rectangle( m_textGC, NULL );
gdk_gc_set_clip_rectangle( m_bgGC, NULL );
};
void wxPaintDC::SetUpDC(void)
{
m_ok = TRUE;
m_logicalFunction = wxCOPY;
m_penGC = gdk_gc_new( m_window );
m_brushGC = gdk_gc_new( m_window );
m_textGC = gdk_gc_new( m_window );
m_bgGC = gdk_gc_new( m_window );
SetTextForeground( m_textForegroundColour );
SetTextBackground( m_textBackgroundColour );
SetPen( m_pen );
SetFont( m_font );
SetBrush( m_brush );
gdk_gc_set_background( m_penGC, wxWHITE->GetColor() );
if (!hatch_bitmap)
{
hatch_bitmap = hatches;
hatch_bitmap[0] = gdk_bitmap_create_from_data( NULL, bdiag_bits, bdiag_width, bdiag_height );
hatch_bitmap[1] = gdk_bitmap_create_from_data( NULL, cdiag_bits, cdiag_width, cdiag_height );
hatch_bitmap[2] = gdk_bitmap_create_from_data( NULL, fdiag_bits, fdiag_width, fdiag_height );
hatch_bitmap[3] = gdk_bitmap_create_from_data( NULL, cross_bits, cross_width, cross_height );
hatch_bitmap[4] = gdk_bitmap_create_from_data( NULL, horiz_bits, horiz_width, horiz_height );
hatch_bitmap[5] = gdk_bitmap_create_from_data( NULL, verti_bits, verti_width, verti_height );
};
};
GdkWindow *wxPaintDC::GetWindow(void)
{
return m_window;
};
// ----------------------------------- spline code ----------------------------------------
void wx_quadratic_spline(double a1, double b1, double a2, double b2,
double a3, double b3, double a4, double b4);
void wx_clear_stack(void);
int wx_spline_pop(double *x1, double *y1, double *x2, double *y2, double *x3,
double *y3, double *x4, double *y4);
void wx_spline_push(double x1, double y1, double x2, double y2, double x3, double y3,
double x4, double y4);
static bool wx_spline_add_point(double x, double y);
static void wx_spline_draw_point_array(wxDC *dc);
wxList wx_spline_point_list;
#define half(z1, z2) ((z1+z2)/2.0)
#define THRESHOLD 5
/* iterative version */
void wx_quadratic_spline(double a1, double b1, double a2, double b2, double a3, double b3, double a4,
double b4)
{
register double xmid, ymid;
double x1, y1, x2, y2, x3, y3, x4, y4;
wx_clear_stack();
wx_spline_push(a1, b1, a2, b2, a3, b3, a4, b4);
while (wx_spline_pop(&x1, &y1, &x2, &y2, &x3, &y3, &x4, &y4)) {
xmid = (double)half(x2, x3);
ymid = (double)half(y2, y3);
if (fabs(x1 - xmid) < THRESHOLD && fabs(y1 - ymid) < THRESHOLD &&
fabs(xmid - x4) < THRESHOLD && fabs(ymid - y4) < THRESHOLD) {
wx_spline_add_point( x1, y1 );
wx_spline_add_point( xmid, ymid );
} else {
wx_spline_push(xmid, ymid, (double)half(xmid, x3), (double)half(ymid, y3),
(double)half(x3, x4), (double)half(y3, y4), x4, y4);
wx_spline_push(x1, y1, (double)half(x1, x2), (double)half(y1, y2),
(double)half(x2, xmid), (double)half(y2, ymid), xmid, ymid);
}
}
}
/* utilities used by spline drawing routines */
typedef struct wx_spline_stack_struct {
double x1, y1, x2, y2, x3, y3, x4, y4;
} Stack;
#define SPLINE_STACK_DEPTH 20
static Stack wx_spline_stack[SPLINE_STACK_DEPTH];
static Stack *wx_stack_top;
static int wx_stack_count;
void wx_clear_stack(void)
{
wx_stack_top = wx_spline_stack;
wx_stack_count = 0;
}
void wx_spline_push(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4)
{
wx_stack_top->x1 = x1;
wx_stack_top->y1 = y1;
wx_stack_top->x2 = x2;
wx_stack_top->y2 = y2;
wx_stack_top->x3 = x3;
wx_stack_top->y3 = y3;
wx_stack_top->x4 = x4;
wx_stack_top->y4 = y4;
wx_stack_top++;
wx_stack_count++;
}
int wx_spline_pop(double *x1, double *y1, double *x2, double *y2,
double *x3, double *y3, double *x4, double *y4)
{
if (wx_stack_count == 0)
return (0);
wx_stack_top--;
wx_stack_count--;
*x1 = wx_stack_top->x1;
*y1 = wx_stack_top->y1;
*x2 = wx_stack_top->x2;
*y2 = wx_stack_top->y2;
*x3 = wx_stack_top->x3;
*y3 = wx_stack_top->y3;
*x4 = wx_stack_top->x4;
*y4 = wx_stack_top->y4;
return (1);
}
static bool wx_spline_add_point(double x, double y)
{
wxPoint *point = new wxPoint ;
point->x = (int) x;
point->y = (int) y;
wx_spline_point_list.Append((wxObject*)point);
return TRUE;
}
static void wx_spline_draw_point_array(wxDC *dc)
{
dc->DrawLines(&wx_spline_point_list, 0, 0 );
wxNode *node = wx_spline_point_list.First();
while (node)
{
wxPoint *point = (wxPoint *)node->Data();
delete point;
delete node;
node = wx_spline_point_list.First();
}
}
void wxPaintDC::DrawOpenSpline( wxList *points )
{
wxPoint *p;
double cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4;
double x1, y1, x2, y2;
wxNode *node = points->First();
p = (wxPoint *)node->Data();
x1 = p->x;
y1 = p->y;
node = node->Next();
p = (wxPoint *)node->Data();
x2 = p->x;
y2 = p->y;
cx1 = (double)((x1 + x2) / 2);
cy1 = (double)((y1 + y2) / 2);
cx2 = (double)((cx1 + x2) / 2);
cy2 = (double)((cy1 + y2) / 2);
wx_spline_add_point(x1, y1);
while ((node = node->Next()) != NULL)
{
p = (wxPoint *)node->Data();
x1 = x2;
y1 = y2;
x2 = p->x;
y2 = p->y;
cx4 = (double)(x1 + x2) / 2;
cy4 = (double)(y1 + y2) / 2;
cx3 = (double)(x1 + cx4) / 2;
cy3 = (double)(y1 + cy4) / 2;
wx_quadratic_spline(cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4);
cx1 = cx4;
cy1 = cy4;
cx2 = (double)(cx1 + x2) / 2;
cy2 = (double)(cy1 + y2) / 2;
}
wx_spline_add_point( cx1, cy1 );
wx_spline_add_point( x2, y2 );
wx_spline_draw_point_array( this );
};

68
src/gtk1/dcmemory.cpp Normal file
View File

@@ -0,0 +1,68 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dcmemory.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 "dcmemory.h"
#endif
#include "wx/dcmemory.h"
//-----------------------------------------------------------------------------
// wxMemoryDC
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxPaintDC)
wxMemoryDC::wxMemoryDC(void)
{
m_ok = FALSE;
m_cmap = gdk_colormap_get_system();
};
wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) )
{
m_ok = FALSE;
m_cmap = gdk_colormap_get_system();
};
wxMemoryDC::~wxMemoryDC(void)
{
};
void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
{
m_selected = bitmap;
if (m_selected.Ok())
{
m_window = m_selected.GetPixmap();
SetUpDC();
}
else
{
m_ok = FALSE;
m_window = NULL;
};
};
void wxMemoryDC::GetSize( int *width, int *height )
{
if (m_selected.Ok())
{
if (width) (*width) = m_selected.GetWidth();
if (height) (*height) = m_selected.GetHeight();
}
else
{
if (width) (*width) = 0;
if (height) (*height) = 0;
};
};

121
src/gtk1/dcscreen.cpp Normal file
View File

@@ -0,0 +1,121 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dcscreen.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 "dcscreen.h"
#endif
#include "wx/dcscreen.h"
#include "wx/window.h"
#include "gdk/gdkx.h"
//-----------------------------------------------------------------------------
// wxScreenDC
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxScreenDC,wxPaintDC)
wxScreenDC::wxScreenDC(void)
{
m_ok = FALSE;
m_window = NULL;
m_cmap = gdk_colormap_get_system();
m_window = GDK_ROOT_PARENT();
SetUpDC();
gdk_gc_set_subwindow( m_penGC, GDK_INCLUDE_INFERIORS );
gdk_gc_set_subwindow( m_brushGC, GDK_INCLUDE_INFERIORS );
gdk_gc_set_subwindow( m_textGC, GDK_INCLUDE_INFERIORS );
gdk_gc_set_subwindow( m_bgGC, GDK_INCLUDE_INFERIORS );
};
wxScreenDC::~wxScreenDC(void)
{
EndDrawingOnTop();
};
bool wxScreenDC::StartDrawingOnTop( wxWindow *WXUNUSED(window) )
{
return TRUE;
/*
if (!window)
{
StartDrawingOnTop();
return;
};
wxRectangle rect;
rect.x = 0;
rect.y = 0;
window->GetPosition( &rect.x, &rect.y );
rect.width = 0;
rect.height = 0;
window->GetSize( &rect.width, &rect.height );
window->ClientToScreen( &rect.x, &rect.y );
StartDrawingOnTop( &rect );
return TRUE;
*/
};
bool wxScreenDC::StartDrawingOnTop( wxRectangle *WXUNUSED(rect) )
{
return TRUE;
/*
int x = 0;
int y = 0;
int width = gdk_screen_width();
int height = gdk_screen_height();
if (rect)
{
x = rect->x;
y = rect->y;
width = rect->width;
height = rect->height;
};
GTK cannot set transparent backgrounds. :-(
GdkWindowAttr attr;
attr.x = x;
attr.y = y;
attr.width = width;
attr.height = height;
attr.override_redirect = TRUE;
attr.wclass = GDK_INPUT_OUTPUT;
attr.event_mask = 0;
attr.window_type = GDK_WINDOW_TEMP;
m_window = gdk_window_new( NULL, &attr, GDK_WA_NOREDIR | GDK_WA_X | GDK_WA_Y );
gdk_window_show( m_window );
m_window = GDK_ROOT_PARENT();
SetUpDC();
gdk_gc_set_subwindow( m_penGC, GDK_INCLUDE_INFERIORS );
gdk_gc_set_subwindow( m_brushGC, GDK_INCLUDE_INFERIORS );
gdk_gc_set_subwindow( m_textGC, GDK_INCLUDE_INFERIORS );
gdk_gc_set_subwindow( m_bgGC, GDK_INCLUDE_INFERIORS );
return TRUE;
*/
};
bool wxScreenDC::EndDrawingOnTop(void)
{
return TRUE;
/*
if (m_window) gdk_window_destroy( m_window );
m_window = NULL;
m_isOk = FALSE;
return TRUE;
*/
};

212
src/gtk1/dialog.cpp Normal file
View File

@@ -0,0 +1,212 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dialog.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 "dialog.h"
#endif
#include "wx/dialog.h"
#include "wx/frame.h"
#include "wx/app.h"
#include "wx/gtk/win_gtk.h"
//-----------------------------------------------------------------------------
// delete
bool gtk_dialog_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(event), wxDialog *win )
{
/*
printf( "OnDelete from " );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
printf( win->GetClassInfo()->GetClassName() );
printf( ".\n" );
*/
win->Close();
return TRUE;
};
//-----------------------------------------------------------------------------
// wxDialog
//-----------------------------------------------------------------------------
BEGIN_EVENT_TABLE(wxDialog,wxWindow)
EVT_BUTTON (wxID_OK, wxDialog::OnOk)
EVT_BUTTON (wxID_CANCEL, wxDialog::OnCancel)
EVT_BUTTON (wxID_APPLY, wxDialog::OnApply)
EVT_CLOSE (wxDialog::OnCloseWindow)
END_EVENT_TABLE()
IMPLEMENT_DYNAMIC_CLASS(wxDialog,wxWindow)
wxDialog::wxDialog(void)
{
m_title = "";
m_modalShowing = TRUE;
wxTopLevelWindows.Insert( this );
};
wxDialog::wxDialog( wxWindow *parent,
wxWindowID id, const wxString &title,
const wxPoint &pos, const wxSize &size,
const long style, const wxString &name )
{
wxTopLevelWindows.Insert( this );
Create( parent, id, title, pos, size, style, name );
};
bool wxDialog::Create( wxWindow *parent,
wxWindowID id, const wxString &title,
const wxPoint &pos, const wxSize &size,
const long style, const wxString &name )
{
m_needParent = FALSE;
PreCreation( parent, id, pos, size, style, name );
m_modalShowing = ((m_windowStyle & wxDIALOG_MODAL) == wxDIALOG_MODAL);
m_widget = gtk_window_new( GTK_WINDOW_TOPLEVEL );
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
gtk_widget_set( m_widget, "GtkWindow::allow_shrink", TRUE, NULL);
gtk_signal_connect( GTK_OBJECT(m_widget), "delete_event",
GTK_SIGNAL_FUNC(gtk_dialog_delete_callback), (gpointer)this );
m_wxwindow = gtk_myfixed_new();
gtk_widget_show( m_wxwindow );
GTK_WIDGET_UNSET_FLAGS( m_wxwindow, GTK_CAN_FOCUS );
gtk_container_add( GTK_CONTAINER(m_widget), m_wxwindow );
SetTitle( title );
PostCreation();
return TRUE;
};
wxDialog::~wxDialog(void)
{
wxTopLevelWindows.DeleteObject( this );
if (wxTopLevelWindows.Number() == 0) wxTheApp->ExitMainLoop();
};
void wxDialog::SetTitle(const wxString& title )
{
m_title = title;
gtk_window_set_title( GTK_WINDOW(m_widget), m_title );
};
wxString wxDialog::GetTitle(void) const
{
return (wxString&)m_title;
};
void wxDialog::OnApply( wxCommandEvent &WXUNUSED(event) )
{
if (Validate()) TransferDataFromWindow();
};
void wxDialog::OnCancel( wxCommandEvent &WXUNUSED(event) )
{
if (IsModal())
EndModal(wxID_CANCEL);
else
{
SetReturnCode(wxID_CANCEL);
this->Show(FALSE);
};
};
void wxDialog::OnOk( wxCommandEvent &WXUNUSED(event) )
{
if ( Validate() && TransferDataFromWindow())
{
if (IsModal())
EndModal(wxID_OK);
else
{
SetReturnCode(wxID_OK);
this->Show(FALSE);
};
};
EndModal( wxID_OK );
};
void wxDialog::OnPaint( wxPaintEvent& WXUNUSED(event) )
{
// yes
};
bool wxDialog::OnClose(void)
{
static wxList closing;
if (closing.Member(this)) return FALSE; // no loops
closing.Append(this);
wxCommandEvent cancelEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
cancelEvent.SetEventObject( this );
GetEventHandler()->ProcessEvent(cancelEvent);
closing.DeleteObject(this);
return FALSE;
}
void wxDialog::OnCloseWindow(wxCloseEvent& event)
{
if (GetEventHandler()->OnClose() || event.GetForce())
{
this->Destroy();
};
};
bool wxDialog::Show( const bool show )
{
if (!show && m_modalShowing)
{
EndModal( wxID_CANCEL );
};
wxWindow::Show( show );
if (show) InitDialog();
if (show && m_modalShowing)
{
gtk_grab_add( m_widget );
gtk_main();
gtk_grab_remove( m_widget );
};
return TRUE;
};
int wxDialog::ShowModal(void)
{
Show( TRUE );
return GetReturnCode();
};
void wxDialog::EndModal( int retCode )
{
gtk_main_quit();
SetReturnCode( retCode );
};
void wxDialog::InitDialog(void)
{
wxWindow::InitDialog();
};

207
src/gtk1/dnd.cpp Normal file
View File

@@ -0,0 +1,207 @@
///////////////////////////////////////////////////////////////////////////////
// Name: dnd.cpp
// Purpose: wxDropTarget class
// Author: Robert Roebling
// Copyright: Robert Roebling
// Licence: wxWindows license
///////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "dnd.h"
#endif
#include "wx/dnd.h"
#include "wx/window.h"
#include "wx/app.h"
#include "wx/gdicmn.h"
#include "gdk/gdkprivate.h"
#include <X11/Xlib.h>
// ----------------------------------------------------------------------------
// global
// ----------------------------------------------------------------------------
extern bool g_blockEventsOnDrag;
// ----------------------------------------------------------------------------
// wxDropTarget
// ----------------------------------------------------------------------------
wxDropTarget::wxDropTarget()
{
};
wxDropTarget::~wxDropTarget()
{
};
void wxDropTarget::Drop( GdkEvent *event, int x, int y )
{
printf( "Drop data is of type %s.\n", event->dropdataavailable.data_type );
OnDrop( x, y, (char *)event->dropdataavailable.data);
};
void wxDropTarget::UnregisterWidget( GtkWidget *widget )
{
gtk_widget_dnd_drop_set( widget, FALSE, NULL, 0, FALSE );
};
// ----------------------------------------------------------------------------
// wxTextDropTarget
// ----------------------------------------------------------------------------
bool wxTextDropTarget::OnDrop( long x, long y, const void *pData )
{
OnDropText( x, y, (const char*)pData );
return TRUE;
};
bool wxTextDropTarget::OnDropText( long x, long y, const char *psz )
{
printf( "Got dropped text: %s.\n", psz );
printf( "At x: %d, y: %d.\n", (int)x, (int)y );
return TRUE;
};
void wxTextDropTarget::RegisterWidget( GtkWidget *widget )
{
char *accepted_drop_types[] = { "text/plain" };
gtk_widget_dnd_drop_set( widget, TRUE, accepted_drop_types, 1, FALSE );
};
//-------------------------------------------------------------------------
// wxDragSource
//-------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// drag request
void gtk_drag_callback( GtkWidget *widget, GdkEvent *event, wxDragSource *drag )
{
printf( "OnDragRequest.\n" );
gtk_widget_dnd_data_set( widget, event, drag->m_data, drag->m_size );
};
wxDragSource::wxDragSource( wxWindow *win )
{
g_blockEventsOnDrag = TRUE;
m_window = win;
m_widget = win->m_widget;
if (win->m_wxwindow) m_widget = win->m_wxwindow;
m_data = NULL;
m_size = 0;
m_defaultCursor = wxCursor( wxCURSOR_NO_ENTRY );
m_goaheadCursor = wxCursor( wxCURSOR_HAND );
};
wxDragSource::~wxDragSource(void)
{
g_blockEventsOnDrag = FALSE;
};
void wxDragSource::SetData( char *data, const long size )
{
m_size = size;
m_data = data;
};
void wxDragSource::Start( int x, int y )
{
if (gdk_dnd.dnd_grabbed) return;
if (gdk_dnd.drag_really) return;
if (m_size == 0) return;
if (!m_data) return;
GdkWindowPrivate *wp = (GdkWindowPrivate*) m_widget->window;
RegisterWindow();
ConnectWindow();
gdk_dnd.drag_perhaps = TRUE;
gdk_dnd.dnd_drag_start.x = 5;
gdk_dnd.dnd_drag_start.y = 5;
gdk_dnd.real_sw = wp;
if (gdk_dnd.drag_startwindows)
{
g_free( gdk_dnd.drag_startwindows );
gdk_dnd.drag_startwindows = NULL;
};
gdk_dnd.drag_numwindows = gdk_dnd.drag_really = 0;
XWindowAttributes dnd_winattr;
XGetWindowAttributes( gdk_display, wp->xwindow, &dnd_winattr );
wp->dnd_drag_savedeventmask = dnd_winattr.your_event_mask;
gdk_dnd_drag_addwindow( m_widget->window );
GdkEventDragBegin ev;
ev.type = GDK_DRAG_BEGIN;
ev.window = m_widget->window;
ev.u.allflags = 0;
ev.u.flags.protocol_version = DND_PROTOCOL_VERSION;
gdk_event_put( (GdkEvent*)&ev );
XGrabPointer( gdk_display, wp->xwindow, False,
ButtonMotionMask | ButtonPressMask | ButtonReleaseMask | PointerMotionMask,
GrabModeAsync, GrabModeAsync, gdk_root_window, None, CurrentTime );
gdk_dnd_set_drag_cursors( m_defaultCursor.GetCursor(), m_goaheadCursor.GetCursor() );
gdk_dnd.dnd_grabbed = TRUE;
gdk_dnd.drag_really = 1;
gdk_dnd_display_drag_cursor( x, y, FALSE, TRUE );
while (gdk_dnd.drag_really || gdk_dnd.drag_perhaps) wxYield();
UnconnectWindow();
UnregisterWindow();
};
void wxDragSource::ConnectWindow(void)
{
gtk_signal_connect( GTK_OBJECT(m_widget), "drag_request_event",
GTK_SIGNAL_FUNC(gtk_drag_callback), (gpointer)this );
};
void wxDragSource::UnconnectWindow(void)
{
if (!m_widget) return;
gtk_signal_disconnect_by_data( GTK_OBJECT(m_widget), (gpointer)this );
};
void wxDragSource::UnregisterWindow(void)
{
if (!m_widget) return;
gtk_widget_dnd_drag_set( m_widget, FALSE, NULL, 0 );
};
//-------------------------------------------------------------------------
// wxTextDragSource
//-------------------------------------------------------------------------
void wxTextDragSource::SetTextData( const wxString &text )
{
m_tmp = text;
SetData( WXSTRINGCAST(m_tmp), m_tmp.Length()+1 );
};
void wxTextDragSource::RegisterWindow(void)
{
if (!m_widget) return;
char *accepted_drop_types[] = { "text/plain" };
gtk_widget_dnd_drag_set( m_widget, TRUE, accepted_drop_types, 1 );
};

6
src/gtk1/fdiag.xbm Normal file
View File

@@ -0,0 +1,6 @@
#define fdiag_width 16
#define fdiag_height 16
static char fdiag_bits[] = {
0x01, 0x01, 0x02, 0x02, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20,
0x40, 0x40, 0x80, 0x80, 0x01, 0x01, 0x02, 0x02, 0x04, 0x04, 0x08, 0x08,
0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0x80};

146
src/gtk1/filedlg.cpp Normal file
View File

@@ -0,0 +1,146 @@
/////////////////////////////////////////////////////////////////////////////
// Name: filedlg.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 "filedlg.h"
#endif
#include "wx/filedlg.h"
#include "wx/utils.h"
#include "wx/intl.h"
//-----------------------------------------------------------------------------
// wxFileDialog
//-----------------------------------------------------------------------------
void gtk_filedialog_ok_callback( GtkWidget *WXUNUSED(widget), gpointer data )
{
wxFileDialog *dialog = (wxFileDialog*)data;
wxCommandEvent event(0);
dialog->OnOk( event );
};
void gtk_filedialog_cancel_callback( GtkWidget *WXUNUSED(widget), gpointer data )
{
wxFileDialog *dialog = (wxFileDialog*)data;
wxCommandEvent event(0);
dialog->OnCancel( event );
};
IMPLEMENT_DYNAMIC_CLASS(wxFileDialog,wxDialog)
wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
const wxString& defaultDir, const wxString& defaultFileName,
const wxString& wildCard,
long style, const wxPoint& pos )
{
m_needParent = FALSE;
PreCreation( parent, -1, pos, wxDefaultSize, style, "filedialog" );
m_message = message;
m_path = "";
m_fileName = defaultFileName;
m_dir = defaultDir;
m_wildCard = wildCard;
m_filterIndex = 1;
m_widget = gtk_file_selection_new( "File selection" );
GtkFileSelection *sel = GTK_FILE_SELECTION(m_widget);
gtk_signal_connect( GTK_OBJECT(sel->ok_button), "clicked",
GTK_SIGNAL_FUNC(gtk_filedialog_ok_callback), (gpointer*)this );
gtk_signal_connect( GTK_OBJECT(sel->cancel_button), "clicked",
GTK_SIGNAL_FUNC(gtk_filedialog_cancel_callback), (gpointer*)this );
};
int wxFileDialog::ShowModal(void)
{
int ret = wxDialog::ShowModal();
if (ret == wxID_OK)
{
m_fileName = gtk_file_selection_get_filename( GTK_FILE_SELECTION(m_widget) );
m_path = gtk_file_selection_get_filename( GTK_FILE_SELECTION(m_widget) );
};
return ret;
};
char *wxFileSelector(const char *title,
const char *defaultDir, const char *defaultFileName,
const char *defaultExtension, const char *filter, int flags,
wxWindow *parent, int x, int y)
{
wxString filter2("");
if ( defaultExtension && !filter )
filter2 = wxString("*.") + wxString(defaultExtension) ;
else if ( filter )
filter2 = filter;
wxString defaultDirString;
if (defaultDir)
defaultDirString = defaultDir;
else
defaultDirString = "";
wxString defaultFilenameString;
if (defaultFileName)
defaultFilenameString = defaultFileName;
else
defaultFilenameString = "";
wxFileDialog fileDialog(parent, title, defaultDirString, defaultFilenameString,
filter2, flags, wxPoint(x, y));
if ( fileDialog.ShowModal() == wxID_OK )
{
strcpy(wxBuffer, (const char *)fileDialog.GetPath());
return wxBuffer;
}
else
return NULL;
};
char* wxLoadFileSelector(const char *what, const char *extension, const char *default_name,
wxWindow *parent )
{
char *ext = (char *)extension;
char prompt[50];
wxString str = _("Load %s file");
sprintf(prompt, str, what);
if (*ext == '.') ext++;
char wild[60];
sprintf(wild, "*.%s", ext);
return wxFileSelector (prompt, NULL, default_name, ext, wild, 0, parent);
};
char* wxSaveFileSelector(const char *what, const char *extension, const char *default_name,
wxWindow *parent )
{
char *ext = (char *)extension;
char prompt[50];
wxString str = _("Save %s file");
sprintf(prompt, str, what);
if (*ext == '.') ext++;
char wild[60];
sprintf(wild, "*.%s", ext);
return wxFileSelector (prompt, NULL, default_name, ext, wild, 0, parent);
};

822
src/gtk1/font.cpp Normal file
View File

@@ -0,0 +1,822 @@
/////////////////////////////////////////////////////////////////////////////
// Name: font.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 "font.h"
#endif
#include "wx/font.h"
#include "wx/utils.h"
#include <strings.h>
//-----------------------------------------------------------------------------
// local data
//-----------------------------------------------------------------------------
static char *wx_font_family [] = {
"wxDEFAULT", "wxDECORATIVE", "wxMODERN", "wxROMAN", "wxSCRIPT",
"wxSWISS", "wxTELETYPE",
};
static char *wx_font_style [] = {
"wxDEFAULT", "wxNORMAL", "wxSLANT", "wxITALIC",
};
static char *wx_font_weight [] = {
"wxDEFAULT", "wxNORMAL", "wxBOLD", "wxLIGHT",
};
extern wxFontNameDirectory wxTheFontNameDirectory;
//-----------------------------------------------------------------------------
// wxFont
//-----------------------------------------------------------------------------
class wxFontRefData: public wxObjectRefData
{
public:
wxFontRefData(void);
~wxFontRefData(void);
wxList m_scaled_xfonts;
int m_pointSize;
int m_family, m_style, m_weight;
bool m_underlined;
int m_fontId;
char* m_faceName;
bool m_byXFontName;
GdkFont *m_font;
friend wxFont;
};
wxFontRefData::wxFontRefData(void) : m_scaled_xfonts(wxKEY_INTEGER)
{
m_byXFontName = FALSE;
m_pointSize = -1;
m_family = -1;
m_style = -1;
m_weight = -1;
m_underlined = FALSE;
m_fontId = 0;
m_faceName = NULL;
m_font = NULL;
};
wxFontRefData::~wxFontRefData(void)
{
wxNode *node = m_scaled_xfonts.First();
while (node)
{
GdkFont *font = (GdkFont*)node->Data();
wxNode *next = node->Next();
gdk_font_unref( font );
node = next;
};
if (m_faceName)
{
delete m_faceName;
m_faceName = NULL;
};
if (m_font) gdk_font_unref( m_font );
};
//-----------------------------------------------------------------------------
#define M_FONTDATA ((wxFontRefData *)m_refData)
IMPLEMENT_DYNAMIC_CLASS(wxFont, wxGDIObject)
wxFont::wxFont(void)
{
if (wxTheFontList) wxTheFontList->Append( this );
};
wxFont::wxFont( char *xFontName )
{
if (!xFontName) return;
m_refData = new wxFontRefData();
M_FONTDATA->m_byXFontName = TRUE;
M_FONTDATA->m_font = gdk_font_load( xFontName );
};
wxFont::wxFont(int PointSize, int FontIdOrFamily, int Style, int Weight,
bool Underlined, const char* Face)
{
m_refData = new wxFontRefData();
if ((M_FONTDATA->m_faceName = (Face) ? copystring(Face) : (char*)NULL) )
{
M_FONTDATA->m_fontId = wxTheFontNameDirectory.FindOrCreateFontId( Face, FontIdOrFamily );
M_FONTDATA->m_family = wxTheFontNameDirectory.GetFamily( FontIdOrFamily );
}
else
{
M_FONTDATA->m_fontId = FontIdOrFamily;
M_FONTDATA->m_family = wxTheFontNameDirectory.GetFamily( FontIdOrFamily );
};
M_FONTDATA->m_style = Style;
M_FONTDATA->m_weight = Weight;
M_FONTDATA->m_pointSize = PointSize;
M_FONTDATA->m_underlined = Underlined;
if (wxTheFontList) wxTheFontList->Append( this );
};
wxFont::wxFont(int PointSize, const char *Face, int Family, int Style,
int Weight, bool Underlined)
{
m_refData = new wxFontRefData();
M_FONTDATA->m_fontId = wxTheFontNameDirectory.FindOrCreateFontId( Face, Family );
M_FONTDATA->m_faceName = (Face) ? copystring(Face) : (char*)NULL;
M_FONTDATA->m_family = wxTheFontNameDirectory.GetFamily( M_FONTDATA->m_fontId );
M_FONTDATA->m_style = Style;
M_FONTDATA->m_weight = Weight;
M_FONTDATA->m_pointSize = PointSize;
M_FONTDATA->m_underlined = Underlined;
if (wxTheFontList) wxTheFontList->Append( this );
};
wxFont::wxFont( const wxFont& font )
{
Ref( font );
};
wxFont::wxFont( const wxFont* font )
{
UnRef();
if (font) Ref( *font );
};
wxFont::~wxFont(void)
{
if (wxTheFontList) wxTheFontList->DeleteObject( this );
};
wxFont& wxFont::operator = ( const wxFont& font )
{
if (*this == font) return (*this);
Ref( font );
return *this;
};
bool wxFont::operator == ( const wxFont& font )
{
return m_refData == font.m_refData;
};
bool wxFont::operator != ( const wxFont& font )
{
return m_refData != font.m_refData;
};
bool wxFont::Ok()
{
return (m_refData != NULL);
};
int wxFont::GetPointSize(void) const
{
return M_FONTDATA->m_pointSize;
};
wxString wxFont::GetFaceString(void) const
{
wxString s = wxTheFontNameDirectory.GetFontName( M_FONTDATA->m_fontId );
return s;
};
wxString wxFont::GetFaceName(void) const
{
wxString s = wxTheFontNameDirectory.GetFontName( M_FONTDATA->m_fontId );
return s;
};
int wxFont::GetFamily(void) const
{
return M_FONTDATA->m_family;
};
wxString wxFont::GetFamilyString(void) const
{
wxString s = wx_font_family[M_FONTDATA->m_family];
return s;
};
int wxFont::GetFontId(void) const
{
return M_FONTDATA->m_fontId; // stub
};
int wxFont::GetStyle(void) const
{
return M_FONTDATA->m_style;
};
wxString wxFont::GetStyleString(void) const
{
wxString s = wx_font_style[M_FONTDATA->m_style];
return s;
};
int wxFont::GetWeight(void) const
{
return M_FONTDATA->m_weight;
};
wxString wxFont::GetWeightString(void) const
{
wxString s = wx_font_weight[M_FONTDATA->m_weight];
return s;
};
bool wxFont::GetUnderlined(void) const
{
return M_FONTDATA->m_underlined;
};
//-----------------------------------------------------------------------------
// get internal representation of font
//-----------------------------------------------------------------------------
// local help function
static GdkFont *wxLoadQueryNearestFont(int point_size, int fontid,
int style, int weight,
bool underlined);
GdkFont *wxFont::GetInternalFont(float scale)
{
if (M_FONTDATA->m_byXFontName) return M_FONTDATA->m_font;
long int_scale = long(scale * 100.0 + 0.5); // key for fontlist
int point_scale = (M_FONTDATA->m_pointSize * 10 * int_scale) / 100;
GdkFont *font = NULL;
wxNode *node = M_FONTDATA->m_scaled_xfonts.Find(int_scale);
if (node)
{
font = (GdkFont*)node->Data();
}
else
{
font = wxLoadQueryNearestFont( point_scale, M_FONTDATA->m_fontId, M_FONTDATA->m_style,
M_FONTDATA->m_weight, M_FONTDATA->m_underlined );
M_FONTDATA->m_scaled_xfonts.Append( int_scale, (wxObject*)font );
};
if (!font)
printf("could not load any font");
// wxError("could not load any font", "wxFont");
return font;
};
//-----------------------------------------------------------------------------
// local utilities to find a X font
//-----------------------------------------------------------------------------
static GdkFont *wxLoadQueryFont(int point_size, int fontid, int style,
int weight, bool WXUNUSED(underlined))
{
char buffer[512];
char *name = wxTheFontNameDirectory.GetScreenName( fontid, weight, style );
if (!name)
name = "-*-*-*-*-*-*-*-%d-*-*-*-*-*-*";
sprintf(buffer, name, point_size);
return gdk_font_load( buffer );
}
static GdkFont *wxLoadQueryNearestFont(int point_size, int fontid,
int style, int weight,
bool underlined)
{
GdkFont *font;
font = wxLoadQueryFont( point_size, fontid, style, weight, underlined );
if (!font) {
// search up and down by stepsize 10
int max_size = point_size + 20 * (1 + (point_size/180));
int min_size = point_size - 20 * (1 + (point_size/180));
int i;
// Search for smaller size (approx.)
for (i=point_size-10; !font && i >= 10 && i >= min_size; i -= 10)
font = wxLoadQueryFont(i, fontid, style, weight, underlined);
// Search for larger size (approx.)
for (i=point_size+10; !font && i <= max_size; i += 10)
font = wxLoadQueryFont(i, fontid, style, weight, underlined);
// Try default family
if (!font && fontid != wxDEFAULT)
font = wxLoadQueryFont(point_size, wxDEFAULT, style,
weight, underlined);
// Bogus font
if (!font)
font = wxLoadQueryFont(120, wxDEFAULT, wxNORMAL, wxNORMAL,
underlined);
}
return font;
}
//-----------------------------------------------------------------------------
// face names and index functions
//-----------------------------------------------------------------------------
static char *font_defaults[] = {
"FamilyDefault", "Default",
"FamilyRoman", "Roman",
"FamilyDecorative", "Decorative",
"FamilyModern", "Modern",
"FamilyTeletype", "Teletype",
"FamilySwiss", "Swiss",
"FamilyScript", "Script",
"AfmMedium", "",
"AfmBold", "Bo",
"AfmLight", "",
"AfmStraight", "",
"AfmItalic", "${AfmSlant}",
"AfmSlant", "O",
"AfmRoman", "Ro",
"AfmTimes", "Times",
"AfmHelvetica", "Helv",
"AfmCourier", "Cour",
"Afm___", "${AfmTimes,$[weight],$[style]}",
"AfmTimes__", "${AfmTimes}${Afm$[weight]}${Afm$[style]}",
"AfmTimesMediumStraight", "${AfmTimes}${AfmRoman}",
"AfmTimesLightStraight", "${AfmTimes}${AfmRoman}",
"AfmTimes_Italic", "${AfmTimes}$[weight]${AfmItalic}",
"AfmTimes_Slant", "${AfmTimes}$[weight]${AfmItalic}",
"AfmSwiss__", "${AfmHelvetica}${Afm$[weight]}${Afm$[style]}",
"AfmModern__", "${AfmCourier}${Afm$[weight]}${Afm$[style]}",
"AfmTeletype__", "${AfmModern,$[weight],$[style]}",
"PostScriptMediumStraight", "",
"PostScriptMediumItalic", "-Oblique",
"PostScriptMediumSlant", "-Oblique",
"PostScriptLightStraight", "",
"PostScriptLightItalic", "-Oblique",
"PostScriptLightSlant", "-Oblique",
"PostScriptBoldStraight", "-Bold",
"PostScriptBoldItalic", "-BoldOblique",
"PostScriptBoldSlant", "-BoldOblique",
#if WX_NORMALIZED_PS_FONTS
"PostScript___", "${PostScriptTimes,$[weight],$[style]}",
#else
"PostScriptRoman__", "${PostScriptTimes,$[weight],$[style]}",
"PostScript___", "LucidaSans${PostScript$[weight]$[style]}",
#endif
"PostScriptTimesMedium", "",
"PostScriptTimesLight", "",
"PostScriptTimesBold", "Bold",
"PostScriptTimes__", "Times${PostScript$[weight]$[style]}",
"PostScriptTimesMediumStraight", "Times-Roman",
"PostScriptTimesLightStraight", "Times-Roman",
"PostScriptTimes_Slant", "Times-${PostScriptTimes$[weight]}Italic",
"PostScriptTimes_Italic", "Times-${PostScriptTimes$[weight]}Italic",
"PostScriptSwiss__", "Helvetica${PostScript$[weight]$[style]}",
"PostScriptModern__", "Courier${PostScript$[weight]$[style]}",
"PostScriptTeletype__", "${PostScriptModern,$[weight],$[style]}",
#if !WX_NORMALIZED_PS_FONTS
"PostScriptScript__", "Zapf-Chancery-MediumItalic",
#endif
"ScreenMedium", "medium",
"ScreenBold", "bold",
"ScreenLight", "light",
"ScreenStraight", "r",
"ScreenItalic", "i",
"ScreenSlant", "o",
"ScreenDefaultBase", "misc-fixed",
"ScreenRomanBase", "*-times",
"ScreenDecorativeBase", "*-helvetica",
"ScreenModernBase", "*-courier",
"ScreenTeletypeBase", "*-lucidatypewriter",
"ScreenSwissBase", "*-lucida",
"ScreenScriptBase", "*-zapfchancery",
"ScreenStdSuffix", "-${Screen$[weight]}-${Screen$[style]}"
"-normal-*-*-%d-*-*-*-*-*-*",
"Screen___",
"-${ScreenDefaultBase}${ScreenStdSuffix}",
"ScreenRoman__",
"-${ScreenRomanBase}${ScreenStdSuffix}",
"ScreenDecorative__",
"-${ScreenDecorativeBase}${ScreenStdSuffix}",
"ScreenModern__",
"-${ScreenModernBase}${ScreenStdSuffix}",
"ScreenTeletype__",
"-${ScreenTeletypeBase}${ScreenStdSuffix}",
"ScreenSwiss__",
"-${ScreenSwissBase}${ScreenStdSuffix}",
"ScreenScript__",
"-${ScreenScriptBase}${ScreenStdSuffix}",
NULL
};
enum {wxWEIGHT_NORMAL, wxWEIGHT_BOLD, wxWEIGHT_LIGHT, wxNUM_WEIGHTS};
enum {wxSTYLE_NORMAL, wxSTYLE_ITALIC, wxSTYLE_SLANT, wxNUM_STYLES};
static int WCoordinate(int w)
{
switch (w) {
case wxBOLD: return wxWEIGHT_BOLD;
case wxLIGHT: return wxWEIGHT_LIGHT;
case wxNORMAL:
default: return wxWEIGHT_NORMAL;
}
}
static int SCoordinate(int s)
{
switch (s) {
case wxITALIC: return wxSTYLE_ITALIC;
case wxSLANT: return wxSTYLE_SLANT;
case wxNORMAL:
default: return wxSTYLE_NORMAL;
}
}
//-----------------------------------------------------------------------------
// wxSuffixMap
//-----------------------------------------------------------------------------
class wxSuffixMap {
public:
~wxSuffixMap(void);
inline char *GetName(int weight, int style)
{
return ( map [WCoordinate(weight)] [SCoordinate(style)] );
}
char *map[wxNUM_WEIGHTS][wxNUM_STYLES];
void Initialize(const char *, const char *);
};
//#if !USE_RESOURCES
#define wxGetResource(a, b, c) 0
//#endif
static void SearchResource(const char *prefix, const char **names, int count, char **v)
{
int k, i, j;
char resource[1024], **defaults, *internal;
k = 1 << count;
*v = NULL;
internal = NULL;
for (i = 0; i < k; i++) {
strcpy(resource, prefix);
for (j = 0; j < count; j++) {
if (!(i & (1 << j)))
strcat(resource, names[j]);
else
strcat(resource, "_");
}
if (wxGetResource(wxAPP_CLASS, (char *)resource, v))
return;
if (!internal) {
defaults = font_defaults;
while (*defaults) {
if (!strcmp(*defaults, resource)) {
internal = defaults[1];
break;
}
defaults += 2;
}
}
}
if (internal)
*v = copystring(internal);
}
wxSuffixMap::~wxSuffixMap(void)
{
int k, j;
for (k = 0; k < wxNUM_WEIGHTS; ++k)
for (j = 0; j < wxNUM_STYLES; ++j)
if (map[k][j]) {
delete[] map[k][j];
map[k][j] = NULL;
}
}
void wxSuffixMap::Initialize(const char *resname, const char *devresname)
{
const char *weight, *style;
char *v;
int i, j, k;
const char *names[3];
for (k = 0; k < wxNUM_WEIGHTS; k++) {
switch (k) {
case wxWEIGHT_NORMAL: weight = "Medium"; break;
case wxWEIGHT_LIGHT: weight = "Light"; break;
case wxWEIGHT_BOLD:
default: weight = "Bold";
}
for (j = 0; j < wxNUM_STYLES; j++) {
switch (j) {
case wxSTYLE_NORMAL: style = "Straight"; break;
case wxSTYLE_ITALIC: style = "Italic"; break;
case wxSTYLE_SLANT:
default: style = "Slant";
}
names[0] = resname;
names[1] = weight;
names[2] = style;
SearchResource(devresname, names, 3, &v);
/* Expand macros in the found string: */
found:
int len, closer = 0, startpos = 0;
len = (v ? strlen(v) : 0);
for (i = 0; i < len; i++) {
if (v[i] == '$' && ((v[i+1] == '[') || (v[i+1] == '{'))) {
startpos = i;
closer = (v[i+1] == '[') ? ']' : '}';
++i;
} else if (v[i] == closer) {
int newstrlen;
const char *r = NULL; bool delete_r = FALSE;
char *name;
name = v + startpos + 2;
v[i] = 0;
if (closer == '}') {
int i, count, len;
char **names;
for (i = 0, count = 1; name[i]; i++)
if (name[i] == ',')
count++;
len = i;
names = new char*[count];
names[0] = name;
for (i = 0, count = 1; i < len; i++)
if (name[i] == ',') {
names[count++] = name + i + 1;
name[i] = 0;
}
SearchResource("", (const char **)names, count, (char **)&r);
delete_r = (r != 0);
delete[] names;
if (!r) {
for (i = 0; i < len; i++)
if (!name[i])
name[i] = ',';
r = "";
printf("Bad resource name \"%s\" in font lookup\n", name);
}
} else if (!strcmp(name, "weight")) {
r = weight;
} else if (!strcmp(name, "style")) {
r = style;
} else if (!strcmp(name, "family")) {
r = resname;
} else {
r = "";
printf("Bad font macro name \"%s\"\n", name);
}
// add r to v
newstrlen = strlen(r);
char *naya = new char[startpos + newstrlen + len - i];
memcpy(naya, v, startpos);
memcpy(naya + startpos, r, newstrlen);
memcpy(naya + startpos + newstrlen, v + i + 1, len - i);
if (delete_r)
delete[] (char*)r;
delete[] v;
v = naya;
goto found;
}
}
/* We have a final value: */
map[k][j] = v;
}
}
}
//-----------------------------------------------------------------------------
// wxFontNameItem
//-----------------------------------------------------------------------------
class wxFontNameItem : public wxObject {
DECLARE_DYNAMIC_CLASS(wxFontNameItem)
public:
wxFontNameItem(const char *name, int id, int family);
~wxFontNameItem();
inline char* GetScreenName(int w, int s) {return screen.GetName(w, s);}
inline char* GetPostScriptName(int w, int s) {return printing.GetName(w, s);}
inline char* GetAFMName(int w, int s) {return afm.GetName(w, s);}
inline char* GetName(void) {return name;}
inline int GetFamily(void) {return family;}
inline int GetId(void) {return id;}
inline bool IsRoman(void) {return isroman;}
#if WXDEBUG
void Dump(ostream& str);
#endif
int id;
int family;
char *name;
wxSuffixMap screen, printing, afm;
bool isroman;
};
IMPLEMENT_ABSTRACT_CLASS(wxFontNameItem, wxObject)
wxFontNameItem::wxFontNameItem(const char *Name, int Id, int Family)
{
name = copystring(Name);
id = Id;
family = Family;
screen. Initialize(name, "Screen");
printing.Initialize(name, "PostScript");
afm. Initialize(name, "Afm");
}
wxFontNameItem::~wxFontNameItem(void)
{
if (name)
delete[] name;
name = NULL;
}
#if WXDEBUG
void wxFontNameItem::Dump(ostream& str)
{
str << "wxFontNameItem(" << name << ")";
}
#endif
//-----------------------------------------------------------------------------
// wxFontDirectory
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxFontNameDirectory, wxObject)
wxFontNameDirectory::wxFontNameDirectory(void)
{
table = new wxHashTable(wxKEY_INTEGER, 20);
nextFontId = -1;
Initialize();
}
wxFontNameDirectory::~wxFontNameDirectory()
{
// Cleanup wxFontNameItems allocated
table->BeginFind();
wxNode *node = table->Next();
while (node) {
wxFontNameItem *item = (wxFontNameItem*)node->Data();
delete item;
node = table->Next();
}
delete table;
}
int wxFontNameDirectory::GetNewFontId(void)
{
return (nextFontId--);
}
void wxFontNameDirectory::Initialize()
{
Initialize(wxDEFAULT, wxDEFAULT, "Default");
Initialize(wxDECORATIVE, wxDECORATIVE, "Decorative");
Initialize(wxROMAN, wxROMAN, "Roman");
Initialize(wxMODERN, wxMODERN, "Modern");
Initialize(wxTELETYPE, wxTELETYPE, "Teletype");
Initialize(wxSWISS, wxSWISS, "Swiss");
Initialize(wxSCRIPT, wxSCRIPT, "Script");
}
void wxFontNameDirectory::Initialize(int fontid, int family, const char *resname)
{
char *fam, resource[256];
sprintf(resource, "Family%s", resname);
SearchResource((const char *)resource, NULL, 0, (char **)&fam);
if (fam) {
if (!strcmp(fam, "Default")) family = wxDEFAULT;
else if (!strcmp(fam, "Roman")) family = wxROMAN;
else if (!strcmp(fam, "Decorative")) family = wxDECORATIVE;
else if (!strcmp(fam, "Modern")) family = wxMODERN;
else if (!strcmp(fam, "Teletype")) family = wxTELETYPE;
else if (!strcmp(fam, "Swiss")) family = wxSWISS;
else if (!strcmp(fam, "Script")) family = wxSCRIPT;
delete[] fam; // free resource
}
table->Put(fontid, new wxFontNameItem(resname, fontid, family));
}
int wxFontNameDirectory::FindOrCreateFontId(const char *name, int family)
{
int id;
// font exists -> return id
if ( (id = GetFontId(name)) ) return id;
// create new font
Initialize(id=GetNewFontId(), family, name);
return id;
}
char *wxFontNameDirectory::GetScreenName(int fontid, int weight, int style)
{
wxFontNameItem *item = (wxFontNameItem*)table->Get(fontid); // find font
if (item)
return item->GetScreenName(weight, style);
// font does not exist
return NULL;
}
char *wxFontNameDirectory::GetPostScriptName(int fontid, int weight, int style)
{
wxFontNameItem *item = (wxFontNameItem*)table->Get(fontid); // find font
if (item)
return item->GetPostScriptName(weight, style);
// font does not exist
return NULL;
}
char *wxFontNameDirectory::GetAFMName(int fontid, int weight, int style)
{
wxFontNameItem *item = (wxFontNameItem *)table->Get(fontid); // find font
if (item)
return item->GetAFMName(weight, style);
// font does not exist
return NULL;
}
char *wxFontNameDirectory::GetFontName(int fontid)
{
wxFontNameItem *item = (wxFontNameItem *)table->Get(fontid); // find font
if (item)
return item->GetName();
// font does not exist
return NULL;
}
int wxFontNameDirectory::GetFontId(const char *name)
{
wxNode *node;
table->BeginFind();
while ( (node = table->Next()) ) {
wxFontNameItem *item = (wxFontNameItem*)node->Data();
if (!strcmp(name, item->name))
return item->id;
}
// font does not exist
return 0;
}
int wxFontNameDirectory::GetFamily(int fontid)
{
wxFontNameItem *item = (wxFontNameItem *)table->Get(fontid);
if (item)
return item->family;
// font does not exist
return wxDEFAULT;
}

353
src/gtk1/frame.cpp Normal file
View File

@@ -0,0 +1,353 @@
/////////////////////////////////////////////////////////////////////////////
// Name: frame.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 "frame.h"
#endif
#include "wx/frame.h"
#include "wx/dialog.h"
#include "wx/control.h"
#include "wx/app.h"
#include "wx/gtk/win_gtk.h"
const wxMENU_HEIGHT = 28;
const wxSTATUS_HEIGHT = 25;
extern wxList wxTopLevelWindows;
extern wxList wxPendingDelete;
//-----------------------------------------------------------------------------
// wxFrame
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// size
void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxFrame *win )
{
if (!win->HasVMT()) return;
/*
printf( "OnFrameResize from " );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
printf( win->GetClassInfo()->GetClassName() );
printf( ".\n" );
*/
win->GtkOnSize( alloc->width, alloc->height );
};
//-----------------------------------------------------------------------------
// delete
bool gtk_frame_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED(event), wxFrame *win )
{
/*
printf( "OnDelete from " );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
printf( win->GetClassInfo()->GetClassName() );
printf( ".\n" );
*/
win->Close();
return TRUE;
};
//-----------------------------------------------------------------------------
BEGIN_EVENT_TABLE(wxFrame, wxWindow)
EVT_CLOSE(wxFrame::OnCloseWindow)
EVT_SIZE(wxFrame::OnSize)
END_EVENT_TABLE()
IMPLEMENT_DYNAMIC_CLASS(wxFrame,wxWindow)
wxFrame::wxFrame(void)
{
m_doingOnSize = FALSE;
m_frameMenuBar = NULL;
m_frameStatusBar = NULL;
m_sizeSet = FALSE;
wxTopLevelWindows.Insert( this );
};
wxFrame::wxFrame( wxWindow *parent, const wxWindowID id, const wxString &title,
const wxPoint &pos, const wxSize &size,
const long style, const wxString &name )
{
m_sizeSet = FALSE;
Create( parent, id, title, pos, size, style, name );
wxTopLevelWindows.Insert( this );
};
bool wxFrame::Create( wxWindow *parent, const wxWindowID id, const wxString &title,
const wxPoint &pos, const wxSize &size,
const long style, const wxString &name )
{
m_needParent = FALSE;
m_mainWindow = NULL;
m_wxwindow = NULL;
PreCreation( parent, id, pos, size, style, name );
m_doingOnSize = FALSE;
m_title = title;
m_widget = gtk_window_new( GTK_WINDOW_TOPLEVEL );
if ((size.x != -1) && (size.y != -1))
gtk_widget_set_usize( m_widget, m_width, m_height );
if ((pos.x != -1) && (pos.y != -1))
gtk_widget_set_uposition( m_widget, m_x, m_y );
gtk_window_set_title( GTK_WINDOW(m_widget), title );
GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS );
gtk_widget_set( m_widget, "GtkWindow::allow_shrink", TRUE, NULL);
gtk_signal_connect( GTK_OBJECT(m_widget), "delete_event",
GTK_SIGNAL_FUNC(gtk_frame_delete_callback), (gpointer)this );
m_mainWindow = gtk_myfixed_new();
gtk_widget_show( m_mainWindow );
GTK_WIDGET_UNSET_FLAGS( m_mainWindow, GTK_CAN_FOCUS );
gtk_container_add( GTK_CONTAINER(m_widget), m_mainWindow );
gtk_widget_set_uposition( m_mainWindow, 0, 0 );
m_wxwindow = gtk_myfixed_new();
gtk_widget_show( m_wxwindow );
GTK_WIDGET_UNSET_FLAGS( m_wxwindow, GTK_CAN_FOCUS );
gtk_container_add( GTK_CONTAINER(m_mainWindow), m_wxwindow );
m_frameMenuBar = NULL;
m_frameStatusBar = NULL;
gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
GTK_SIGNAL_FUNC(gtk_frame_size_callback), (gpointer)this );
PostCreation();
gtk_widget_realize( m_mainWindow );
return TRUE;
};
wxFrame::~wxFrame(void)
{
if (m_frameMenuBar) delete m_frameMenuBar;
if (m_frameStatusBar) delete m_frameStatusBar;
// if (m_mainWindow) gtk_widget_destroy( m_mainWindow );
wxTopLevelWindows.DeleteObject( this );
if (wxTopLevelWindows.Number() == 0) wxTheApp->ExitMainLoop();
};
bool wxFrame::Show( const bool show )
{
if (show)
{
wxSizeEvent event( wxSize(m_width,m_height), GetId() );
m_sizeSet = FALSE;
ProcessEvent( event );
};
return wxWindow::Show( show );
};
void wxFrame::Enable( const bool enable )
{
wxWindow::Enable( enable );
gtk_widget_set_sensitive( m_mainWindow, enable );
};
void wxFrame::OnCloseWindow( wxCloseEvent& WXUNUSED(event) )
{
this->Destroy();
};
bool wxFrame::Destroy(void)
{
if (!wxPendingDelete.Member(this))
wxPendingDelete.Append(this);
return TRUE;
}
void wxFrame::GetClientSize( int *width, int *height ) const
{
wxWindow::GetClientSize( width, height );
if (height)
{
if (m_frameMenuBar) (*height) -= wxMENU_HEIGHT;
if (m_frameStatusBar) (*height) -= wxSTATUS_HEIGHT;
};
};
void wxFrame::GtkOnSize( int width, int height )
{
if ((m_height == height) && (m_width == width) &&
(m_sizeSet)) return;
if (!m_mainWindow) return;
if (!m_wxwindow) return;
m_width = width;
m_height = height;
gtk_widget_set_usize( m_widget, width, height );
int main_x = 0;
int main_y = 0;
int main_height = height;
int main_width = width;
// This emulates Windows behaviour:
// The menu bar is part of the main window, but the status bar
// is on the implementation side in the client area. The
// function GetClientSize returns the size of the client area
// minus the status bar height. Under wxGTK, the main window
// is represented by m_mainWindow. The menubar is inserted
// into m_mainWindow whereas the statusbar is insertes into
// m_wxwindow just like any other window.
// not really needed
gtk_widget_set_usize( m_mainWindow, width, height );
if (m_frameMenuBar)
{
main_y = wxMENU_HEIGHT;
main_height -= wxMENU_HEIGHT;
};
gtk_widget_set_uposition( GTK_WIDGET(m_wxwindow), main_x, main_y );
gtk_widget_set_usize( GTK_WIDGET(m_wxwindow), main_width, main_height );
if (m_frameMenuBar)
{
gtk_widget_set_uposition( m_frameMenuBar->m_widget, 1, 1 );
gtk_widget_set_usize( m_frameMenuBar->m_widget, width-2, wxMENU_HEIGHT-2 );
};
if (m_frameStatusBar)
{
m_frameStatusBar->SetSize( 0, main_height-wxSTATUS_HEIGHT, width, wxSTATUS_HEIGHT );
};
m_sizeSet = TRUE;
wxSizeEvent event( wxSize(m_width,m_height), GetId() );
event.SetEventObject( this );
ProcessEvent( event );
};
void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) )
{
wxWindow *child = NULL;
int noChildren = 0;
for(wxNode *node = GetChildren()->First(); node; node = node->Next())
{
wxWindow *win = (wxWindow *)node->Data();
if (!win->IsKindOf(CLASSINFO(wxFrame)) &&
!win->IsKindOf(CLASSINFO(wxDialog))
/* && (win != m_frameMenuBar) &&
(win != m_frameStatusBar) not in m_children anyway */
)
{
child = win;
noChildren ++;
};
}
;
if ((child) && (noChildren == 1))
{
int client_x, client_y;
GetClientSize(&client_x, &client_y);
child->SetSize( 1, 1, client_x-2, client_y);
}
;
};
void SetInvokingWindow( wxMenu *menu, wxWindow *win )
{
menu->SetInvokingWindow( win );
wxNode *node = menu->m_items.First();
while (node)
{
wxMenuItem *menuitem = (wxMenuItem*)node->Data();
if (menuitem->m_isSubMenu) SetInvokingWindow( menuitem->m_subMenu, win );
node = node->Next();
};
};
void wxFrame::SetMenuBar( wxMenuBar *menuBar )
{
m_frameMenuBar = menuBar;
wxNode *node = m_frameMenuBar->m_menus.First();
while (node)
{
wxMenu *menu = (wxMenu*)node->Data();
SetInvokingWindow( menu, this );
node = node->Next();
};
m_frameMenuBar->m_parent = this;
gtk_myfixed_put( GTK_MYFIXED(m_mainWindow),
m_frameMenuBar->m_widget, m_frameMenuBar->m_x, m_frameMenuBar->m_y );
};
bool wxFrame::CreateStatusBar( const int number )
{
if (m_frameStatusBar)
delete m_frameStatusBar;
m_frameStatusBar = new wxStatusBar( this, -1, wxPoint(0,0), wxSize(100,20) );
m_frameStatusBar->SetFieldsCount( number );
return TRUE;
};
void wxFrame::SetStatusText( const wxString &text, const int number )
{
if (m_frameStatusBar) m_frameStatusBar->SetStatusText( text, number );
};
void wxFrame::SetStatusWidths( const int n, const int *width )
{
if (m_frameStatusBar) m_frameStatusBar->SetStatusWidths( n, width );
};
wxStatusBar *wxFrame::GetStatusBar(void)
{
return m_frameStatusBar;
};
wxMenuBar *wxFrame::GetMenuBar(void)
{
return m_frameMenuBar;
};
void wxFrame::SetTitle( const wxString &title )
{
m_title = title;
gtk_window_set_title( GTK_WINDOW(m_widget), title );
};
wxString wxFrame::GetTitle(void) const
{
return (wxString&)m_title;
};

21
src/gtk1/gdiobj.cpp Normal file
View File

@@ -0,0 +1,21 @@
/////////////////////////////////////////////////////////////////////////////
// Name: gdiobj.cpp
// Purpose: wxGDIObject class
// Author: Julian Smart
// Modified by:
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) Julian Smart and Markus Holzem
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "gdiobj.h"
#endif
#include "wx/gdiobj.h"
#if !USE_SHARED_LIBRARIES
IMPLEMENT_DYNAMIC_CLASS(wxGDIObject, wxObject)
#endif

6
src/gtk1/horiz.xbm Normal file
View File

@@ -0,0 +1,6 @@
#define horiz_width 15
#define horiz_height 15
static char horiz_bits[] = {
0x00, 0x00, 0x00, 0x00, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0xff, 0x7f, 0x00, 0x00, 0x00, 0x00};

22
src/gtk1/icon.cpp Normal file
View File

@@ -0,0 +1,22 @@
/////////////////////////////////////////////////////////////////////////////
// Name: icon.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 "icon.h"
#endif
#include "wx/icon.h"
//-----------------------------------------------------------------------------
// wxIcon
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxIcon,wxBitmap)

266
src/gtk1/listbox.cpp Normal file
View File

@@ -0,0 +1,266 @@
/////////////////////////////////////////////////////////////////////////////
// Name: listbox.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 "listbox.h"
#endif
#include "wx/listbox.h"
//-----------------------------------------------------------------------------
// wxListBox
//-----------------------------------------------------------------------------
void gtk_listitem_select_callback( GtkWidget *widget, gpointer data )
{
wxListBox *listbox = (wxListBox*)data;
wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, listbox->GetId() );
event.SetInt( listbox->GetIndex( widget ) );
GtkBin *bin = GTK_BIN( widget );
GtkLabel *label = GTK_LABEL( bin->child );
wxString tmp( label->label );
event.SetString( WXSTRINGCAST(tmp) );
event.SetEventObject( listbox );
listbox->ProcessEvent( event );
};
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxListBox,wxControl)
wxListBox::wxListBox(void)
{
m_list = NULL;
};
wxListBox::wxListBox( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size,
const int n, const wxString choices[],
const long style, const wxString &name )
{
Create( parent, id, pos, size, n, choices, style, name );
};
bool wxListBox::Create( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size,
const int n, const wxString choices[],
const long style, const wxString &name )
{
m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name );
m_widget = gtk_scrolled_window_new( NULL, NULL );
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(m_widget),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
m_list = GTK_LIST( gtk_list_new() );
gtk_list_set_selection_mode( GTK_LIST(m_list), GTK_SELECTION_BROWSE );
gtk_container_add (GTK_CONTAINER(m_widget), GTK_WIDGET(m_list) );
gtk_widget_show( GTK_WIDGET(m_list) );
for (int i = 0; i < n; i++)
{
GtkWidget *list_item;
list_item = gtk_list_item_new_with_label( choices[i] );
gtk_signal_connect( GTK_OBJECT(list_item), "select",
GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
gtk_container_add( GTK_CONTAINER(m_list), list_item );
gtk_widget_show( list_item );
};
PostCreation();
Show( TRUE );
return TRUE;
};
void wxListBox::Append( const wxString &item )
{
GtkWidget *list_item;
list_item = gtk_list_item_new_with_label( item );
gtk_signal_connect( GTK_OBJECT(list_item), "select",
GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
gtk_container_add( GTK_CONTAINER(m_list), list_item );
gtk_widget_show( list_item );
};
void wxListBox::Append( const wxString &WXUNUSED(item), char *WXUNUSED(clientData) )
{
};
void wxListBox::Clear(void)
{
gtk_list_clear_items( m_list, 0, Number() );
};
void wxListBox::Delete( int n )
{
gtk_list_clear_items( m_list, n, n );
};
void wxListBox::Deselect( int n )
{
gtk_list_unselect_item( m_list, n );
};
int wxListBox::FindString( const wxString &item ) const
{
GList *child = m_list->children;
int count = 0;
while (child)
{
GtkBin *bin = GTK_BIN( child->data );
GtkLabel *label = GTK_LABEL( bin->child );
if (item == label->label) return count;
count++;
child = child->next;
};
return -1;
};
char *wxListBox::GetClientData( const int WXUNUSED(n) ) const
{
return NULL;
};
int wxListBox::GetSelection(void) const
{
GList *selection = m_list->selection;
if (selection)
{
GList *child = m_list->children;
int count = 0;
while (child)
{
if (child->data == selection->data) return count;
count++;
child = child->next;
};
};
return -1;
};
int wxListBox::GetSelections( int **WXUNUSED(selections) ) const
{
return 0;
};
wxString wxListBox::GetString( int n ) const
{
GList *child = g_list_nth( m_list->children, n );
if (child)
{
GtkBin *bin = GTK_BIN( child->data );
GtkLabel *label = GTK_LABEL( bin->child );
return label->label;
};
return "";
};
wxString wxListBox::GetStringSelection(void) const
{
GList *selection = m_list->selection;
if (selection)
{
GtkBin *bin = GTK_BIN( selection->data );
wxString tmp = GTK_LABEL( bin->child )->label;
return tmp;
};
return "";
};
int wxListBox::Number(void)
{
GList *child = m_list->children;
int count = 0;
while (child) { count++; child = child->next; };
return count;
};
bool wxListBox::Selected( const int n )
{
GList *target = g_list_nth( m_list->children, n );
if (target)
{
GList *child = m_list->selection;
while (child)
{
if (child->data == target->data) return TRUE;
child = child->next;
};
};
return FALSE;
};
void wxListBox::Set( const int WXUNUSED(n), const wxString *WXUNUSED(choices) )
{
};
void wxListBox::SetClientData( const int WXUNUSED(n), char *WXUNUSED(clientData) )
{
};
void wxListBox::SetFirstItem( int WXUNUSED(n) )
{
};
void wxListBox::SetFirstItem( const wxString &WXUNUSED(item) )
{
};
void wxListBox::SetSelection( const int n, const bool select )
{
if (select)
gtk_list_select_item( m_list, n );
else
gtk_list_unselect_item( m_list, n );
};
void wxListBox::SetString( const int WXUNUSED(n), const wxString &WXUNUSED(string) )
{
};
void wxListBox::SetStringSelection( const wxString &string, const bool select )
{
SetSelection( FindString(string), select );
};
int wxListBox::GetIndex( GtkWidget *item ) const
{
if (item)
{
GList *child = m_list->children;
int count = 0;
while (child)
{
if (GTK_WIDGET(child->data) == item) return count;
count++;
child = child->next;
};
};
return -1;
};

198
src/gtk1/mdi.cpp Normal file
View File

@@ -0,0 +1,198 @@
/////////////////////////////////////////////////////////////////////////////
// Name: mdi.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 "mdi.h"
#endif
#include "wx/mdi.h"
//-----------------------------------------------------------------------------
// wxMDIParentFrame
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxMDIParentFrame,wxFrame)
wxMDIParentFrame::wxMDIParentFrame(void)
{
m_clientWindow = NULL;
m_currentChild = NULL;
m_parentFrameActive = TRUE;
};
wxMDIParentFrame::wxMDIParentFrame( wxWindow *parent,
const wxWindowID id, const wxString& title,
const wxPoint& pos, const wxSize& size,
const long style, const wxString& name )
{
m_clientWindow = NULL;
m_currentChild = NULL;
m_parentFrameActive = TRUE;
Create( parent, id, title, pos, size, style, name );
};
wxMDIParentFrame::~wxMDIParentFrame(void)
{
};
bool wxMDIParentFrame::Create( wxWindow *parent,
const wxWindowID id, const wxString& title,
const wxPoint& pos, const wxSize& size,
const long style, const wxString& name )
{
wxFrame::Create( parent, id, title, pos, size, style, name );
OnCreateClient();
return TRUE;
};
void wxMDIParentFrame::OnSize( wxSizeEvent& event )
{
wxFrame::OnSize( event );
};
void wxMDIParentFrame::OnActivate( wxActivateEvent& WXUNUSED(event) )
{
};
void wxMDIParentFrame::SetMenuBar( wxMenuBar *menu_bar )
{
wxFrame::SetMenuBar( menu_bar );
};
void wxMDIParentFrame::GetClientSize(int *width, int *height ) const
{
wxFrame::GetClientSize( width, height );
};
wxMDIChildFrame *wxMDIParentFrame::GetActiveChild(void) const
{
return m_currentChild;
};
wxMDIClientWindow *wxMDIParentFrame::GetClientWindow(void) const
{
return m_clientWindow;
};
wxMDIClientWindow *wxMDIParentFrame::OnCreateClient(void)
{
m_clientWindow = new wxMDIClientWindow( this );
return m_clientWindow;
};
void wxMDIParentFrame::ActivateNext(void)
{
};
void wxMDIParentFrame::ActivatePrevious(void)
{
};
void wxMDIParentFrame::OnSysColourChanged( wxSysColourChangedEvent& WXUNUSED(event) )
{
};
//-----------------------------------------------------------------------------
// wxMDIChildFrame
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxMDIChildFrame,wxPanel)
wxMDIChildFrame::wxMDIChildFrame(void)
{
};
wxMDIChildFrame::wxMDIChildFrame( wxMDIParentFrame *parent,
const wxWindowID id, const wxString& title,
const wxPoint& pos, const wxSize& size,
const long style, const wxString& name )
{
Create( parent, id, title, pos, size, style, name );
};
wxMDIChildFrame::~wxMDIChildFrame(void)
{
};
bool wxMDIChildFrame::Create( wxMDIParentFrame *parent,
const wxWindowID id, const wxString& title,
const wxPoint& pos, const wxSize& size,
const long style, const wxString& name )
{
m_title = title;
return wxPanel::Create( parent->GetClientWindow(), id, pos, size, style, name );
};
void wxMDIChildFrame::SetMenuBar( wxMenuBar *WXUNUSED(menu_bar) )
{
};
void wxMDIChildFrame::Activate(void)
{
};
//-----------------------------------------------------------------------------
// wxMDIClientWindow
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxMDIClientWindow,wxWindow)
wxMDIClientWindow::wxMDIClientWindow(void)
{
};
wxMDIClientWindow::wxMDIClientWindow( wxMDIParentFrame *parent, const long style )
{
CreateClient( parent, style );
};
wxMDIClientWindow::~wxMDIClientWindow(void)
{
};
bool wxMDIClientWindow::CreateClient( wxMDIParentFrame *parent, const long style )
{
m_needParent = TRUE;
PreCreation( parent, -1, wxPoint(10,10), wxSize(100,100), style, "wxMDIClientWindow" );
m_widget = gtk_notebook_new();
PostCreation();
Show( TRUE );
return TRUE;
};
void wxMDIClientWindow::AddChild( wxWindow *child )
{
m_children.Append( child );
wxString s;
if (child->IsKindOf(CLASSINFO(wxMDIChildFrame)))
{
wxMDIChildFrame* mdi_child = (wxMDIChildFrame*) child;
s = mdi_child->m_title;
};
if (s.IsNull()) s = "MDI child";
GtkWidget *label_widget;
label_widget = gtk_label_new( s );
gtk_misc_set_alignment( GTK_MISC(label_widget), 0.0, 0.5 );
gtk_notebook_append_page( GTK_NOTEBOOK(m_widget), child->m_widget, label_widget );
};

293
src/gtk1/menu.cpp Normal file
View File

@@ -0,0 +1,293 @@
/////////////////////////////////////////////////////////////////////////////
// Name: menu.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 "menu.h"
#endif
#include "wx/menu.h"
//-----------------------------------------------------------------------------
// wxMenuBar
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxMenuBar,wxWindow)
wxMenuBar::wxMenuBar(void)
{
m_needParent = FALSE; // hmmm
PreCreation( NULL, -1, wxDefaultPosition, wxDefaultSize, 0, "menu" );
m_menus.DeleteContents( TRUE );
m_widget = gtk_handle_box_new();
m_menubar = gtk_menu_bar_new();
gtk_container_add( GTK_CONTAINER(m_widget), m_menubar );
gtk_widget_show( m_menubar );
PostCreation();
Show( TRUE );
};
void wxMenuBar::Append( wxMenu *menu, const wxString &title )
{
m_menus.Append( menu );
menu->m_title = title; // ??????
size_t pos;
do {
pos = menu->m_title.First( '&' );
if (pos != wxString::npos) menu->m_title.Remove( pos, 1 );
} while (pos != wxString::npos);
GtkWidget *root_menu;
root_menu = gtk_menu_item_new_with_label( WXSTRINGCAST(menu->m_title) );
gtk_widget_show( root_menu );
gtk_menu_item_set_submenu( GTK_MENU_ITEM(root_menu), menu->m_menu );
gtk_menu_bar_append( GTK_MENU_BAR(m_menubar), root_menu );
};
int FindMenuItemRecursive( const wxMenu *menu, const wxString &menuString, const wxString &itemString )
{
if (menu->m_title == menuString)
{
int res = menu->FindItem( itemString );
if (res != -1) return res;
};
wxNode *node = menu->m_items.First();
while (node)
{
wxMenuItem *item = (wxMenuItem*)node->Data();
if (item->m_subMenu) return FindMenuItemRecursive( item->m_subMenu, menuString, itemString );
node = node->Next();
};
return -1;
};
int wxMenuBar::FindMenuItem( const wxString &menuString, const wxString &itemString ) const
{
wxNode *node = m_menus.First();
while (node)
{
wxMenu *menu = (wxMenu*)node->Data();
int res = FindMenuItemRecursive( menu, menuString, itemString);
if (res != -1) return res;
node = node->Next();
};
return -1;
};
//-----------------------------------------------------------------------------
// wxMenu
//-----------------------------------------------------------------------------
void gtk_menu_clicked_callback( GtkWidget *widget, gpointer data )
{
wxMenu *menu = (wxMenu*)data;
int id = menu->FindMenuIdByMenuItem(widget);
if (!menu->Enabled(id)) return;
wxCommandEvent event( wxEVENT_TYPE_MENU_COMMAND, id );
event.SetEventObject( menu );
event.SetInt(id );
wxWindow *win = menu->GetInvokingWindow();
if (win) win->ProcessEvent( event );
};
IMPLEMENT_DYNAMIC_CLASS(wxMenuItem,wxObject)
wxMenuItem::wxMenuItem(void)
{
m_id = 0;
m_text = "";
m_isCheckMenu = FALSE;
m_checked = FALSE;
m_isSubMenu = FALSE;
m_subMenu = NULL;
m_helpStr = "";
m_menuItem = NULL;
};
IMPLEMENT_DYNAMIC_CLASS(wxMenu,wxEvtHandler)
wxMenu::wxMenu( const wxString &title )
{
m_title = title;
m_items.DeleteContents( TRUE );
m_invokingWindow = NULL;
m_menu = gtk_menu_new(); // Do not show!
};
void wxMenu::AppendSeparator(void)
{
wxMenuItem *mitem = new wxMenuItem();
mitem->m_id = -1;
mitem->m_text = "";
mitem->m_helpStr = "";
mitem->m_isCheckMenu = FALSE;
mitem->m_isEnabled = TRUE;
mitem->m_menuItem = gtk_menu_item_new();
gtk_menu_append( GTK_MENU(m_menu), mitem->m_menuItem );
gtk_widget_show( mitem->m_menuItem );
m_items.Append( mitem );
};
void wxMenu::Append( const int id, const wxString &item, const wxString &helpStr, const bool checkable )
{
wxMenuItem *mitem = new wxMenuItem();
mitem->m_id = id;
mitem->m_text = item;
size_t pos;
do {
pos = mitem->m_text.First( '&' );
if (pos != wxString::npos) mitem->m_text.Remove( pos, 1 );
} while (pos != wxString::npos);
mitem->m_helpStr = helpStr;
mitem->m_isCheckMenu = checkable;
mitem->m_isEnabled = TRUE;
if (checkable)
mitem->m_menuItem = gtk_check_menu_item_new_with_label( WXSTRINGCAST(mitem->m_text) );
else
mitem->m_menuItem = gtk_menu_item_new_with_label( WXSTRINGCAST(mitem->m_text) );
gtk_signal_connect( GTK_OBJECT(mitem->m_menuItem), "activate",
GTK_SIGNAL_FUNC(gtk_menu_clicked_callback), (gpointer*)this );
gtk_menu_append( GTK_MENU(m_menu), mitem->m_menuItem );
gtk_widget_show( mitem->m_menuItem );
m_items.Append( mitem );
};
void wxMenu::Append( const int id, const wxString &item, wxMenu *subMenu, const wxString &helpStr )
{
wxMenuItem *mitem = new wxMenuItem();
mitem->m_id = id;
mitem->m_text = item;
mitem->m_isEnabled = TRUE;
size_t pos;
do {
pos = mitem->m_text.First( '&' );
if (pos != wxString::npos) mitem->m_text.Remove( pos, 1 );
} while (pos != wxString::npos);
mitem->m_helpStr = helpStr;
mitem->m_menuItem = gtk_menu_item_new_with_label( WXSTRINGCAST(mitem->m_text) );
mitem->m_subMenu = subMenu;
gtk_menu_item_set_submenu( GTK_MENU_ITEM(mitem->m_menuItem), subMenu->m_menu );
gtk_menu_append( GTK_MENU(m_menu), mitem->m_menuItem );
gtk_widget_show( mitem->m_menuItem );
m_items.Append( mitem );
};
int wxMenu::FindItem( const wxString itemString ) const
{
wxString s( itemString );
size_t pos;
do {
pos = s.First( '&' );
if (pos != wxString::npos) s.Remove( pos, 1 );
} while (pos != wxString::npos);
wxNode *node = m_items.First();
while (node)
{
wxMenuItem *item = (wxMenuItem*)node->Data();
if (item->m_text == s) return item->m_id;
node = node->Next();
};
return -1;
};
void wxMenu::Enable( const int id, const bool enable )
{
wxNode *node = m_items.First();
while (node)
{
wxMenuItem *item = (wxMenuItem*)node->Data();
if (item->m_id == id)
{
item->m_isEnabled = enable;
return;
};
node = node->Next();
};
};
bool wxMenu::Enabled( const int id ) const
{
wxNode *node = m_items.First();
while (node)
{
wxMenuItem *item = (wxMenuItem*)node->Data();
if (item->m_id == id) return item->m_isEnabled;
node = node->Next();
};
return FALSE;
};
void wxMenu::SetLabel( const int id, const wxString &label )
{
wxString s( label );
size_t pos;
do {
pos = s.First( '&' );
if (pos != wxString::npos) s.Remove( pos, 1 );
} while (pos != wxString::npos);
wxNode *node = m_items.First();
while (node)
{
wxMenuItem *item = (wxMenuItem*)node->Data();
item->m_text = s;
if (item->m_id == id)
{
gtk_label_set( GTK_LABEL( GTK_BIN(item->m_menuItem)->child ), WXSTRINGCAST(s) );
};
node = node->Next();
};
};
int wxMenu::FindMenuIdByMenuItem( GtkWidget *menuItem ) const
{
wxNode *node = m_items.First();
while (node)
{
wxMenuItem *item = (wxMenuItem*)node->Data();
if (item->m_menuItem == menuItem) return item->m_id;
node = node->Next();
};
return -1;
};
void wxMenu::SetInvokingWindow( wxWindow *win )
{
m_invokingWindow = win;
};
wxWindow *wxMenu::GetInvokingWindow(void)
{
return m_invokingWindow;
};

106
src/gtk1/palette.cpp Normal file
View File

@@ -0,0 +1,106 @@
/////////////////////////////////////////////////////////////////////////////
// Name: palette.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 "palette.h"
#endif
#include "wx/palette.h"
//-----------------------------------------------------------------------------
// wxPalette
//-----------------------------------------------------------------------------
class wxPaletteRefData: public wxObjectRefData
{
public:
wxPaletteRefData(void);
~wxPaletteRefData(void);
GdkColormap *m_colormap;
};
wxPaletteRefData::wxPaletteRefData(void)
{
m_colormap = NULL;
};
wxPaletteRefData::~wxPaletteRefData(void)
{
if (m_colormap) gdk_colormap_unref( m_colormap );
};
//-----------------------------------------------------------------------------
#define M_PALETTEDATA ((wxPaletteRefData *)m_refData)
IMPLEMENT_DYNAMIC_CLASS(wxPalette,wxGDIObject)
wxPalette::wxPalette(void)
{
};
wxPalette::wxPalette( const int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue )
{
m_refData = new wxPaletteRefData();
Create( n, red, green, blue );
};
wxPalette::wxPalette( const wxPalette& palette )
{
Ref( palette );
};
wxPalette::wxPalette( const wxPalette* palette )
{
UnRef();
if (palette) Ref( *palette );
};
wxPalette::~wxPalette(void)
{
};
wxPalette& wxPalette::operator = ( const wxPalette& palette )
{
if (*this == palette) return (*this);
Ref( palette );
return *this;
};
bool wxPalette::operator == ( const wxPalette& palette )
{
return m_refData == palette.m_refData;
};
bool wxPalette::operator != ( const wxPalette& palette )
{
return m_refData != palette.m_refData;
};
bool wxPalette::Ok(void) const
{
return (m_refData);
};
bool wxPalette::Create( const int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue)
{
};
int wxPalette::GetPixel( const unsigned char red, const unsigned char green, const unsigned char blue ) const
{
};
bool wxPalette::GetRGB( const int pixel, unsigned char *red, unsigned char *green, unsigned char *blue ) const
{
};

204
src/gtk1/pen.cpp Normal file
View File

@@ -0,0 +1,204 @@
/////////////////////////////////////////////////////////////////////////////
// Name: pen.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 "pen.h"
#endif
#include "wx/pen.h"
//-----------------------------------------------------------------------------
// wxPen
//-----------------------------------------------------------------------------
class wxPenRefData: public wxObjectRefData
{
public:
wxPenRefData(void);
int m_width;
int m_style;
int m_joinStyle;
int m_capStyle;
wxColour m_colour;
};
wxPenRefData::wxPenRefData(void)
{
m_width = 1;
m_style = wxSOLID;
m_joinStyle = wxJOIN_ROUND;
m_capStyle = wxCAP_ROUND;
};
//-----------------------------------------------------------------------------
#define M_PENDATA ((wxPenRefData *)m_refData)
IMPLEMENT_DYNAMIC_CLASS(wxPen,wxGDIObject)
wxPen::wxPen(void)
{
if (wxThePenList) wxThePenList->AddPen( this );
};
wxPen::wxPen( const wxColour &colour, int width, int style )
{
m_refData = new wxPenRefData();
M_PENDATA->m_width = width;
M_PENDATA->m_style = style;
M_PENDATA->m_colour = colour;
if (wxThePenList) wxThePenList->AddPen( this );
};
wxPen::wxPen( const wxString &colourName, int width, int style )
{
m_refData = new wxPenRefData();
M_PENDATA->m_width = width;
M_PENDATA->m_style = style;
M_PENDATA->m_colour = colourName;
if (wxThePenList) wxThePenList->AddPen( this );
};
wxPen::wxPen( const wxPen& pen )
{
Ref( pen );
if (wxThePenList) wxThePenList->AddPen( this );
};
wxPen::wxPen( const wxPen* pen )
{
UnRef();
if (pen) Ref( *pen );
if (wxThePenList) wxThePenList->AddPen( this );
};
wxPen::~wxPen(void)
{
if (wxThePenList) wxThePenList->RemovePen( this );
};
wxPen& wxPen::operator = ( const wxPen& pen )
{
if (*this == pen) return (*this);
Ref( pen );
return *this;
};
bool wxPen::operator == ( const wxPen& pen )
{
return m_refData == pen.m_refData;
};
bool wxPen::operator != ( const wxPen& pen )
{
return m_refData != pen.m_refData;
};
void wxPen::SetColour( const wxColour &colour )
{
if (!m_refData)
m_refData = new wxPenRefData();
M_PENDATA->m_colour = colour;
};
void wxPen::SetColour( const wxString &colourName )
{
if (!m_refData)
m_refData = new wxPenRefData();
M_PENDATA->m_colour = colourName;
};
void wxPen::SetColour( const int red, const int green, const int blue )
{
if (!m_refData)
m_refData = new wxPenRefData();
M_PENDATA->m_colour.Set( red, green, blue );
};
void wxPen::SetCap( int capStyle )
{
if (!m_refData)
m_refData = new wxPenRefData();
M_PENDATA->m_capStyle = capStyle;
};
void wxPen::SetJoin( int joinStyle )
{
if (!m_refData)
m_refData = new wxPenRefData();
M_PENDATA->m_joinStyle = joinStyle;
};
void wxPen::SetStyle( int style )
{
if (!m_refData)
m_refData = new wxPenRefData();
M_PENDATA->m_style = style;
};
void wxPen::SetWidth( int width )
{
if (!m_refData)
m_refData = new wxPenRefData();
M_PENDATA->m_width = width;
};
int wxPen::GetCap(void) const
{
return M_PENDATA->m_capStyle;
};
int wxPen::GetJoin(void) const
{
if (!m_refData)
return 0;
else
return M_PENDATA->m_joinStyle;
};
int wxPen::GetStyle(void) const
{
if (!m_refData)
return 0;
else
return M_PENDATA->m_style;
};
int wxPen::GetWidth(void) const
{
if (!m_refData)
return 0;
else
return M_PENDATA->m_width;
};
wxColour &wxPen::GetColour(void) const
{
if (!m_refData)
return wxNullColour;
else
return M_PENDATA->m_colour;
};
bool wxPen::Ok(void) const
{
return (m_refData);
};

229
src/gtk1/radiobox.cpp Normal file
View File

@@ -0,0 +1,229 @@
/////////////////////////////////////////////////////////////////////////////
// Name: radiobox.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 "radiobox.h"
#endif
#include "wx/radiobox.h"
#include "wx/dialog.h"
#include "wx/frame.h"
#include "wx/gtk/win_gtk.h"
//-----------------------------------------------------------------------------
// wxRadioBox
//-----------------------------------------------------------------------------
void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), gpointer data )
{
wxRadioBox *rb = (wxRadioBox*)data;
wxCommandEvent event( wxEVT_COMMAND_RADIOBOX_SELECTED, rb->GetId() );
event.SetInt( rb->GetSelection() );
wxString tmp( rb->GetStringSelection() );
event.SetString( WXSTRINGCAST(tmp) );
event.SetEventObject( rb );
rb->ProcessEvent(event);
};
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxRadioBox,wxControl)
wxRadioBox::wxRadioBox(void)
{
};
wxRadioBox::wxRadioBox( wxWindow *parent, const wxWindowID id, const wxString& title,
const wxPoint &pos, const wxSize &size,
const int n, const wxString choices[],
const int majorDim, const long style,
const wxString &name )
{
Create( parent, id, title, pos, size, n, choices, majorDim, style, name );
};
bool wxRadioBox::Create( wxWindow *parent, const wxWindowID id, const wxString& title,
const wxPoint &pos, const wxSize &size,
const int n, const wxString choices[],
const int WXUNUSED(majorDim), const long style,
const wxString &name )
{
m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name );
m_widget = gtk_frame_new( title );
int x = m_x+5;
int y = m_y+15;
int maxLen = 0;
int height = 20;
// if (((m_style & wxRA_VERTICAL) == wxRA_VERTICAL) && (n > 0))
if (n > 0)
{
GSList *radio_button_group = NULL;
for (int i = 0; i < n; i++)
{
if (i) radio_button_group = gtk_radio_button_group( GTK_RADIO_BUTTON(m_radio) );
m_radio = GTK_RADIO_BUTTON( gtk_radio_button_new_with_label( radio_button_group, choices[i] ) );
if (!i) gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_radio), TRUE );
gtk_signal_connect( GTK_OBJECT(m_radio), "clicked",
GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
gtk_myfixed_put( GTK_MYFIXED(m_parent->m_wxwindow), GTK_WIDGET(m_radio), x, y );
int tmp = 22+gdk_string_measure( GTK_WIDGET(m_radio)->style->font, choices[i] );
if (tmp > maxLen) maxLen = tmp;
int width = m_width-10;
if (size.x == -1) width = tmp;
gtk_widget_set_usize( GTK_WIDGET(m_radio), width, 20 );
y += 20;
height += 20;
};
};
wxSize newSize = size;
if (newSize.x == -1) newSize.x = maxLen+10;
if (newSize.y == -1) newSize.y = height;
SetSize( newSize.x, newSize.y );
PostCreation();
Show( TRUE );
return TRUE;
};
bool wxRadioBox::Show( const bool show )
{
wxWindow::Show( show );
GSList *item = gtk_radio_button_group( m_radio );
while (item)
{
GtkWidget *w = GTK_WIDGET( item->data );
if (show) gtk_widget_show( w ); else gtk_widget_hide( w );
item = item->next;
};
return TRUE;
};
int wxRadioBox::FindString( const wxString& WXUNUSED(s) ) const
{
return 0;
};
void wxRadioBox::SetSelection( const int WXUNUSED(n) )
{
};
int wxRadioBox::GetSelection(void) const
{
GSList *item = gtk_radio_button_group( m_radio );
int count = 0;
while (item)
{
GtkButton *button = GTK_BUTTON( item->data );
if (GTK_TOGGLE_BUTTON(button)->active) return count;
count++;
item = item->next;
};
return -1;
};
wxString wxRadioBox::GetString( const int WXUNUSED(n) ) const
{
return "";
};
wxString wxRadioBox::GetLabel(void) const
{
return wxControl::GetLabel();
};
void wxRadioBox::SetLabel( const wxString& WXUNUSED(label) )
{
};
void wxRadioBox::SetLabel( const int WXUNUSED(item), const wxString& WXUNUSED(label) )
{
};
void wxRadioBox::SetLabel( const int WXUNUSED(item), wxBitmap *WXUNUSED(bitmap) )
{
};
wxString wxRadioBox::GetLabel( const int WXUNUSED(item) ) const
{
return "";
};
void wxRadioBox::Enable( const bool WXUNUSED(enable) )
{
};
void wxRadioBox::Enable( const int WXUNUSED(item), const bool WXUNUSED(enable) )
{
};
void wxRadioBox::Show( const int WXUNUSED(item), const bool WXUNUSED(show) )
{
};
wxString wxRadioBox::GetStringSelection(void) const
{
GSList *item = gtk_radio_button_group( m_radio );
while (item)
{
GtkButton *button = GTK_BUTTON( item->data );
if (GTK_TOGGLE_BUTTON(button)->active)
{
GtkLabel *label = GTK_LABEL( button->child );
return label->label;
};
item = item->next;
};
return "";
};
bool wxRadioBox::SetStringSelection( const wxString& WXUNUSED(s) )
{
return TRUE;
};
int wxRadioBox::Number(void) const
{
int count = 0;
GSList *item = gtk_radio_button_group( m_radio );
while (item)
{
item = item->next;
count++;
};
return count;
};
int wxRadioBox::GetNumberOfRowsOrCols(void) const
{
return 1;
};
void wxRadioBox::SetNumberOfRowsOrCols( const int WXUNUSED(n) )
{
};

17
src/gtk1/radiobut.cpp Normal file
View File

@@ -0,0 +1,17 @@
/////////////////////////////////////////////////////////////////////////////
// Name: radiobut.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 "radiobut.h"
#endif
#include "wx/radiobut.h"

253
src/gtk1/region.cpp Normal file
View File

@@ -0,0 +1,253 @@
/////////////////////////////////////////////////////////////////////////////
// Name: region.cpp
// Purpose:
// Author: Robert Roebling
// Created: 01/02/98
// Id:
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "region.h"
#endif
#include "wx/region.h"
//-----------------------------------------------------------------------------
// wxRegion
//-----------------------------------------------------------------------------
class wxRegionRefData: public wxObjectRefData
{
public:
wxRegionRefData(void);
~wxRegionRefData(void);
public:
GdkRegion *m_region;
};
wxRegionRefData::wxRegionRefData(void)
{
m_region = NULL;
};
wxRegionRefData::~wxRegionRefData(void)
{
if (m_region) gdk_region_destroy( m_region );
};
//-----------------------------------------------------------------------------
#define M_REGIONDATA ((wxRegionRefData *)m_refData)
IMPLEMENT_DYNAMIC_CLASS(wxRegion,wxGDIObject);
wxRegion::wxRegion( long x, long y, long w, long h )
{
m_refData = new wxRegionRefData();
GdkRegion *reg = gdk_region_new();
GdkRectangle rect;
rect.x = x;
rect.y = y;
rect.width = w;
rect.height = h;
M_REGIONDATA->m_region = gdk_region_union_with_rect( reg, &rect );
gdk_region_destroy( reg );
};
wxRegion::wxRegion( const wxPoint& topLeft, const wxPoint& bottomRight )
{
m_refData = new wxRegionRefData();
GdkRegion *reg = gdk_region_new();
GdkRectangle rect;
rect.x = topLeft.x;
rect.y = topLeft.y;
rect.width = bottomRight.x - rect.x;
rect.height = bottomRight.y - rect.y;
M_REGIONDATA->m_region = gdk_region_union_with_rect( reg, &rect );
gdk_region_destroy( reg );
};
wxRegion::wxRegion( const wxRect& rect )
{
m_refData = new wxRegionRefData();
GdkRegion *reg = gdk_region_new();
GdkRectangle g_rect;
g_rect.x = rect.x;
g_rect.y = rect.y;
g_rect.width = rect.width;
g_rect.height = rect.height;
M_REGIONDATA->m_region = gdk_region_union_with_rect( reg, &g_rect );
gdk_region_destroy( reg );
};
wxRegion::wxRegion(void)
{
m_refData = new wxRegionRefData();
M_REGIONDATA->m_region = gdk_region_new();
};
wxRegion::~wxRegion(void)
{
};
void wxRegion::Clear(void)
{
UnRef();
m_refData = new wxRegionRefData();
M_REGIONDATA->m_region = gdk_region_new();
};
bool wxRegion::Union( long x, long y, long width, long height )
{
GdkRectangle rect;
rect.x = x;
rect.y = y;
rect.width = width;
rect.height = height;
GdkRegion *reg = gdk_region_union_with_rect( M_REGIONDATA->m_region, &rect );
gdk_region_destroy( M_REGIONDATA->m_region );
M_REGIONDATA->m_region = reg;
return TRUE;
};
bool wxRegion::Union( const wxRect& rect )
{
GdkRectangle g_rect;
g_rect.x = rect.x;
g_rect.y = rect.y;
g_rect.width = rect.width;
g_rect.height = rect.height;
GdkRegion *reg = gdk_region_union_with_rect( M_REGIONDATA->m_region, &g_rect );
gdk_region_destroy( M_REGIONDATA->m_region );
M_REGIONDATA->m_region = reg;
return TRUE;
};
bool wxRegion::Union( const wxRegion& region )
{
GdkRegion *reg = gdk_regions_union( M_REGIONDATA->m_region, region.GetRegion() );
gdk_region_destroy( M_REGIONDATA->m_region );
M_REGIONDATA->m_region = reg;
return TRUE;
};
bool wxRegion::Intersect( long x, long y, long width, long height )
{
wxRegion reg( x, y, width, height );
Intersect( reg );
return TRUE;
};
bool wxRegion::Intersect( const wxRect& rect )
{
wxRegion reg( rect );
Intersect( reg );
return TRUE;
};
bool wxRegion::Intersect( const wxRegion& region )
{
GdkRegion *reg = gdk_regions_intersect( M_REGIONDATA->m_region, region.GetRegion() );
gdk_region_destroy( M_REGIONDATA->m_region );
M_REGIONDATA->m_region = reg;
return TRUE;
};
bool wxRegion::Subtract( long x, long y, long width, long height )
{
wxRegion reg( x, y, width, height );
Subtract( reg );
return TRUE;
};
bool wxRegion::Subtract( const wxRect& rect )
{
wxRegion reg( rect );
Subtract( reg );
return TRUE;
};
bool wxRegion::Subtract( const wxRegion& region )
{
GdkRegion *reg = gdk_regions_subtract( M_REGIONDATA->m_region, region.GetRegion() );
gdk_region_destroy( M_REGIONDATA->m_region );
M_REGIONDATA->m_region = reg;
return TRUE;
};
bool wxRegion::Xor( long x, long y, long width, long height )
{
wxRegion reg( x, y, width, height );
Xor( reg );
return TRUE;
};
bool wxRegion::Xor( const wxRect& rect )
{
wxRegion reg( rect );
Xor( reg );
return TRUE;
};
bool wxRegion::Xor( const wxRegion& region )
{
GdkRegion *reg = gdk_regions_xor( M_REGIONDATA->m_region, region.GetRegion() );
gdk_region_destroy( M_REGIONDATA->m_region );
M_REGIONDATA->m_region = reg;
return TRUE;
};
void wxRegion::GetBox( long& x, long& y, long&w, long &h ) const
{
x = 0;
y = 0;
w = -1;
h = -1;
};
wxRect wxRegion::GetBox(void) const
{
return wxRect( 0, 0, -1, -1 );
};
bool wxRegion::Empty(void) const
{
return gdk_region_empty( M_REGIONDATA->m_region );
};
wxRegionContain wxRegion::Contains( long x, long y ) const
{
if (gdk_region_point_in( M_REGIONDATA->m_region, x, y ))
return wxInRegion;
else
return wxOutRegion;
};
wxRegionContain wxRegion::Contains( long x, long y, long w, long h ) const
{
GdkRectangle rect;
rect.x = x;
rect.y = y;
rect.width = w;
rect.height = h;
GdkOverlapType res = gdk_region_rect_in( M_REGIONDATA->m_region, &rect );
switch (res)
{
case GDK_OVERLAP_RECTANGLE_IN: return wxInRegion;
case GDK_OVERLAP_RECTANGLE_OUT: return wxOutRegion;
case GDK_OVERLAP_RECTANGLE_PART: return wxPartRegion;
};
return wxOutRegion;
};
GdkRegion *wxRegion::GetRegion(void) const
{
return M_REGIONDATA->m_region;
};

216
src/gtk1/scrolbar.cpp Normal file
View File

@@ -0,0 +1,216 @@
/////////////////////////////////////////////////////////////////////////////
// Name: scrolbar.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 "scrolbar.h"
#endif
#include "wx/scrolbar.h"
#include "wx/utils.h"
//-----------------------------------------------------------------------------
// wxScrollBar
//-----------------------------------------------------------------------------
void gtk_scrollbar_callback( GtkWidget *WXUNUSED(widget), wxScrollBar *win )
{
/*
printf( "OnScroll from " );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
printf( win->GetClassInfo()->GetClassName() );
printf( ".\n" );
*/
if (!win->HasVMT()) return;
float diff = win->m_adjust->value - win->m_oldPos;
if (fabs(diff) < 0.2) return;
int command = 0;
float line_step = win->m_adjust->step_increment;
float page_step = win->m_adjust->page_increment;
if (fabs(diff-line_step) < 0.2) command = wxEVT_SCROLL_LINEDOWN;
else if (fabs(diff+line_step) < 0.2) command = wxEVT_SCROLL_LINEUP;
else if (fabs(diff-page_step) < 0.2) command = wxEVT_SCROLL_PAGEDOWN;
else if (fabs(diff+page_step) < 0.2) command = wxEVT_SCROLL_PAGEUP;
else command = wxEVT_SCROLL_THUMBTRACK;
int value = (int)(win->m_adjust->value+0.5);
int orient = wxHORIZONTAL;
if (win->GetWindowStyleFlag() & wxSB_VERTICAL == wxSB_VERTICAL) orient = wxHORIZONTAL;
wxScrollEvent event( command, win->GetId(), value, orient );
event.SetEventObject( win );
win->ProcessEvent( event );
/*
wxCommandEvent cevent( wxEVT_COMMAND_SCROLLBAR_UPDATED, win->GetId() );
cevent.SetEventObject( win );
win->ProcessEvent( cevent );
*/
};
IMPLEMENT_DYNAMIC_CLASS(wxScrollBar,wxControl)
wxScrollBar::wxScrollBar(wxWindow *parent, const wxWindowID id,
const wxPoint& pos, const wxSize& size,
const long style, const wxString& name )
{
Create( parent, id, pos, size, style, name );
};
wxScrollBar::~wxScrollBar(void)
{
};
bool wxScrollBar::Create(wxWindow *parent, const wxWindowID id,
const wxPoint& pos, const wxSize& size,
const long style, const wxString& name )
{
m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name );
m_oldPos = 0.0;
if (style & wxSB_VERTICAL == wxSB_VERTICAL)
m_widget = gtk_hscrollbar_new( NULL );
else
m_widget = gtk_vscrollbar_new( NULL );
m_adjust = gtk_range_get_adjustment( GTK_RANGE(m_widget) );
gtk_signal_connect (GTK_OBJECT (m_adjust), "value_changed",
(GtkSignalFunc) gtk_scrollbar_callback, (gpointer) this );
PostCreation();
Show( TRUE );
return TRUE;
};
int wxScrollBar::GetPosition(void) const
{
return (int)(m_adjust->value+0.5);
};
int wxScrollBar::GetThumbSize() const
{
return (int)(m_adjust->page_size+0.5);
};
int wxScrollBar::GetPageSize() const
{
return (int)(m_adjust->page_increment+0.5);
};
int wxScrollBar::GetRange() const
{
return (int)(m_adjust->upper+0.5);
};
void wxScrollBar::SetPosition( const int viewStart )
{
float fpos = (float)viewStart;
m_oldPos = fpos;
if (fabs(fpos-m_adjust->value) < 0.2) return;
m_adjust->value = fpos;
gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "value_changed" );
};
void wxScrollBar::SetScrollbar( const int position, const int thumbSize, const int range, const int pageSize,
const bool WXUNUSED(refresh) )
{
float fpos = (float)position;
m_oldPos = fpos;
float frange = (float)range;
float fthumb = (float)thumbSize;
float fpage = (float)pageSize;
if ((fabs(fpos-m_adjust->value) < 0.2) &&
(fabs(frange-m_adjust->upper) < 0.2) &&
(fabs(fthumb-m_adjust->page_size) < 0.2) &&
(fabs(fpage-m_adjust->page_increment) < 0.2))
return;
m_adjust->lower = 0.0;
m_adjust->upper = frange;
m_adjust->value = fpos;
m_adjust->step_increment = 1.0;
m_adjust->page_increment = (float)(wxMax(fpage-2,0));
m_adjust->page_size = fthumb;
gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" );
};
// Backward compatibility
int wxScrollBar::GetValue(void) const
{
return GetPosition();
};
void wxScrollBar::SetValue( const int viewStart )
{
SetPosition( viewStart );
};
void wxScrollBar::GetValues( int *viewStart, int *viewLength, int *objectLength, int *pageLength ) const
{
int pos = (int)(m_adjust->value+0.5);
int thumb = (int)(m_adjust->page_size+0.5);
int page = (int)(m_adjust->page_increment+0.5);
int range = (int)(m_adjust->upper+0.5);
*viewStart = pos;
*viewLength = range;
*objectLength = thumb;
*pageLength = page;
};
int wxScrollBar::GetViewLength() const
{
return (int)(m_adjust->upper+0.5);
};
int wxScrollBar::GetObjectLength() const
{
return (int)(m_adjust->page_size+0.5);
};
void wxScrollBar::SetPageSize( const int pageLength )
{
int pos = (int)(m_adjust->value+0.5);
int thumb = (int)(m_adjust->page_size+0.5);
int range = (int)(m_adjust->upper+0.5);
SetScrollbar( pos, thumb, range, pageLength );
};
void wxScrollBar::SetObjectLength( const int objectLength )
{
int pos = (int)(m_adjust->value+0.5);
int page = (int)(m_adjust->page_increment+0.5);
int range = (int)(m_adjust->upper+0.5);
SetScrollbar( pos, objectLength, range, page );
};
void wxScrollBar::SetViewLength( const int viewLength )
{
int pos = (int)(m_adjust->value+0.5);
int thumb = (int)(m_adjust->page_size+0.5);
int page = (int)(m_adjust->page_increment+0.5);
SetScrollbar( pos, thumb, viewLength, page );
};

183
src/gtk1/settings.cpp Normal file
View File

@@ -0,0 +1,183 @@
/////////////////////////////////////////////////////////////////////////////
// Name: settings.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 "settings.h"
#endif
#include "wx/settings.h"
/*
#define wxSYS_COLOUR_SCROLLBAR 0
#define wxSYS_COLOUR_BACKGROUND 1
#define wxSYS_COLOUR_ACTIVECAPTION 2
#define wxSYS_COLOUR_INACTIVECAPTION 3
#define wxSYS_COLOUR_MENU 4
#define wxSYS_COLOUR_WINDOW 5
#define wxSYS_COLOUR_WINDOWFRAME 6
#define wxSYS_COLOUR_MENUTEXT 7
#define wxSYS_COLOUR_WINDOWTEXT 8
#define wxSYS_COLOUR_CAPTIONTEXT 9
#define wxSYS_COLOUR_ACTIVEBORDER 10
#define wxSYS_COLOUR_INACTIVEBORDER 11
#define wxSYS_COLOUR_APPWORKSPACE 12
#define wxSYS_COLOUR_HIGHLIGHT 13
#define wxSYS_COLOUR_HIGHLIGHTTEXT 14
#define wxSYS_COLOUR_BTNFACE 15
#define wxSYS_COLOUR_BTNSHADOW 16
#define wxSYS_COLOUR_GRAYTEXT 17
#define wxSYS_COLOUR_BTNTEXT 18
#define wxSYS_COLOUR_INACTIVECAPTIONTEXT 19
#define wxSYS_COLOUR_BTNHIGHLIGHT 20
#define wxSYS_COLOUR_3DDKSHADOW 21
#define wxSYS_COLOUR_3DLIGHT 22
#define wxSYS_COLOUR_INFOTEXT 23
#define wxSYS_COLOUR_INFOBK 24
#define wxSYS_COLOUR_DESKTOP wxSYS_COLOUR_BACKGROUND
#define wxSYS_COLOUR_3DFACE wxSYS_COLOUR_BTNFACE
#define wxSYS_COLOUR_3DSHADOW wxSYS_COLOUR_BTNSHADOW
#define wxSYS_COLOUR_3DHIGHLIGHT wxSYS_COLOUR_BTNHIGHLIGHT
#define wxSYS_COLOUR_3DHILIGHT wxSYS_COLOUR_BTNHIGHLIGHT
#define wxSYS_COLOUR_BTNHILIGHT wxSYS_COLOUR_BTNHIGHLIGHT
*/
#define SHIFT (8*(sizeof(short int)-sizeof(char)))
wxColour *g_systemBtnFaceColour = NULL;
wxColour *g_systemBtnShadowColour = NULL;
wxColour *g_systemBtnHighlightColour = NULL;
wxColour *g_systemHighlightColour = NULL;
wxColour wxSystemSettings::GetSystemColour( int index )
{
switch (index)
{
case wxSYS_COLOUR_SCROLLBAR:
case wxSYS_COLOUR_BACKGROUND:
case wxSYS_COLOUR_ACTIVECAPTION:
case wxSYS_COLOUR_INACTIVECAPTION:
case wxSYS_COLOUR_MENU:
case wxSYS_COLOUR_WINDOW:
case wxSYS_COLOUR_WINDOWFRAME:
case wxSYS_COLOUR_ACTIVEBORDER:
case wxSYS_COLOUR_INACTIVEBORDER:
case wxSYS_COLOUR_BTNFACE:
{
GtkStyle *style = gtk_widget_get_default_style();
if (!g_systemBtnFaceColour)
{
g_systemBtnFaceColour =
new wxColour( style->bg[0].red >> SHIFT,
style->bg[0].green >> SHIFT,
style->bg[0].blue >> SHIFT );
};
return *g_systemBtnFaceColour;
};
case wxSYS_COLOUR_BTNSHADOW:
{
GtkStyle *style = gtk_widget_get_default_style();
if (!g_systemBtnShadowColour)
{
g_systemBtnShadowColour =
new wxColour( style->dark[0].red >> SHIFT,
style->dark[0].green >> SHIFT,
style->dark[0].blue >> SHIFT );
};
return *g_systemBtnShadowColour;
};
case wxSYS_COLOUR_GRAYTEXT:
case wxSYS_COLOUR_BTNHIGHLIGHT:
{
GtkStyle *style = gtk_widget_get_default_style();
if (!g_systemBtnHighlightColour)
{
g_systemBtnHighlightColour =
new wxColour( style->light[0].red >> SHIFT,
style->light[0].green >> SHIFT,
style->light[0].blue >> SHIFT );
};
return *g_systemBtnHighlightColour;
};
case wxSYS_COLOUR_HIGHLIGHT:
{
GtkStyle *style = gtk_widget_get_default_style();
if (!g_systemHighlightColour)
{
g_systemHighlightColour =
new wxColour( style->bg[GTK_STATE_SELECTED].red >> SHIFT,
style->bg[GTK_STATE_SELECTED].green >> SHIFT,
style->bg[GTK_STATE_SELECTED].blue >> SHIFT );
};
return *g_systemHighlightColour;
};
case wxSYS_COLOUR_MENUTEXT:
case wxSYS_COLOUR_WINDOWTEXT:
case wxSYS_COLOUR_CAPTIONTEXT:
case wxSYS_COLOUR_INACTIVECAPTIONTEXT:
case wxSYS_COLOUR_INFOTEXT:
{
return *wxBLACK;
};
case wxSYS_COLOUR_HIGHLIGHTTEXT:
{
return *wxWHITE;
};
case wxSYS_COLOUR_INFOBK:
case wxSYS_COLOUR_APPWORKSPACE:
{
return *wxWHITE; // ?
};
};
return *wxWHITE;
};
wxFont *g_systemFont = NULL;
wxFont wxSystemSettings::GetSystemFont( int index )
{
switch (index)
{
case wxSYS_OEM_FIXED_FONT:
case wxSYS_ANSI_FIXED_FONT:
case wxSYS_SYSTEM_FIXED_FONT:
{
return *wxNORMAL_FONT;
};
case wxSYS_ANSI_VAR_FONT:
case wxSYS_SYSTEM_FONT:
case wxSYS_DEVICE_DEFAULT_FONT:
case wxSYS_DEFAULT_GUI_FONT:
{
if (!g_systemFont)
g_systemFont = new wxFont( "-adobe-helvetica-medium-r-normal--*-120-*-*-*-*-*-*" );
return *g_systemFont;
};
};
return wxNullFont;
}
;
int wxSystemSettings::GetSystemMetric( int index )
{
switch (index)
{
case wxSYS_SCREEN_X:
return gdk_screen_width();
case wxSYS_SCREEN_Y:
return gdk_screen_height();
};
return 0;
}
;

View File

@@ -0,0 +1,98 @@
#! /bin/sh
OS=$OSTYPE
if test "x$OS" = x; then
echo "please set the environment variable OSTYPE "
echo "to a value appropriate for your system."
echo "to do so type: setenv OSTYPE `uname` for the csh, tcsh"
echo " export OSTYPE=`uname` for other shells"
exit 1
fi
TMP_CONT=`ls src`
SRC_DIR=src
for each in $TMP_CONT; do
if test -d src/$each ; then
SRC_DIR="$SRC_DIR src/$each"
fi
done
TMP_CONT=`ls samples`
SAMPLES_DIR=
for each in $TMP_CONT; do
if test -d samples/$each ; then
SAMPLES_DIR="$SAMPLES_DIR samples/$each"
fi
done
TMP_CONT=`ls utils`
UTILS_DIR=
for each in $TMP_CONT; do
if test -d utils/$each ; then
UTILS_DIR="$UTILS_DIR utils/$each"
fi
done
TMP_CONT=`ls user`
USER_DIR=
for each in $TMP_CONT; do
if test -d user/$each ; then
USER_DIR="$USER_DIR user/$each"
fi
done
ALL_DIR="$SRC_DIR $SAMPLES_DIR $UTILS_DIR $USER_DIR"
echo Creating for: $OS
# create defaults
if test ! -d src/gtk/setup/$OS; then
mkdir src/gtk/setup/$OS
fi
SUBSTFILE=src/gtk/setup/$OS/substit
# the substit file first
if test -f src/gtk/setup/substit ; then
cat src/gtk/setup/substit | sed "s/*/@/g" > $SUBSTFILE;
rm -f src/gtk/setup/substit
fi
# now the template file
cat src/gtk/setup/maketmpl.in | sed -f $SUBSTFILE > src/gtk/setup/$OS/maketmpl
# now the config header file
#if test -f setup/wx_setup.h ; then
# cat setup/wx_setup.h > setup/$OS/wx_setup.h;
# rm -f setup/wx_setup.h
#fi
# create lib and bin directory
if test ! -d lib; then
mkdir lib
fi
if test ! -d lib/$OS; then
mkdir lib/$OS
fi
if test ! -d bin; then
mkdir bin
fi
if test ! -d bin/$OS; then
mkdir bin/$OS
fi
# create makefiles
for each in $ALL_DIR; do
DIR=$each/$OS
# create Makefile in directory
if test -r $each/Makefile.in ; then
# create directory
if test ! -d $DIR; then
echo "Creating Directory: $DIR..."
mkdir $DIR
fi
echo "Creating: $DIR/Makefile..."
cat $each/Makefile.in | sed -f $SUBSTFILE > $DIR/Makefile
(cd $DIR; make subdirs > /dev/null;)
fi
done

67
src/gtk1/setup/general/jointar Executable file
View File

@@ -0,0 +1,67 @@
#! /bin/sh
#
# Written by Martin Sperl
# (sperl@dsn.ast.univie.ac.at)
#
if test $# -lt 3 ; then
cat <<EOF
Usage: `basename $0` <basedir> <SOURCE-FILES> <DESTINATION-FILS>
copies all files from the source-tar-files to the common
destination-tar-file with basedir as a common base directory.
EOF
exit 0
fi
BaseDir="$1"
shift
Sourcefiles="$1"
while test "$#" != 2 ; do
shift
Sourcefiles="$Sourcefiles $1"
done
shift
Final=$1
Destination=/tmp/join$$.tar
touch $Destination
curdir=`pwd`
mkdir tmp$$
mkdir tmp$$/$BaseDir
#uncompress all files
cd tmp$$/$BaseDir
for each in $Sourcefiles ; do
( \
if test `basename $each gz` != `basename $each` ; then \
gzip -dc ../../$each;\
else \
cat ../../$each;\
fi; \
) | tar xf -
done
cd ..
#now tar everything
tar -cf $Destination *
cd ..
rm -fr tmp$$
# goto old directory
cd $curdir
if test `basename $Final gz` != `basename $Final` ; then
gzip -c $Destination > $Final
else
cat $Destination > $Final
fi
rm -f $Destination

View File

@@ -0,0 +1,73 @@
SHELL=/bin/sh
OS=$(OSTYPE)
all::
-@if test "x$(OS)" = x; then \
echo "please set the environment variable OSTYPE ";\
echo "to a value appropriate for your system.";\
echo "to do so type: setenv OSTYPE `uname` for the csh, tcsh";\
echo " export OSTYPE=`uname` for other shells";\
else \
if test -f Makefile.in ; then \
if test -f $(OS)/Makefile ; then \
NEEDED=`(cd $(OS); ${MAKE} checkneeds;) | grep "needed to compile" `;\
if test "x$$NEEDED" = x; then \
(cd $(OS); ${MAKE} $@); \
else \
(cd $(OS); ${MAKE} checkneeds); \
fi ; \
else \
echo "Did you configure your system?";\
fi; \
fi; \
fi;
distrib::
@if test ! -d ../../distrib ; then mkdir ../../distrib; fi;
@if test ! -f ../../system.list ; then \
echo "dummy" > ../../system.list;\
fi
@(curr=`pwd`; direc=`basename $$curr`;\
basedir=`dirname $$curr`;\
basedirname=`basename $$basedir`;\
if test ! -d ../../distrib/$$basedirname ; then \
mkdir ../../distrib/$$basedirname;\
fi;\
if test -d doc; then (cd doc; make clean;); fi;\
(cd ..; \
echo creating $$direc.tar from the current directory;\
files="`\
find $$direc -type f \
| fgrep -vf ../system.list \
| grep -v "~" \
| grep -v "#" \
` $(DISTRIBUTE_ADDITIONAL)";\
tar -cf /tmp/$$direc.tar $$files;\
echo compressing $$direc.tar to $$direc.tgz;\
gzip -c /tmp/$$direc.tar > ../distrib/$$basedirname/$$direc.tgz;\
rm /tmp/$$direc.tar;\
)\
)
.DEFAULT:
-@if test "x$(OS)" = x; then \
echo "please set the environment variable OSTYPE ";\
echo "to a value appropriate for your system.";\
echo "to do so type: setenv OSTYPE `uname` for the csh, tcsh";\
echo " export OSTYPE=`uname` for other shells";\
else \
if test -f Makefile.in ; then \
if test -f $(OS)/Makefile ; then \
NEEDED=`(cd $(OS); ${MAKE} checkneeds) | grep "needed to compile" `;\
if test "x$$NEEDED" = x; then \
(cd $(OS); ${MAKE} $@); \
else \
(cd $(OS); ${MAKE} checkneeds); \
fi ; \
else \
echo "Did you configure your system?";\
fi \
fi \
fi

View File

@@ -0,0 +1,19 @@
SHELL=/bin/sh
DIRS=`find . -print | sed "s|\./||g" | grep -v "/" | grep -v "\." `
all:
@for i in $(DIRS) xxx; do \
if test -r $$i/Makefile ; then \
echo "entering directory $$i building $@";\
(cd $$i ; ${MAKE} $@); \
fi; \
done
.DEFAULT:
@for i in $(DIRS) xxx; do \
if test -r $$i/Makefile ; then \
echo "entering directory $$i building $@";\
(cd $$i ; ${MAKE} $@); \
fi; \
done

View File

@@ -0,0 +1,102 @@
SHELL=/bin/sh
FILE_BASE=$(TEX_BASE:.tex=)
BMP_FILES=$(XPM_FILES:.xpm=.bmp)
EPS_FILES=$(XPM_FILES:.xpm=.eps)
GIF_FILES=$(XPM_FILES:.xpm=.gif)
HTML_BUTTONS=back.gif forward.gif contents.gif up.gif
all:: doc
clean::
@ for each in $(DIRS) . ; do \
( cd $$each; \
rm -f *.bmp *.eps *.gif *.aux *.dvi *.log \
*.ps *.toc *~ *.idx *.hlp *.html \
*.rtf *.ref *.xlp *.con *.win *.fts \
*.hpj *.HLP; \
); done
doc:: doc_ps doc_html doc_xlp doc_winhelp doc_rtf
#############################################
doc_ps:: $(FILE_BASE).ps
$(FILE_BASE).ps: $(FILE_BASE).dvi
dvips $(FILE_BASE).dvi -o$@
#############################################
doc_dvi:: $(FILE_BASE).dvi
$(FILE_BASE).dvi: $(FILE_BASE).tex $(TEX_ADDITIONAL) $(EPS_FILES)
latex $(FILE_BASE).tex
latex $(FILE_BASE).tex
#############################################
doc_xlp:: $(FILE_BASE).xlp
$(FILE_BASE).xlp: $(FILE_BASE).tex $(TEX_ADDITIONAL)
../../../bin/$(OSTYPE)/tex2rtf $(FILE_BASE).tex $(FILE_BASE).xlp -twice -xlp
#############################################
doc_html:: $(FILE_BASE)_contents.html $(FILE_BASE).html
$(FILE_BASE).html:
@ln -s $(FILE_BASE)_contents.html $@
$(FILE_BASE)_contents.html: $(FILE_BASE).tex $(TEX_ADDITIONAL) $(GIF_FILES) $(HTML_BUTTONS)
../../../bin/$(OSTYPE)/tex2rtf $(FILE_BASE).tex $(FILE_BASE) -twice -html
#############################################
doc_rtf:: $(FILE_BASE).rtf
$(FILE_BASE).rtf: $(FILE_BASE).tex $(TEX_ADDITIONAL) $(BMP_FILES)
../../../bin/$(OSTYPE)/tex2rtf $(FILE_BASE).tex $(FILE_BASE).rtf -twice -rtf
#############################################
doc_winhelp:: $(FILE_BASE).win
$(FILE_BASE).win: $(FILE_BASE).tex $(TEX_ADDITIONAL) $(BMP_FILES)
../../../bin/$(OSTYPE)/tex2rtf $(FILE_BASE).tex $(FILE_BASE).win -twice -winhelp
@echo final conversion still needs to be done by MSWin
#############################################
subst::
@if test "x$(OLD)" = x; then \
echo "OLD not defined!"; exit -1; \
fi
@if test "x$(NEW)" = x; then \
echo "NEW not defined!"; exit -1; \
fi
@for each in $(TEX_BASE) $(TEX_ADITIONAL) ; do \
cat $$each | sed "s/$(OLD)/$(NEW)/g" > /tmp/subst; \
rm $$each; cp /tmp/subst $$each; rm /tmp/subst; \
done
#############################################
.SUFFIXES:
.SUFFIXES: .eps .xpm
.SUFFIXES: .bmp .xpm
.SUFFIXES: .gif .xpm
.xpm.eps :
@$(RM) -f $@
xpmtoppm $< | ppmtogif | giftopnm | pnmtops -rle -center -noturn -scale 0.5 - > $@
.xpm.bmp :
@$(RM) -f $@
xpmtoppm $< | ppmtobmp -windows - > $@
.xpm.gif :
@$(RM) -f $@
xpmtoppm $< | ppmtogif -interlace - > $@

3
src/gtk1/setup/general/mygrep Executable file
View File

@@ -0,0 +1,3 @@
#! /bin/sh
grep $@
exit 0

10
src/gtk1/setup/general/needed Executable file
View File

@@ -0,0 +1,10 @@
#! /bin/sh
for each in $@ ; do
LINE=`grep " $each " ../$OSTYPE/wx_setup.h | grep "#define" | grep 1`
if test "x$LINE" = x ; then
echo "$each needed to compile";
exit 1;
fi
done

View File

@@ -0,0 +1,123 @@
# Makefile for Autoconf.
# Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
#### Start of system configuration section. ####
GLOBAL_LIB_DIR = $(WXBASEDIR)/lib/$(OS)
GLOBAL_BIN_DIR = $(WXBASEDIR)/bin/$(OS)
# define toolkit to use
TOOLKIT_DEF = -D__GTK__
# general compiler stuff
OPTIMISE = -O2
PROFILE =
DEBUG =
# c-compiler stuff
CC = gcc
CFLAGS = -Wall $(OPTIMISE) $(PROFILE) $(DEBUG)
CPP = gcc -E
# c++-compiler stuff
CXX = c++
CXXFLAGS = -Wall $(OPTIMISE) $(PROFILE) $(DEBUG)
CXXCPP = c++ -E
# shared compile stuff
PICFLAGS = -fPIC
CREATE_SHARED = sharedLinux
# other stuff
RM = rm -f
LEX = flex
LEXLIB = -lfl
YACC = bison -y
RANLIB = ranlib
INSTALL = /usr/bin/install -c
INSTALL_PROGRAM = ${INSTALL}
INSTALL_DATA = ${INSTALL} -m 644
AWK = mawk
LN_S = ln -s
CJPEG_PROG =
CONVERT_PATH = /usr/bin/X11
CONVERT_PROG = /usr/bin/X11/convert
DJPEG_PROG =
GIFTOPNM_PROG =
NETPBM_PATH =
prefix = /usr/local
exec_prefix = ${prefix}
# Directory in which to install scripts.
#bindir = ${exec_prefix}/bin
# Directory in which to install library files.
datadir = ${prefix}/share
acdatadir = $(datadir)/autoconf
# Directory in which to install documentation info files.
infodir = ${prefix}/info
X_CFLAGS = -I/usr/X11R6/include
X_LIBS = -L/usr/X11R6/lib
X_EXTRA_LIBS =
X_PRE_LIBS = -lSM -lICE
GUI_TK_INCLUDE = -I/usr/local/lib/glib/include -I/usr/local/include -I/usr/X11R6/include
GUI_TK_LIBRARY = -L/usr/local/lib -L/usr/X11R6/lib -lgtk -lgdk -lglib -lXext -lX11 -lm
GUI_TK_LINK =
OPENGL_INCLUDE =
OPENGL_LIBRARY =
OPENGL_LINK =
THREADS_LINK =
# INCLUDES
WX_INCLUDES = \
$(TOOLKIT_DEF) \
-I. \
-I.. \
-I$(WXBASEDIR)/include \
-I$(WXBASEDIR)/src/png \
-I$(WXBASEDIR)/src/zlib \
-I$(WXBASEDIR)/src/gdk_imlib \
$(GUI_TK_INCLUDE) \
$(OPENGL_INCLUDE) \
$(X_CFLAGS)
WX_LIBS = -L$(GLOBAL_LIB_DIR) -lwx_gtk
OPENGL_LIBS = $(OPENGL_LIBRARY) $(OPENGL_LINK)
GUI_TK_LIBS = $(GUI_TK_LIBRARY) $(GUI_TK_LINK)
LINK = $(CXX) -o $@
LINK_LIBS= \
$(WX_LIBS) \
$(GUI_TK_LIBS) \
$(X_EXTRA_LIBS) \
$(X_PRE_LIBS)
# $(X_LIBS) -lX11 -lXext -lm gtk-config does this for me
# Don't include $(OPENGL_LIBS) or $(THREADS_LINK) in LINK_LIBS; they
# can be conveniently added to BIN_LINK in Makefile.in.
#### End of system configuration section. ####

View File

@@ -0,0 +1,70 @@
s|@OS@|linux|g
s|@WXBASEDIR@|/home/karl/cvs/wxGTK|g
s|@PROFILE@||g
s|@DEBUG@||g
s|@OPTIMISE@|-O2 |g
s|@CC@|gcc|g
s|@CFLAGS@| -Wall|g
s|@CPP@|gcc -E|g
s|@CXX@|c++|g
s|@CXXFLAGS@| -Wall|g
s|@CXXCPP@|c++ -E|g
s|@PICFLAGS@|-fPIC|g
s|@CREATE_SHARED@|sharedLinux|g
s|@LEX@|flex|g
s|@LEXLIB@|-lfl|g
s|@YACC@|bison -y|g
s|@RANLIB@|ranlib|g
s|@INSTALL@|/usr/bin/install -c|g
s|@INSTALL_PROGRAM@|${INSTALL}|g
s|@INSTALL_DATA@|${INSTALL} -m 644|g
s|@AWK@|mawk|g
s|@LN_S@|ln -s|g
s|@prefix@|/usr/local|g
s|@exec_prefix@|${prefix}|g
s|@bindir@|${exec_prefix}/bin|g
s|@datadir@|${prefix}/share|g
s|@infodir@|${prefix}/info|g
s|@X_CFLAGS@| -I/usr/X11R6/include|g
s|@X_LIBS@| -L/usr/X11R6/lib|g
s|@X_EXTRA_LIBS@||g
s|@X_PRE_LIBS@| -lSM -lICE|g
s|@GUI_TK_INCLUDE@|-I/usr/local/lib/glib/include -I/usr/local/include -I/usr/X11R6/include|g
s|@GUI_TK_LIBRARY@|-L/usr/local/lib -L/usr/X11R6/lib -lgtk -lgdk -lglib -lXext -lX11 -lm|g
s|@GUI_TK_LINK@||g
s|@OPENGL_INCLUDE@||g
s|@OPENGL_LIBRARY@||g
s|@OPENGL_LINK@||g
s|@TOOLKIT@|GTK|g
s|@TOOLKIT_DEF@|__GTK__|g
s|@THREADS@|NONE|g
s|@THREADS_LINK@||g
s|@WXSTRING@|@WXSTRING@|g
s|@TYPETREE@|NONE|g
s|@METAFILE@|NONE|g
s|@POSTSCRIPTDC@|POSTSCRIPTDC|g
s|@WXGRAPH@|NONE|g
s|@WXTREE@|NONE|g
s|@DOCVIEW@|DOCVIEW|g
s|@FORM@|NONE|g
s|@PRINTPREVIEW@|PRINTPREVIEW|g
s|@IPC@|IPC|g
s|@HELP@|NONE|g
s|@CLIPBOARD@|NONE|g
s|@TIMEDATE@|TIMEDATE|g
s|@FRACTION@|FRACTION|g
s|@PROLOGIO@|NONE|g
s|@PROLOGIOSRC@|NONE|g
s|@ENHDIALOGBOX@|NONE|g
s|@GAUGE@|GAUGE|g
s|@GLCANVAS@|NONE|g
s|@LAYOUT@|@LAYOUT@|g
s|@WXRESOURCES@|WXRESOURCES|g
s|@XRESOURCES@|XRESOURCES|g
s|@SCROLLBAR@|SCROLLBAR|g
s|@STATICITEMS@|@STATICITEMS@|g
s|@TOOLBAR@|TOOLBAR|g
s|@CONSTRAINTS@|CONSTRAINTS|g
s|@RPC@|NONE|g
s|@VIRLISTBOX@|NONE|g

123
src/gtk1/setup/maketmpl.in Normal file
View File

@@ -0,0 +1,123 @@
# Makefile for Autoconf.
# Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
#### Start of system configuration section. ####
GLOBAL_LIB_DIR = $(WXBASEDIR)/lib/$(OS)
GLOBAL_BIN_DIR = $(WXBASEDIR)/bin/$(OS)
# define toolkit to use
TOOLKIT_DEF = -D@TOOLKIT_DEF@
# general compiler stuff
OPTIMISE = @OPTIMISE@
PROFILE = @PROFILE@
DEBUG = @DEBUG@
# c-compiler stuff
CC = @CC@
CFLAGS = @CFLAGS@ $(OPTIMISE) $(PROFILE) $(DEBUG)
CPP = @CPP@
# c++-compiler stuff
CXX = @CXX@
CXXFLAGS = @CXXFLAGS@ $(OPTIMISE) $(PROFILE) $(DEBUG)
CXXCPP = @CXXCPP@
# shared compile stuff
PICFLAGS = @PICFLAGS@
CREATE_SHARED = @CREATE_SHARED@
# other stuff
RM = rm -f
LEX = @LEX@
LEXLIB = @LEXLIB@
YACC = @YACC@
RANLIB = @RANLIB@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
AWK = @AWK@
LN_S = @LN_S@
CJPEG_PROG =
CONVERT_PATH = /usr/bin/X11
CONVERT_PROG = /usr/bin/X11/convert
DJPEG_PROG =
GIFTOPNM_PROG =
NETPBM_PATH =
prefix = @prefix@
exec_prefix = @exec_prefix@
# Directory in which to install scripts.
#bindir = @bindir@
# Directory in which to install library files.
datadir = @datadir@
acdatadir = $(datadir)/autoconf
# Directory in which to install documentation info files.
infodir = @infodir@
X_CFLAGS = @X_CFLAGS@
X_LIBS = @X_LIBS@
X_EXTRA_LIBS = @X_EXTRA_LIBS@
X_PRE_LIBS = @X_PRE_LIBS@
GUI_TK_INCLUDE = @GUI_TK_INCLUDE@
GUI_TK_LIBRARY = @GUI_TK_LIBRARY@
GUI_TK_LINK = @GUI_TK_LINK@
OPENGL_INCLUDE = @OPENGL_INCLUDE@
OPENGL_LIBRARY = @OPENGL_LIBRARY@
OPENGL_LINK = @OPENGL_LINK@
THREADS_LINK = @THREADS_LINK@
# INCLUDES
WX_INCLUDES = \
$(TOOLKIT_DEF) \
-I. \
-I.. \
-I$(WXBASEDIR)/include \
-I$(WXBASEDIR)/src/png \
-I$(WXBASEDIR)/src/zlib \
-I$(WXBASEDIR)/src/gdk_imlib \
$(GUI_TK_INCLUDE) \
$(OPENGL_INCLUDE) \
$(X_CFLAGS)
WX_LIBS = -L$(GLOBAL_LIB_DIR) -lwx_gtk
OPENGL_LIBS = $(OPENGL_LIBRARY) $(OPENGL_LINK)
GUI_TK_LIBS = $(GUI_TK_LIBRARY) $(GUI_TK_LINK)
LINK = $(CXX) -o $@
LINK_LIBS= \
$(WX_LIBS) \
$(GUI_TK_LIBS) \
$(X_EXTRA_LIBS) \
$(X_PRE_LIBS)
# $(X_LIBS) -lX11 -lXext -lm gtk-config does this for me
# Don't include $(OPENGL_LIBS) or $(THREADS_LINK) in LINK_LIBS; they
# can be conveniently added to BIN_LINK in Makefile.in.
#### End of system configuration section. ####

13
src/gtk1/setup/rules/bin Normal file
View File

@@ -0,0 +1,13 @@
# all that is to do
all:: checkneeds binary
clean:: clean_binary clean_obj
# now include definite rules
BIN_BASE_DIR=.
# include rules to create library
include $(RULES_GENERIC)/bin1
# include rules to create objects
include $(RULES_GENERIC)/obj
# include rule to check for defines needed
include $(RULES_GENERIC)/needed

14
src/gtk1/setup/rules/bin2 Normal file
View File

@@ -0,0 +1,14 @@
# all that is to do
all:: checkneeds binary
clean:: clean_binary clean_obj
# now include definite rules
BIN_BASE_DIR=.
# include rules to create library
include $(RULES_GENERIC)/bin2
# include rules to create objects
include $(RULES_GENERIC)/obj
# include rule to check for defines needed
include $(RULES_GENERIC)/needed

90
src/gtk1/setup/rules/doc Normal file
View File

@@ -0,0 +1,90 @@
SHELL=/bin/sh
FILE_BASE=$(TEX_BASE:.tex=)
BMP_FILES=$(XPM_FILES:.xpm=.bmp)
EPS_FILES=$(XPM_FILES:.xpm=.eps)
GIF_FILES=$(XPM_FILES:.xpm=.gif)
TEX2RTF=$(WXBASEDIR)/bin/$(OSTYPE)/tex2rtf
HTML_BUTTONS=back.gif forward.gif contents.gif up.gif
all:: doc
clean::
@ for each in $(DIRS) . ; do \
( cd $$each; \
rm -f *.bmp *.eps *.gif *.aux *.dvi *.log \
*.ps *.toc *~ *.idx *.hlp *.html \
*.rtf *.ref *.xlp *.con *.win *.fts \
*.hpj *.HLP; \
); done
doc:: doc_ps doc_html doc_xlp doc_winhelp doc_rtf
#############################################
doc_ps:: $(FILE_BASE).ps
$(FILE_BASE).ps: $(FILE_BASE).dvi
dvips $(FILE_BASE).dvi -o$@
#############################################
doc_dvi:: $(FILE_BASE).dvi
$(FILE_BASE).dvi: $(FILE_BASE).tex $(TEX_ADDITIONAL) $(EPS_FILES)
latex $(FILE_BASE).tex
latex $(FILE_BASE).tex
#############################################
doc_xlp:: $(FILE_BASE).xlp
$(FILE_BASE).xlp: $(FILE_BASE).tex $(TEX_ADDITIONAL)
$(TEX2RTF) $(FILE_BASE).tex $(FILE_BASE).xlp -twice -xlp
#############################################
doc_html:: $(FILE_BASE)_contents.html $(FILE_BASE).html
$(FILE_BASE).html:
@ln -s $(FILE_BASE)_contents.html $@
$(FILE_BASE)_contents.html: $(FILE_BASE).tex $(TEX_ADDITIONAL) $(GIF_FILES) $(HTML_BUTTONS)
$(TEX2RTF) $(FILE_BASE).tex $(FILE_BASE) -twice -html
#############################################
doc_rtf:: $(FILE_BASE).rtf
$(FILE_BASE).rtf: $(FILE_BASE).tex $(TEX_ADDITIONAL) $(BMP_FILES)
$(TEX2RTF) $(FILE_BASE).tex $(FILE_BASE).rtf -twice -rtf
#############################################
doc_winhelp:: $(FILE_BASE).win
$(FILE_BASE).win: $(FILE_BASE).tex $(TEX_ADDITIONAL) $(BMP_FILES)
../../../bin/$(OSTYPE)/tex2rtf $(FILE_BASE).tex $(FILE_BASE).win -twice -winhelp
@echo final conversion still needs to be done by MSWin
#############################################
.SUFFIXES:
.SUFFIXES: .eps .xpm
.SUFFIXES: .bmp .xpm
.SUFFIXES: .gif .xpm
.xpm.eps :
@$(RM) -f $@
xpmtoppm $< | ppmtogif | giftopnm | pnmtops -rle -center -noturn -scale 0.5 - > $@
.xpm.bmp :
@$(RM) -f $@
xpmtoppm $< | ppmtobmp -windows - > $@
.xpm.gif :
@$(RM) -f $@
xpmtoppm $< | ppmtogif -interlace - > $@

14
src/gtk1/setup/rules/gbin Normal file
View File

@@ -0,0 +1,14 @@
# all that is to do
all:: checkneeds binary
clean:: clean_binary clean_obj
# now include definite rules
BIN_BASE_DIR=$(GLOBAL_BIN_DIR)
# include rules to create library
include $(RULES_GENERIC)/bin1
# include rules to create objects
include $(RULES_GENERIC)/obj
# include rule to check for defines needed
include $(RULES_GENERIC)/needed

View File

@@ -0,0 +1,14 @@
# all that is to do
all:: checkneeds binary
clean:: clean_binary clean_obj
# now include definite rules
BIN_BASE_DIR=$(GLOBAL_BIN_DIR)
# include rules to create library
include $(RULES_GENERIC)/bin2
# include rules to create objects
include $(RULES_GENERIC)/mkobj
# include rule to check for defines needed
include $(RULES_GENERIC)/needed

View File

@@ -0,0 +1,8 @@
binary:: binary1
depend_binary:: depend_binary1
clean_binary:: clean_binary1
include $(RULES_GENERIC)/bin1gen

View File

@@ -0,0 +1,16 @@
# create binary
binary1:: $(BIN_BASE_DIR)/$(BIN_TARGET)
$(BIN_BASE_DIR)/$(BIN_TARGET): $(BIN_OBJ)
@$(RM) -f $@
$(LINK) $(BIN_OBJ) -L. $(BIN_LINK) $(LINK_LIBS)
# defining dependencies
depend_binary1::
# cleaning all files
clean_binary1::
@$(RM) -f $(BIN_BASE_DIR)/$(BIN_TARGET)

View File

@@ -0,0 +1,9 @@
binary:: binary1 binary2
depend_binary:: depend_binary1 depend_binary2
clean_binary:: clean_binary1 clean_binary2
include $(RULES_GENERIC)/bin1gen
include $(RULES_GENERIC)/bin2gen

View File

@@ -0,0 +1,16 @@
# create binary
binary2:: $(BIN_BASE_DIR)/$(BIN2_TARGET)
$(BIN_BASE_DIR)/$(BIN2_TARGET): $(BIN2_OBJ)
@$(RM) -f $@
$(LINK) $(BIN2_OBJ) -L. $(BIN2_LINK) $(LINK_LIBS)
# defining dependencies
depend_binary2::
# cleaning all files
clean_binary2::
@$(RM) -f $(BIN_BASE_DIR)/$(BIN2_TARGET)

View File

@@ -0,0 +1,18 @@
depend::
@echo "$(CXX) -MM \
$(WX_INCLUDES) \
$(ADD_COMPILE) \
$(LIB_SRC) $(BIN_SRC) $(BIN2_SRC)"
@(cd .. ;\
$(CXX) -MM \
$(WX_INCLUDES) \
$(ADD_COMPILE) \
$(LIB_SRC) $(BIN_SRC) $(BIN2_SRC)\
) > .depend
@cp Makefile Makefile.bak
@cat Makefile.bak | awk 'BEGIN { found=0;} { if ( $$0 == "# DO NOT DELETE") {found=1} ; { if ( found==0 ) { print $$0; } } }' > Makefile1
@echo "# DO NOT DELETE" >> Makefile1
@cat .depend >> Makefile1
@mv Makefile1 Makefile
@rm .depend

View File

@@ -0,0 +1,15 @@
# creates subdirectories for object-files in case they are needed...
subdirs::
@if test "x$(SRC_DIR)" != x ; then \
echo -n "Creating necessary subdirs: "; \
for each in $(SRC_DIR) xxx; do \
if test "x$$each" != xxxx; then \
echo -n "$$each "; \
if test ! -d $$each ; then \
mkdir $$each ; \
fi; \
fi; \
done; \
echo "";\
fi

View File

@@ -0,0 +1,17 @@
# create library
library:: $(LIB_BASE_DIR)/lib$(LIB_TARGET).a
$(LIB_BASE_DIR)/lib$(LIB_TARGET).a: $(LIB_OBJ)
@$(RM) -f $@
$(AR) rv $@ $(LIB_OBJ)
# defining dependencies
depend_library::
# cleaning all files
clean_library::
@$(RM) -f $(LIB_BASE_DIR)/lib$(LIB_TARGET).a

View File

@@ -0,0 +1,24 @@
#SHELL=/bin/sh
MYGREP=$(WXBASEDIR)/setup/general/mygrep
checkneeds::
@if test "x$(NEEDED_DEFINES)" != x ; then \
RESULT=0 ; \
for each in $(NEEDED_DEFINES) xxx; do \
if test "$$each" != xxx ; then \
LINE=`cat $(SETUP_DIR)/wx_setup.h \
| sed "s/ /,/g" \
| $(MYGREP) ",$$each," \
| $(MYGREP) "#define" \
| $(MYGREP) "1" ` ; \
if test "x$$LINE" = x ; then \
(TMPVAR=`pwd`;\
TMPVAR=`dirname $$TMPVAR`;\
echo "$$each needed to compile "`basename $$TMPVAR`"...";\
);\
RESULT=1 ; \
fi; \
fi; \
done ;\
exit $$RESULT; \
fi

View File

@@ -0,0 +1,30 @@
.SUFFIXES:
.SUFFIXES: .o .c
.SUFFIXES: .o .cc
.SUFFIXES: .o .cpp
VPATH= ..
.c.o :
@$(RM) -f $@
$(CC) -c -o $@ $(CFLAGS) -I.. $(WX_INCLUDES) $(ADD_COMPILE) $(WX_DEFINES) $<
.cc.o :
@$(RM) -f $@
$(CXX) -c -o $@ $(CXXFLAGS) -I.. $(WX_INCLUDES) $(ADD_COMPILE) $(WX_DEFINES) $<
.cpp.o :
@$(RM) -f $@
$(CXX) -c -o $@ $(CXXFLAGS) -I.. $(WX_INCLUDES) $(ADD_COMPILE) $(WX_DEFINES) $<
clean_obj::
@$(RM) *.o *.osh
@if test "x$(SRC_DIR)" != x ; then \
for each in $(SRC_DIR) xxx; do \
if test -d $$each ; then \
$(RM) $$each/*.o $$each/*.osh ; \
fi; \
done; \
fi;
include $(RULES_GENERIC)/depend

View File

@@ -0,0 +1,21 @@
# create library
library:: $(LIB_BASE_DIR)/lib$(LIB_TARGET).a
$(LIB_BASE_DIR)/lib$(LIB_TARGET).a: $(LIB_OBJ)
@$(RM) -f $@ $(LIB_BASE_DIR)/lib$(LIB_TARGET).so $(LIB_BASE_DIR)/lib$(LIB_TARGET).so.*
@if test "x$(CREATE_SHARED)" != x; then\
echo "$(SHARE_DIR)/$(CREATE_SHARED) $(CC) $(LIB_BASE_DIR)/lib$(LIB_TARGET).so $(LIB_MAJOR) $(LIB_MINOR) $(LIB_OBJ)"; \
$(SHARE_DIR)/$(CREATE_SHARED) $(CC) $(LIB_BASE_DIR)/lib$(LIB_TARGET).so $(LIB_MAJOR) $(LIB_MINOR) $(LIB_OBJ); \
fi
$(AR) rv $@ $(LIB_OBJ)
# defining dependencies
depend_library::
# cleaning all files
clean_library::
@$(RM) -f $(LIB_BASE_DIR)/lib$(LIB_TARGET).a $(LIB_BASE_DIR)/lib$(LIB_TARGET).so.* $(LIB_BASE_DIR)/lib$(LIB_TARGET).so

View File

@@ -0,0 +1,42 @@
.SUFFIXES:
.SUFFIXES: .o .c
.SUFFIXES: .o .cc
.SUFFIXES: .o .cpp
VPATH= ..
.c.o :
@$(RM) -f $@ $@sh
@if test "x$(PICFLAGS)" != x; then \
echo "$(CC) -c -o $@sh $(PICFLAGS) $(CFLAGS) -I.. $(WX_INCLUDES) $(ADD_COMPILE) $(WX_DEFINES) $<";\
$(CC) -c -o $@sh $(PICFLAGS) $(CFLAGS) -I.. $(WX_INCLUDES) $(ADD_COMPILE) $(WX_DEFINES) $<;\
fi
$(CC) -c -o $@ $(CFLAGS) -I.. $(WX_INCLUDES) $(ADD_COMPILE) $(WX_DEFINES) $<
.cc.o :
@$(RM) -f $@ $@sh
@if test "x$(PICFLAGS)" != x; then \
echo "$(CXX) -c -o $@sh $(PICFLAGS) $(CXXFLAGS) -I.. $(WX_INCLUDES) $(ADD_COMPILE) $(WX_DEFINES) $<";\
$(CXX) -c -o $@sh $(PICFLAGS) $(CXXFLAGS) -I.. $(WX_INCLUDES) $(ADD_COMPILE) $(WX_DEFINES) $<;\
fi
$(CXX) -c -o $@ $(CXXFLAGS) -I.. $(WX_INCLUDES) $(ADD_COMPILE) $(WX_DEFINES) $<
.cpp.o :
@$(RM) -f $@ $@sh
@if test "x$(PICFLAGS)" != x; then \
echo "$(CXX) -c -o $@sh $(PICFLAGS) $(CXXFLAGS) -I.. $(WX_INCLUDES) $(ADD_COMPILE) $(WX_DEFINES) $<";\
$(CXX) -c -o $@sh $(PICFLAGS) $(CXXFLAGS) -I.. $(WX_INCLUDES) $(ADD_COMPILE) $(WX_DEFINES) $<;\
fi
$(CXX) -c -o $@ $(CXXFLAGS) -I.. $(WX_INCLUDES) $(ADD_COMPILE) $(WX_DEFINES) $<
clean_obj::
@$(RM) *.o *.osh
@if test "x$(SRC_DIR)" != x ; then \
for each in $(SRC_DIR) xxx; do \
if test -d $$each ; then \
$(RM) $$each/*.o $$each/*.osh ; \
fi; \
done; \
fi;
include $(RULES_GENERIC)/depend

15
src/gtk1/setup/rules/glib Normal file
View File

@@ -0,0 +1,15 @@
# all that is to do
all:: checkneeds library
clean:: clean_library clean_obj
# now include definite rules
LIB_BASE_DIR=$(GLOBAL_LIB_DIR)
# include rules to create library
include $(RULES_GENERIC)/lib
# include rules to create objects
include $(RULES_GENERIC)/obj
# include rule to check for defines needed
include $(RULES_GENERIC)/needed

View File

@@ -0,0 +1,17 @@
# all that is to do
all:: checkneeds library binary
clean:: clean_library clean_obj clean_binary
# now include definite rules
LIB_BASE_DIR=$(GLOBAL_LIB_DIR)
BIN_BASE_DIR=.
# include rules to create library
include $(RULES_GENERIC)/lib
# include rules to create binary
include $(RULES_GENERIC)/bin1
# include rules to create objects
include $(RULES_GENERIC)/obj
# include rule to check for defines needed
include $(RULES_GENERIC)/needed

View File

@@ -0,0 +1,18 @@
# all that is to do
all:: checkneeds library binary
depend:: depend_library depend_binary
clean:: clean_library clean_obj clean_binary
# now include definite rules
LIB_BASE_DIR=$(GLOBAL_LIB_DIR)
BIN_BASE_DIR=$(GLOBAL_BIN_DIR)
# include rules to create library
include $(RULES_GENERIC)/lib
# include rules to create binary
include $(RULES_GENERIC)/mkbin1
# include rules to create objects
include $(RULES_GENERIC)/obj
# include rule to check for defines needed
include $(RULES_GENERIC)/needed

View File

@@ -0,0 +1,15 @@
# all that is to do
all:: checkneeds library
clean:: clean_library clean_obj
# now include definite rules
LIB_BASE_DIR=$(GLOBAL_LIB_DIR)
# include rules to create shared library
include $(RULES_GENERIC)/slib
# include rules to create shared objects
include $(RULES_GENERIC)/sobj
# include rule to check for defines needed
include $(RULES_GENERIC)/needed

14
src/gtk1/setup/rules/lib Normal file
View File

@@ -0,0 +1,14 @@
# all that is to do
all:: checkneeds library
clean:: clean_library clean_obj
# now include definite rules
LIB_BASE_DIR=.
# include rules to create library
include $(RULES_GENERIC)/lib
# include rules to create objects
include $(RULES_GENERIC)/obj
# include rule to check for defines needed
include $(RULES_GENERIC)/needed

View File

@@ -0,0 +1,17 @@
# all that is to do
all:: checkneeds library binary
clean:: clean_library clean_obj clean_binary
# now include definite rules
LIB_BASE_DIR=.
BIN_BASE_DIR=.
# include rules to create library
include $(RULES_GENERIC)/lib
# include rules to create binary
include $(RULES_GENERIC)/bin1
# include rules to create objects
include $(RULES_GENERIC)/obj
# include rule to check for defines needed
include $(RULES_GENERIC)/needed

View File

@@ -0,0 +1,17 @@
# all that is to do
all:: checkneeds library binary
clean:: clean_library clean_obj clean_binary
# now include definite rules
LIB_BASE_DIR=.
BIN_BASE_DIR=$(GLOBAL_BIN_DIR)
# include rules to create library
include $(RULES_GENERIC)/lib
# include rules to create binary
include $(RULES_GENERIC)/mkbin1
# include rules to create objects
include $(RULES_GENERIC)/obj
# include rule to check for defines needed
include $(RULES_GENERIC)/needed

533
src/gtk1/setup/setup.hin Normal file
View File

@@ -0,0 +1,533 @@
/* wx_setup.h
This file is in the public domain.
Descriptive text for the C preprocessor macros that
the distributed Autoconf macros can define.
No software package will use all of them; autoheader copies the ones
your configure.in uses into your configuration header file templates.
The entries are in sort -df order: alphabetical, case insensitive,
ignoring punctuation (such as underscores). Although this order
can split up related entries, it makes it easier to check whether
a given entry is in the file.
Leave the following blank line there!! Autoheader needs it. */
#ifndef __GTKSETUPH__
#define __GTKSETUPH__
#ifdef __GNUG__
#pragma interface
#endif
/* define the system to compile */
#undef __GTK__
#undef __UNIX__
#undef __LINUX__
#undef __SGI__
#undef __HPUX__
#undef __SYSV__
#undef __SVR4__
#undef __AIX__
#undef __SUN__
#undef __SOLARIS__
#undef __SUNOS__
#undef __ALPHA__
#undef __OSF__
#undef __BSD__
#undef __FREEBSD__
#undef __VMS__
#undef __ULTRIX__
#undef __DATA_GENERAL__
/*
* Use zlib
*/
#undef USE_ZLIB
/*
* Use gdk_imlib
*/
#undef USE_GDK_IMLIB
/*
* Use libpng
*/
#undef USE_LIBPNG
/*
* Use Threads
*/
#undef USE_THREADS
#undef USE_THREADS_POSIX
#undef USE_THREADS_SGI
/*
* Use storable classes
*/
#undef USE_STORABLE_CLASSES
/*
* Use automatic translation via gettext() in wxTString
*/
#undef USE_AUTOTRANS
/*
* Use font metric files in GetTextExtent for wxPostScriptDC
* Use consistent PostScript fonts for AFM and printing (!)
*/
#undef USE_AFM_FOR_POSTSCRIPT
#undef WX_NORMALIZED_PS_FONTS
/*
* Use clipboard
*/
#undef USE_CLIPBOARD
/*
* Use wxWindows layout constraint system
*/
#undef USE_CONSTRAINTS
/*
* Use the document/view architecture
*/
#undef USE_DOC_VIEW_ARCHITECTURE
/*
* Use enhanced dialog
*/
#undef USE_ENHANCED_DIALOG
/*
* Use Form panel item placement
*/
#undef USE_FORM
/*
* Use fraction class
*/
#undef USE_FRACTION
/*
* Use gauge item
*/
#undef USE_GAUGE
/*
* Implement a GLCanvas class as an interface to OpenGL, using the GLX
* extension to the X11 protocol. You can use the (free) Mesa library
* if you don't have a 'real' OpenGL.
*/
#undef USE_GLX
/*
* Use wxWindows help facility (needs USE_IPC 1)
*/
#undef USE_HELP
/*
* Use iostream.h rather than iostream
*/
#undef USE_IOSTREAMH
/*
* Use Interprocess communication
*/
#undef USE_IPC
/*
* Use Metafile and Metafile device context
*/
#undef USE_METAFILE
/*
* Use PostScript device context
*/
#undef USE_POSTSCRIPT
/*
* Use the print/preview architecture
*/
#undef USE_PRINTING_ARCHITECTURE
/*
* Use Prolog IO
*/
#undef USE_PROLOGIO
/*
* Use Remote Procedure Call (Needs USE_IPC and USE_PROLOGIO)
*/
#undef USE_RPC
/*
* Use wxGetResource & wxWriteResource (change .Xdefaults)
*/
#undef USE_RESOURCES
/*
* Use scrollbar item
*/
#undef USE_SCROLLBAR
/*
* Use time and date classes
*/
#undef USE_TIMEDATE
/*
* Use toolbar, use Xt port toolbar (3D look)
*/
#undef USE_TOOLBAR
#undef USE_XT_TOOLBAR
/*
* Enables old type checking mechanism (wxSubType)
*/
#undef USE_TYPETREE
/*
* Use virtual list box item
*/
#undef USE_VLBOX
/*
* Use wxWindows resource loading (.wxr-files) (Needs USE_PROLOGIO 1)
*/
#undef USE_WX_RESOURCES
/*
* Use wxGraph
*/
#undef USE_WXGRAPH
/*
* Use wxTree
*/
/********************** DO NOT CHANGE BELOW THIS POINT **********************/
/**************************** DEBUGGING FEATURES ****************************/
/* Compatibility with 1.66 API.
Level 0: no backward compatibility, all new features
Level 1: wxDC, OnSize (etc.) compatibility, but
some new features such as event tables */
#define WXWIN_COMPATIBILITY 1
/*
* Enables debugging: memory tracing, assert, etc.
*/
#undef DEBUG
/*
* Enables debugging version of wxObject::new and wxObject::delete (IF DEBUG)
* WARNING: this code may not work with all architectures, especially
* if alignment is an issue.
*/
#undef USE_MEMORY_TRACING
/*
* Enable debugging version of global memory operators new and delete
* Disable it, If this causes problems (e.g. link errors)
*/
#undef USE_GLOBAL_MEMORY_OPERATORS
/*
* If WXDEBUG && USE_MEMORY_TRACING && USE_GLOBAL_MEMORY_OPERATORS
* used to debug the memory allocation of wxWindows Xt port code
*/
#define USE_INTERNAL_MEMORY_TRACING 0
/*
* Matthews garbage collection (used for MrEd?)
*/
#define WXGARBAGE_COLLECTION_ON 0
/**************************** COMPILER FEATURES *****************************/
/*
* Disable this if your compiler can't cope
* with omission of prototype parameters.
*/
#define REMOVE_UNUSED_ARG 1
/*
* The const keyword is being introduced more in wxWindows.
* You can use this setting to maintain backward compatibility.
* If 0: will use const wherever possible.
* If 1: will use const only where necessary
* for precompiled headers to work.
* If 2: will be totally backward compatible, but precompiled
* headers may not work and program size will be larger.
*/
#define CONST_COMPATIBILITY 0
/************************ WINDOWS 3.1 COMPATIBILITY *************************/
/*
* Normalize X drawing code to behave exactly as MSW.
*/
#define WX_STANDARD_GRAPHICS 0
/******************* other stuff **********************************/
/*
* Support image loading for wxBitmap (wxImage is needed for this)
*/
#define USE_IMAGE_LOADING 0
#define WXIMAGE_INCLUDE "../../utils/image/src/wx_image.h"
/*
* Use splines
*/
#define USE_SPLINES 1
/*
* USE_DYNAMIC_CLASSES is TRUE for the Xt port
*/
#define USE_DYNAMIC_CLASSES 1
/*
* USE_EXTENDED_STATICS is FALSE for the Xt port
*/
#define USE_EXTENDED_STATICS 0
/*************************** IMAKEFILE EVALUATIOS ***************************/
#if USE_XPM
#define USE_XPM_IN_X 1
#else
#define USE_XPM_IN_X 0
#endif
#if USE_IMAGE_LOADING
#define USE_IMAGE_LOADING_IN_X 1
#else
#define USE_IMAGE_LOADING_IN_X 0
#endif
/* here comes the system-specific stuff */
/* acconfig.h
This file is in the public domain.
Descriptive text for the C preprocessor macros that
the distributed Autoconf macros can define.
No software package will use all of them; autoheader copies the ones
your configure.in uses into your configuration header file templates.
The entries are in sort -df order: alphabetical, case insensitive,
ignoring punctuation (such as underscores). Although this order
can split up related entries, it makes it easier to check whether
a given entry is in the file. */
/* Define if on AIX 3.
System headers sometimes define this.
We just want to avoid a redefinition error message. */
#ifndef _ALL_SOURCE
#undef _ALL_SOURCE
#endif
/* Define if using alloca.c. */
#undef C_ALLOCA
/* Define if type char is unsigned and you are not using gcc. */
#ifndef __CHAR_UNSIGNED__
#undef __CHAR_UNSIGNED__
#endif
/* Define if the closedir function returns void instead of int. */
#undef CLOSEDIR_VOID
/* Define to empty if the keyword does not work. */
#undef const
/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
This function is required for alloca.c support on those systems. */
#undef CRAY_STACKSEG_END
/* Define for DGUX with <sys/dg_sys_info.h>. */
#undef DGUX
/* Define if you have <dirent.h>. */
#undef DIRENT
/* Define to the type of elements in the array set by `getgroups'.
Usually this is either `int' or `gid_t'. */
#undef GETGROUPS_T
/* Define if the `getloadavg' function needs to be run setuid or setgid. */
#undef GETLOADAVG_PRIVILEGED
/* Define if the `getpgrp' function takes no argument. */
#undef GETPGRP_VOID
/* Define to `int' if <sys/types.h> doesn't define. */
#undef gid_t
/* Define if you have alloca, as a function or macro. */
#undef HAVE_ALLOCA
/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
#undef HAVE_ALLOCA_H
/* Define if you don't have vprintf but do have _doprnt. */
#undef HAVE_DOPRNT
/* Define if your system has its own `getloadavg' function. */
#undef HAVE_GETLOADAVG
/* Define if you have the getmntent function. */
#undef HAVE_GETMNTENT
/* Define if the `long double' type works. */
#undef HAVE_LONG_DOUBLE
/* Define if you support file names longer than 14 characters. */
#undef HAVE_LONG_FILE_NAMES
/* Define if you have a working `mmap' system call. */
#undef HAVE_MMAP
/* Define if system calls automatically restart after interruption
by a signal. */
#undef HAVE_RESTARTABLE_SYSCALLS
/* Define if your struct stat has st_blksize. */
#undef HAVE_ST_BLKSIZE
/* Define if your struct stat has st_blocks. */
#undef HAVE_ST_BLOCKS
/* Define if you have the strcoll function and it is properly defined. */
#undef HAVE_STRCOLL
/* Define if your struct stat has st_rdev. */
#undef HAVE_ST_RDEV
/* Define if you have the strftime function. */
#undef HAVE_STRFTIME
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
#undef HAVE_SYS_WAIT_H
/* Define if your struct tm has tm_zone. */
#undef HAVE_TM_ZONE
/* Define if you don't have tm_zone but do have the external array
tzname. */
#undef HAVE_TZNAME
/* Define if you have <unistd.h>. */
#undef HAVE_UNISTD_H
/* Define if utime(file, NULL) sets file's timestamp to the present. */
#undef HAVE_UTIME_NULL
/* Define if you have <vfork.h>. */
#undef HAVE_VFORK_H
/* Define if you have the vprintf function. */
#undef HAVE_VPRINTF
/* Define if you have the wait3 system call. */
#undef HAVE_WAIT3
/* Define as __inline if that's what the C compiler calls it. */
#ifndef __cplusplus
#undef inline
#endif
/* Define if major, minor, and makedev are declared in <mkdev.h>. */
#undef MAJOR_IN_MKDEV
/* Define if major, minor, and makedev are declared in <sysmacros.h>. */
#undef MAJOR_IN_SYSMACROS
/* Define if on MINIX. */
#undef _MINIX
/* Define to `int' if <sys/types.h> doesn't define. */
#undef mode_t
/* Define if you don't have <dirent.h>, but have <ndir.h>. */
#undef NDIR
/* Define if you have <memory.h>, and <string.h> doesn't declare the
mem* functions. */
#undef NEED_MEMORY_H
/* Define if your struct nlist has an n_un member. */
#undef NLIST_NAME_UNION
/* Define if you have <nlist.h>. */
#undef NLIST_STRUCT
/* Define if your C compiler doesn't accept -c and -o together. */
#undef NO_MINUS_C_MINUS_O
/* Define to `long' if <sys/types.h> doesn't define. */
#undef off_t
/* Define to `int' if <sys/types.h> doesn't define. */
#undef pid_t
/* Define if the system does not provide POSIX.1 features except
with this defined. */
#undef _POSIX_1_SOURCE
/* Define if you need to in order for stat and other things to work. */
#undef _POSIX_SOURCE
/* Define as the return type of signal handlers (int or void). */
#undef RETSIGTYPE
/* Define if the setvbuf function takes the buffering type as its second
argument and the buffer pointer as the third, as on System V
before release 3. */
#undef SETVBUF_REVERSED
/* Define SIZESOF for some Objects */
#undef SIZEOF_INT
#undef SIZEOF_INT_P
#undef SIZEOF_LONG
/* Define to `unsigned' if <sys/types.h> doesn't define. */
#undef size_t
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at run-time.
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown
*/
#undef STACK_DIRECTION
/* Define if the `S_IS*' macros in <sys/stat.h> do not work properly. */
#undef STAT_MACROS_BROKEN
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define on System V Release 4. */
#undef SVR4
/* Define on BSD */
#undef BSD
/* Define on System V */
#undef SYSV
/* Define if you don't have <dirent.h>, but have <sys/dir.h>. */
#undef SYSDIR
/* Define if you don't have <dirent.h>, but have <sys/ndir.h>. */
#undef SYSNDIR
/* Define if `sys_siglist' is declared by <signal.h>. */
#undef SYS_SIGLIST_DECLARED
/* Define if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME
/* Define if your <sys/time.h> declares struct tm. */
#undef TM_IN_SYS_TIME
/* Define to `int' if <sys/types.h> doesn't define. */
#undef uid_t
/* Define for Encore UMAX. */
#undef UMAX
/* Define for Encore UMAX 4.3 that has <inq_status/cpustats.h>
instead of <sys/cpustats.h>. */
#undef UMAX4_3
/* Define if you do not have <strings.h>, index, bzero, etc.. */
#undef USG
/* Define if the system is System V Release 4 */
#undef SVR4
/* Define vfork as fork if vfork does not work. */
#undef vfork
/* Define if the closedir function returns void instead of int. */
#undef VOID_CLOSEDIR
/* Define if your processor stores words with the most significant
byte first (like Motorola and SPARC, unlike Intel and VAX). */
#undef WORDS_BIGENDIAN
/* Define if lex declares yytext as a char * by default, not a char[]. */
#undef YYTEXT_POINTER
#endif /* __GTKSETUPH__ */
/* Leave that blank line there!! Autoheader needs it.
If you're adding to this file, keep in mind:
The entries are in sort -df order: alphabetical, case insensitive,
ignoring punctuation (such as underscores). */

26
src/gtk1/setup/shared/sharedAIX Executable file
View File

@@ -0,0 +1,26 @@
#! /bin/sh
COMPILER=$1
LIBRARY_BASE=$2
LIBRARY_MAJOR=$3
LIBRARY_MINOR=$4
shift 3
LIBRARY_OBJS=
while (test $# -ne 1) do
shift;
LIBRARY_OBJS="$LIBRARY_OBJS $1sh";
done
LIBRARY_BASE=`echo $LIBRARY_BASE | sed 's/.so/.sa/'`
LIBRARY_NAME=`basename $LIBRARY_BASE`
LIBRARY_FILE=$LIBRARY_BASE
echo "Creating shared library: $LIBRARY_FILE"
ar cr $LIBRARY_FILE~ $LIBRARY_OBJS
nm $LIBRARY_OBJS | awk '/ [BD] /{print $$3}' | sort | uniq > ${LIBRARY_FILE}.syms
ld -o shr.o $LIBRARY_FILE~ -lX11 -lXt -lc -lm -H512 -T512 -bE:${LIBRARY_FILE}.syms -bM:SRE
rm -f $LIBRARY_FILE~
ar ruv $LIBRARY_FILE shr.o
chmod a+x $LIBRARY_FILE

33
src/gtk1/setup/shared/sharedBsd Executable file
View File

@@ -0,0 +1,33 @@
#! /bin/sh
#LIBRARY_BASE=`echo $1 | sed 's/.a/.so/'`
COMPILER=$1
LIBRARY_BASE=$2
LIBRARY_MAJOR=$3
LIBRARY_MINOR=$4
shift 3
LIBRARY_OBJS=
while (test $# -ne 1) do
shift;
LIBRARY_OBJS="$LIBRARY_OBJS $1sh";
done
LIBRARY_NAME=`basename $LIBRARY_BASE`
LIBRARY_FILE=$LIBRARY_BASE.$LIBRARY_MAJOR.$LIBRARY_MINOR
echo "Creating shared library: $LIBRARY_FILE"
if test "x$COMPILER" = xgcc ; then
gcc -shared -o $LIBRARY_FILE $LIBRARY_OBJS
else
CC -Bshareable -Bforcearchive -o $LIBRARY_FILE $LIBRARY_OBJS
fi
chmod a+x $LIBRARY_FILE
rm -f $LIBRARY_BASE.$LIBRARY_MAJOR
ln -s $LIBRARY_NAME.$LIBRARY_MAJOR.$LIBRARY_MINOR $LIBRARY_BASE.$LIBRARY_MAJOR
rm -f $LIBRARY_BASE
ln -s $LIBRARY_NAME.$LIBRARY_MAJOR $LIBRARY_BASE

View File

@@ -0,0 +1,29 @@
#! /bin/sh
COMPILER=$1
LIBRARY_BASE=$2
LIBRARY_MAJOR=$3
LIBRARY_MINOR=$4
shift 3
LIBRARY_OBJS=
while (test $# -ne 1) do
shift;
LIBRARY_OBJS="$LIBRARY_OBJS $1sh";
done
LIBRARY_BASE=`echo $LIBRARY_BASE | sed 's/.so/.sl/'`
LIBRARY_NAME=`basename $LIBRARY_BASE`
LIBRARY_FILE=$LIBRARY_BASE
echo "Creating shared library: $LIBRARY_FILE"
if test "x$COMPILER" = xgcc ; then
gcc -shared -h $LIBRARY_NAME -o $LIBRARY_FILE $LIBRARY_OBJS
else
CC -G -h $LIBRARY_NAME -o $LIBRARY_FILE $LIBRARY_OBJS
fi
chmod a+x $LIBRARY_FILE

View File

@@ -0,0 +1,29 @@
#! /bin/sh
COMPILER=$1
LIBRARY_BASE=$2
LIBRARY_MAJOR=$3
LIBRARY_MINOR=$4
shift 3
LIBRARY_OBJS=
while (test $# -ne 1) do
shift;
LIBRARY_OBJS="$LIBRARY_OBJS $1sh";
done
LIBRARY_BASE=`echo $LIBRARY_BASE | sed 's/.so/.sl/'`
LIBRARY_NAME=`basename $LIBRARY_BASE`
LIBRARY_FILE=$LIBRARY_BASE
echo "Creating shared library: $LIBRARY_FILE"
if test "x$COMPILER" = xgcc ; then
gcc -shared -o $LIBRARY_FILE $LIBRARY_OBJS
else
CC -Wl,+s -o $LIBRARY_FILE $LIBRARY_OBJS
fi
chmod a+x $LIBRARY_FILE

View File

@@ -0,0 +1,45 @@
#! /bin/sh
# on Irix, position independent code is the default
#LIBRARY_BASE=`echo $1 | sed 's/.a/.so/'`
COMPILER=$1
LIBRARY_BASE=$2
LIBRARY_MAJOR=$3
LIBRARY_MINOR=$4
shift 3
LIBRARY_OBJS=
while (test $# -ne 1) do
shift;
LIBRARY_OBJS="$LIBRARY_OBJS $1";
done
LIBRARY_NAME=`basename $LIBRARY_BASE`
LIBRARY_FILE=$LIBRARY_BASE.$LIBRARY_MAJOR.$LIBRARY_MINOR
echo "Creating shared library: $LIBRARY_FILE"
if test ! -f /tmp/so_locations; then
if test -f /usr/lib/so_locations; then
cp /usr/lib/so_locations /tmp
else
touch /tmp/so_locations
fi
fi
chmod u+w /tmp/so_locations
if test "x$COMPILER" = xgcc ; then
gcc -shared -Wl,-update_registry,/tmp/so_locations \
-Wl,-soname,$LIBRARY_NAME.$LIBRARY_MAJOR -o $LIBRARY_FILE $LIBRARY_OBJS
else
CC -shared -update_registry /tmp/so_locations \
-soname $LIBRARY_NAME.$LIBRARY_MAJOR -o $LIBRARY_FILE $LIBRARY_OBJS
fi
chmod a+x $LIBRARY_FILE
rm -f $LIBRARY_BASE.$LIBRARY_MAJOR
ln -s $LIBRARY_NAME.$LIBRARY_MAJOR.$LIBRARY_MINOR $LIBRARY_BASE.$LIBRARY_MAJOR
rm -f $LIBRARY_BASE
ln -s $LIBRARY_NAME.$LIBRARY_MAJOR $LIBRARY_BASE

View File

@@ -0,0 +1,34 @@
#! /bin/sh
#LIBRARY_BASE=`echo $1 | sed 's/.a/.so/'`
COMPILER=$1
LIBRARY_BASE=$2
LIBRARY_MAJOR=$3
LIBRARY_MINOR=$4
shift 3
LIBRARY_OBJS=
while (test $# -ne 1) do
shift;
LIBRARY_OBJS="$LIBRARY_OBJS $1sh";
done
LIBRARY_NAME=`basename $LIBRARY_BASE`
LIBRARY_FILE=$LIBRARY_BASE.$LIBRARY_MAJOR.$LIBRARY_MINOR
echo "Creating shared library: $LIBRARY_FILE"
case $COMPILER in gcc*|*gcc)
$COMPILER -shared -Wl,-soname,$LIBRARY_NAME.$LIBRARY_MAJOR -o $LIBRARY_FILE $LIBRARY_OBJS
;;
*)
$COMPILER -shared -soname $LIBRARY_NAME.$LIBRARY_MAJOR -o $LIBRARY_FILE $LIBRARY_OBJS
esac
chmod a+x $LIBRARY_FILE
rm -f $LIBRARY_BASE.$LIBRARY_MAJOR
ln -s $LIBRARY_NAME.$LIBRARY_MAJOR.$LIBRARY_MINOR $LIBRARY_BASE.$LIBRARY_MAJOR
rm -f $LIBRARY_BASE
ln -s $LIBRARY_NAME.$LIBRARY_MAJOR $LIBRARY_BASE

33
src/gtk1/setup/shared/sharedOSF Executable file
View File

@@ -0,0 +1,33 @@
#! /bin/sh
#LIBRARY_BASE=`echo $1 | sed 's/.a/.so/'`
COMPILER=$1
LIBRARY_BASE=$2
LIBRARY_MAJOR=$3
LIBRARY_MINOR=$4
shift 3
LIBRARY_OBJS=
while (test $# -ne 1) do
shift;
LIBRARY_OBJS="$LIBRARY_OBJS $1sh";
done
LIBRARY_NAME=`basename $LIBRARY_BASE`
LIBRARY_FILE=$LIBRARY_BASE.$LIBRARY_MAJOR.$LIBRARY_MINOR
echo "Creating shared library: $LIBRARY_FILE"
if test "x$COMPILER" = xgcc ; then
gcc -shared -Wl,-soname,$LIBRARY_NAME -o $LIBRARY_FILE $LIBRARY_OBJS
else
$COMPILER -shared -soname $LIBRARY_NAME -o $LIBRARY_FILE $LIBRARY_OBJS
fi
chmod a+x $LIBRARY_FILE
rm -f $LIBRARY_BASE.$LIBRARY_MAJOR
ln -s $LIBRARY_NAME.$LIBRARY_MAJOR.$LIBRARY_MINOR $LIBRARY_BASE.$LIBRARY_MAJOR
rm -f $LIBRARY_BASE
ln -s $LIBRARY_NAME.$LIBRARY_MAJOR $LIBRARY_BASE

View File

@@ -0,0 +1,33 @@
#! /bin/sh
#LIBRARY_BASE=`echo $1 | sed 's/.a/.so/'`
COMPILER=$1
LIBRARY_BASE=$2
LIBRARY_MAJOR=$3
LIBRARY_MINOR=$4
shift 3
LIBRARY_OBJS=
while (test $# -ne 1) do
shift;
LIBRARY_OBJS="$LIBRARY_OBJS $1sh";
done
LIBRARY_NAME=`basename $LIBRARY_BASE`
LIBRARY_FILE=$LIBRARY_BASE.$LIBRARY_MAJOR.$LIBRARY_MINOR
echo "Creating shared library: $LIBRARY_FILE"
if test "x$COMPILER" = xgcc ; then
gcc -shared -h $LIBRARY_NAME -o $LIBRARY_FILE $LIBRARY_OBJS
else
CC -G -h $LIBRARY_NAME -o $LIBRARY_FILE $LIBRARY_OBJS
fi
chmod a+x $LIBRARY_FILE
rm -f $LIBRARY_BASE.$LIBRARY_MAJOR
ln -s $LIBRARY_NAME.$LIBRARY_MAJOR.$LIBRARY_MINOR $LIBRARY_BASE.$LIBRARY_MAJOR
rm -f $LIBRARY_BASE
ln -s $LIBRARY_NAME.$LIBRARY_MAJOR $LIBRARY_BASE

View File

@@ -0,0 +1,33 @@
#! /bin/sh
#LIBRARY_BASE=`echo $1 | sed 's/.a/.so/'`
COMPILER=$1
LIBRARY_BASE=$2
LIBRARY_MAJOR=$3
LIBRARY_MINOR=$4
shift 3
LIBRARY_OBJS=
while (test $# -ne 1) do
shift;
LIBRARY_OBJS="$LIBRARY_OBJS $1sh";
done
LIBRARY_NAME=`basename $LIBRARY_BASE`
LIBRARY_FILE=$LIBRARY_BASE.$LIBRARY_MAJOR.$LIBRARY_MINOR
echo "Creating shared library: $LIBRARY_FILE"
if test "x$COMPILER" = xgcc ; then
gcc -shared -o $LIBRARY_FILE $LIBRARY_OBJS
else
CC -assert pure-text -o $LIBRARY_FILE $LIBRARY_OBJS
fi
chmod a+x $LIBRARY_FILE
rm -f $LIBRARY_BASE.$LIBRARY_MAJOR
ln -s $LIBRARY_NAME.$LIBRARY_MAJOR.$LIBRARY_MINOR $LIBRARY_BASE.$LIBRARY_MAJOR
rm -f $LIBRARY_BASE
ln -s $LIBRARY_NAME.$LIBRARY_MAJOR $LIBRARY_BASE

View File

@@ -0,0 +1,29 @@
#! /bin/sh
COMPILER=$1
LIBRARY_BASE=$2
LIBRARY_MAJOR=$3
LIBRARY_MINOR=$4
shift 3
LIBRARY_OBJS=
while (test $# -ne 1) do
shift;
LIBRARY_OBJS="$LIBRARY_OBJS $1sh";
done
LIBRARY_BASE=`echo $LIBRARY_BASE | sed 's/.so/.sl/'`
LIBRARY_NAME=`basename $LIBRARY_BASE`
LIBRARY_FILE=$LIBRARY_BASE
echo "Creating shared library: $LIBRARY_FILE"
if test "x$COMPILER" = xgcc ; then
gcc -shared -h $LIBRARY_NAME -o $LIBRARY_FILE $LIBRARY_OBJS
else
CC -G -h $LIBRARY_NAME -o $LIBRARY_FILE $LIBRARY_OBJS
fi
chmod a+x $LIBRARY_FILE

70
src/gtk1/setup/substit.in Normal file
View File

@@ -0,0 +1,70 @@
s|*OS*|@OS@|g
s|*WXBASEDIR*|@WXBASEDIR@|g
s|*PROFILE*|@PROFILE@|g
s|*DEBUG*|@DEBUG@|g
s|*OPTIMISE*|@OPTIMISE@|g
s|*CC*|@CC@|g
s|*CFLAGS*|@CFLAGS@|g
s|*CPP*|@CPP@|g
s|*CXX*|@CXX@|g
s|*CXXFLAGS*|@CXXFLAGS@|g
s|*CXXCPP*|@CXXCPP@|g
s|*PICFLAGS*|@PICFLAGS@|g
s|*CREATE_SHARED*|@CREATE_SHARED@|g
s|*LEX*|@LEX@|g
s|*LEXLIB*|@LEXLIB@|g
s|*YACC*|@YACC@|g
s|*RANLIB*|@RANLIB@|g
s|*INSTALL*|@INSTALL@|g
s|*INSTALL_PROGRAM*|@INSTALL_PROGRAM@|g
s|*INSTALL_DATA*|@INSTALL_DATA@|g
s|*AWK*|@AWK@|g
s|*LN_S*|@LN_S@|g
s|*prefix*|@prefix@|g
s|*exec_prefix*|@exec_prefix@|g
s|*bindir*|@bindir@|g
s|*datadir*|@datadir@|g
s|*infodir*|@infodir@|g
s|*X_CFLAGS*|@X_CFLAGS@|g
s|*X_LIBS*|@X_LIBS@|g
s|*X_EXTRA_LIBS*|@X_EXTRA_LIBS@|g
s|*X_PRE_LIBS*|@X_PRE_LIBS@|g
s|*GUI_TK_INCLUDE*|@GUI_TK_INCLUDE@|g
s|*GUI_TK_LIBRARY*|@GUI_TK_LIBRARY@|g
s|*GUI_TK_LINK*|@GUI_TK_LINK@|g
s|*OPENGL_INCLUDE*|@OPENGL_INCLUDE@|g
s|*OPENGL_LIBRARY*|@OPENGL_LIBRARY@|g
s|*OPENGL_LINK*|@OPENGL_LINK@|g
s|*TOOLKIT*|@TOOLKIT@|g
s|*TOOLKIT_DEF*|@TOOLKIT_DEF@|g
s|*THREADS*|@THREADS@|g
s|*THREADS_LINK*|@THREADS_LINK@|g
s|*WXSTRING*|@WXSTRING@|g
s|*TYPETREE*|@TYPETREE@|g
s|*METAFILE*|@METAFILE@|g
s|*POSTSCRIPTDC*|@POSTSCRIPTDC@|g
s|*WXGRAPH*|@WXGRAPH@|g
s|*WXTREE*|@WXTREE@|g
s|*DOCVIEW*|@DOCVIEW@|g
s|*FORM*|@FORM@|g
s|*PRINTPREVIEW*|@PRINTPREVIEW@|g
s|*IPC*|@IPC@|g
s|*HELP*|@HELP@|g
s|*CLIPBOARD*|@CLIPBOARD@|g
s|*TIMEDATE*|@TIMEDATE@|g
s|*FRACTION*|@FRACTION@|g
s|*PROLOGIO*|@PROLOGIO@|g
s|*PROLOGIOSRC*|@PROLOGIOSRC@|g
s|*ENHDIALOGBOX*|@ENHDIALOGBOX@|g
s|*GAUGE*|@GAUGE@|g
s|*GLCANVAS*|@GLCANVAS@|g
s|*LAYOUT*|@LAYOUT@|g
s|*WXRESOURCES*|@WXRESOURCES@|g
s|*XRESOURCES*|@XRESOURCES@|g
s|*SCROLLBAR*|@SCROLLBAR@|g
s|*STATICITEMS*|@STATICITEMS@|g
s|*TOOLBAR*|@TOOLBAR@|g
s|*CONSTRAINTS*|@CONSTRAINTS@|g
s|*RPC*|@RPC@|g
s|*VIRLISTBOX*|@VIRLISTBOX@|g

247
src/gtk1/slider.cpp Normal file
View File

@@ -0,0 +1,247 @@
/////////////////////////////////////////////////////////////////////////////
// Name: slider.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 "slider.h"
#endif
#include "wx/slider.h"
#include "wx/utils.h"
//-----------------------------------------------------------------------------
// wxSlider
//-----------------------------------------------------------------------------
void gtk_slider_callback( GtkWidget *WXUNUSED(widget), wxSlider *win )
{
/*
printf( "OnScroll from " );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
printf( win->GetClassInfo()->GetClassName() );
printf( ".\n" );
*/
if (!win->HasVMT()) return;
float diff = win->m_adjust->value - win->m_oldPos;
if (fabs(diff) < 0.2) return;
int command = 0;
float line_step = win->m_adjust->step_increment;
float page_step = win->m_adjust->page_increment;
if (fabs(diff-line_step) < 0.2) command = wxEVT_SCROLL_LINEDOWN;
else if (fabs(diff+line_step) < 0.2) command = wxEVT_SCROLL_LINEUP;
else if (fabs(diff-page_step) < 0.2) command = wxEVT_SCROLL_PAGEDOWN;
else if (fabs(diff+page_step) < 0.2) command = wxEVT_SCROLL_PAGEUP;
else command = wxEVT_SCROLL_THUMBTRACK;
int value = (int)(win->m_adjust->value+0.5);
int orient = wxHORIZONTAL;
if (win->GetWindowStyleFlag() & wxSB_VERTICAL == wxSB_VERTICAL) orient = wxHORIZONTAL;
wxScrollEvent event( command, win->GetId(), value, orient );
event.SetEventObject( win );
win->ProcessEvent( event );
wxCommandEvent cevent( wxEVT_COMMAND_SLIDER_UPDATED, win->GetId() );
cevent.SetEventObject( win );
win->ProcessEvent( cevent );
};
IMPLEMENT_DYNAMIC_CLASS(wxSlider,wxControl)
wxSlider::wxSlider(void)
{
};
wxSlider::wxSlider( wxWindow *parent, const wxWindowID id,
const int value, const int minValue, const int maxValue,
const wxPoint& pos, const wxSize& size,
const long style,
/* const wxValidator& validator = wxDefaultValidator, */
const wxString& name )
{
Create( parent, id, value, minValue, maxValue,
pos, size, style, name );
};
wxSlider::~wxSlider(void)
{
};
bool wxSlider::Create(wxWindow *parent, const wxWindowID id,
const int value, const int minValue, const int maxValue,
const wxPoint& pos, const wxSize& size,
const long style,
/* const wxValidator& validator = wxDefaultValidator, */
const wxString& name )
{
m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name );
m_oldPos = 0.0;
if (style & wxSL_VERTICAL == wxSL_VERTICAL)
m_widget = gtk_hscale_new( NULL );
else
m_widget = gtk_vscale_new( NULL );
m_adjust = gtk_range_get_adjustment( GTK_RANGE(m_widget) );
gtk_signal_connect (GTK_OBJECT (m_adjust), "value_changed",
(GtkSignalFunc) gtk_slider_callback, (gpointer) this );
SetRange( minValue, maxValue );
SetValue( value );
PostCreation();
Show( TRUE );
return TRUE;
};
int wxSlider::GetValue(void) const
{
return (int)(m_adjust->value+0.5);
};
void wxSlider::SetValue( const int value )
{
float fpos = (float)value;
m_oldPos = fpos;
if (fabs(fpos-m_adjust->value) < 0.2) return;
m_adjust->value = fpos;
gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "value_changed" );
};
void wxSlider::SetRange( const int minValue, const int maxValue )
{
float fmin = (float)minValue;
float fmax = (float)maxValue;
if ((fabs(fmin-m_adjust->lower) < 0.2) &&
(fabs(fmax-m_adjust->upper) < 0.2))
return;
m_adjust->lower = fmin;
m_adjust->upper = fmax;
gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" );
};
int wxSlider::GetMin(void) const
{
return (int)(m_adjust->lower+0.5);
};
int wxSlider::GetMax(void) const
{
return (int)(m_adjust->upper+0.5);
};
void wxSlider::SetPageSize( const int pageSize )
{
float fpage = (float)pageSize;
if (fabs(fpage-m_adjust->page_increment) < 0.2) return;
m_adjust->page_increment = fpage;
gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" );
};
int wxSlider::GetPageSize(void) const
{
return (int)(m_adjust->page_increment+0.5);
};
void wxSlider::SetThumbLength( const int len )
{
float flen = (float)len;
if (fabs(flen-m_adjust->page_size) < 0.2) return;
m_adjust->page_size = flen;
gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" );
};
int wxSlider::GetThumbLength(void) const
{
return (int)(m_adjust->page_size+0.5);
};
void wxSlider::SetLineSize( const int WXUNUSED(lineSize) )
{
};
int wxSlider::GetLineSize(void) const
{
return 0;
};
// not supported in wxGTK (and GTK)
void wxSlider::GetSize( int *x, int *y ) const
{
wxWindow::GetSize( x, y );
};
void wxSlider::SetSize( const int x, const int y, const int width, const int height, const int sizeFlags )
{
wxWindow::SetSize( x, y, width, height, sizeFlags );
};
void wxSlider::GetPosition( int *x, int *y ) const
{
wxWindow::GetPosition( x, y );
};
void wxSlider::SetTick( const int WXUNUSED(tickPos) )
{
};
void wxSlider::SetTickFreq( const int WXUNUSED(n), const int WXUNUSED(pos) )
{
};
int wxSlider::GetTickFreq(void) const
{
return 0;
};
void wxSlider::ClearTicks(void)
{
};
void wxSlider::SetSelection( const int WXUNUSED(minPos), const int WXUNUSED(maxPos) )
{
};
int wxSlider::GetSelEnd(void) const
{
return 0;
};
int wxSlider::GetSelStart(void) const
{
return 0;
};
void wxSlider::ClearSel(void)
{
};

49
src/gtk1/statbox.cpp Normal file
View File

@@ -0,0 +1,49 @@
/////////////////////////////////////////////////////////////////////////////
// Name: statbox.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 "statbox.h"
#endif
#include "wx/statbox.h"
//-----------------------------------------------------------------------------
// wxStaticBox
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxStaticBox,wxControl)
wxStaticBox::wxStaticBox(void)
{
};
wxStaticBox::wxStaticBox( wxWindow *parent, wxWindowID id, const wxString &label,
const wxPoint &pos, const wxSize &size,
const long style, const wxString &name )
{
Create( parent, id, label, pos, size, style, name );
};
bool wxStaticBox::Create( wxWindow *parent, wxWindowID id, const wxString &label,
const wxPoint &pos, const wxSize &size,
const long style, const wxString &name )
{
m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name );
m_widget = gtk_frame_new( label );
PostCreation();
Show( TRUE );
return TRUE;
};

69
src/gtk1/stattext.cpp Normal file
View File

@@ -0,0 +1,69 @@
/////////////////////////////////////////////////////////////////////////////
// Name: stattext.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 "stattext.h"
#endif
#include "wx/stattext.h"
//-----------------------------------------------------------------------------
// wxStaticText
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxStaticText,wxControl)
wxStaticText::wxStaticText(void)
{
};
wxStaticText::wxStaticText( wxWindow *parent, wxWindowID id, const wxString &label,
const wxPoint &pos, const wxSize &size,
const long style, const wxString &name )
{
Create( parent, id, label, pos, size, style, name );
};
bool wxStaticText::Create( wxWindow *parent, wxWindowID id, const wxString &label,
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_widget = gtk_label_new( label );
if (newSize.x == -1) newSize.x = gdk_string_measure( m_widget->style->font, label );
if (newSize.y == -1) newSize.y = 26;
SetSize( newSize.x, newSize.y );
PostCreation();
Show( TRUE );
return TRUE;
};
wxString wxStaticText::GetLabel(void) const
{
char *str = NULL;
gtk_label_get( GTK_LABEL(m_widget), &str );
wxString tmp( str );
return tmp;
};
void wxStaticText::SetLabel( const wxString &label )
{
gtk_label_set( GTK_LABEL(m_widget), label );
};

207
src/gtk1/tbargtk.cpp Normal file
View File

@@ -0,0 +1,207 @@
/////////////////////////////////////////////////////////////////////////////
// Name: tbargtk.cpp
// Purpose: GTK toolbar
// Author: Robert Roebling
// Modified by:
// Created: 01/02/97
// RCS-ID:
// Copyright: (c) Robert Roebling
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "tbargtk.h"
#endif
#include "wx/toolbar.h"
//-----------------------------------------------------------------------------
// wxToolBarTool
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxToolBarTool,wxObject)
wxToolBarTool::wxToolBarTool( wxToolBarGTK *owner, const int theIndex,
const wxBitmap& bitmap1, const wxBitmap& bitmap2,
const bool toggle, wxObject *clientData,
const wxString& shortHelpString, const wxString& longHelpString )
{
m_owner = owner;
m_index = theIndex;
m_bitmap1 = bitmap1;
m_bitmap2 = bitmap2;
m_isToggle = toggle;
m_enabled = TRUE;
m_toggleState = FALSE;
m_shortHelpString = shortHelpString;
m_longHelpString = longHelpString;
m_isMenuCommand = TRUE;
m_clientData = clientData;
m_deleteSecondBitmap = FALSE;
};
wxToolBarTool::~wxToolBarTool(void)
{
};
//-----------------------------------------------------------------------------
// wxToolBarGTK
//-----------------------------------------------------------------------------
static void gtk_toolbar_callback( GtkWidget *WXUNUSED(widget), wxToolBarTool *tool )
{
if (!tool->m_enabled) return;
if (tool->m_isToggle) tool->m_toggleState = !tool->m_toggleState;
tool->m_owner->OnLeftClick( tool->m_index, tool->m_toggleState );
};
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxToolBarGTK,wxControl)
BEGIN_EVENT_TABLE(wxToolBarGTK, wxControl)
END_EVENT_TABLE()
wxToolBarGTK::wxToolBarGTK(void)
{
};
wxToolBarGTK::wxToolBarGTK( wxWindow *parent, const wxWindowID id,
const wxPoint& pos, const wxSize& size,
const long style, const wxString& name )
{
Create( parent, id, pos, size, style, name );
};
wxToolBarGTK::~wxToolBarGTK(void)
{
};
bool wxToolBarGTK::Create( wxWindow *parent, const wxWindowID id,
const wxPoint& pos, const wxSize& size,
const long style, const wxString& name )
{
m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name );
m_tools.DeleteContents( TRUE );
m_widget = gtk_handle_box_new();
m_toolbar = GTK_TOOLBAR( gtk_toolbar_new( GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_ICONS ) );
gtk_container_add( GTK_CONTAINER(m_widget), GTK_WIDGET(m_toolbar) );
gtk_widget_show( GTK_WIDGET(m_toolbar) );
PostCreation();
Show( TRUE );
return TRUE;
};
bool wxToolBarGTK::OnLeftClick( int toolIndex, bool toggleDown )
{
wxCommandEvent event(wxEVT_COMMAND_TOOL_CLICKED, toolIndex);
event.SetEventObject(this);
event.SetExtraLong((long) toggleDown);
GetEventHandler()->ProcessEvent(event);
return TRUE;
};
void wxToolBarGTK::OnRightClick( int toolIndex, float WXUNUSED(x), float WXUNUSED(y) )
{
wxCommandEvent event(wxEVT_COMMAND_TOOL_RCLICKED, toolIndex);
event.SetEventObject(this);
GetEventHandler()->ProcessEvent(event);
};
void wxToolBarGTK::OnMouseEnter( int toolIndex )
{
wxCommandEvent event(wxEVT_COMMAND_TOOL_ENTER, toolIndex);
event.SetEventObject(this);
GetEventHandler()->ProcessEvent(event);
};
wxToolBarTool *wxToolBarGTK::AddTool( const int toolIndex, const wxBitmap& bitmap,
const wxBitmap& pushedBitmap, const bool toggle,
const float WXUNUSED(xPos), const float WXUNUSED(yPos), wxObject *clientData,
const wxString& helpString1, const wxString& helpString2 )
{
if (!bitmap.Ok()) return NULL;
wxToolBarTool *tool = new wxToolBarTool( this, toolIndex, bitmap, pushedBitmap, toggle,
clientData, helpString1, helpString2 );
GdkPixmap *pixmap = bitmap.GetPixmap();
GdkBitmap *mask = NULL;
if (bitmap.GetMask()) mask = bitmap.GetMask()->GetBitmap();
GtkWidget *tool_pixmap = gtk_pixmap_new( pixmap, mask );
gtk_misc_set_alignment( GTK_MISC(tool_pixmap), 0.5, 0.5 );
GtkToolbarChildType ctype = GTK_TOOLBAR_CHILD_BUTTON;
if (toggle) ctype = GTK_TOOLBAR_CHILD_TOGGLEBUTTON;
gtk_toolbar_append_element( m_toolbar,
ctype, NULL, NULL, helpString1, "", tool_pixmap, (GtkSignalFunc)gtk_toolbar_callback, (gpointer)tool );
m_tools.Append( tool );
return tool;
};
void wxToolBarGTK::AddSeparator(void)
{
gtk_toolbar_append_space( m_toolbar );
};
void wxToolBarGTK::ClearTools(void)
{
};
void wxToolBarGTK::EnableTool(const int toolIndex, const bool enable)
{
};
void wxToolBarGTK::ToggleTool(const int toolIndex, const bool toggle)
{
};
void wxToolBarGTK::SetToggle(const int toolIndex, const bool toggle)
{
};
wxObject *wxToolBarGTK::GetToolClientData(const int index) const
{
};
bool wxToolBarGTK::GetToolState(const int toolIndex) const
{
};
bool wxToolBarGTK::GetToolEnabled(const int toolIndex) const
{
};
void wxToolBarGTK::SetMargins(const int x, const int y)
{
};
void wxToolBarGTK::SetToolPacking(const int packing)
{
};
void wxToolBarGTK::SetToolSeparation(const int separation)
{
};

391
src/gtk1/textctrl.cpp Normal file
View File

@@ -0,0 +1,391 @@
/////////////////////////////////////////////////////////////////////////////
// Name: textctrl.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 "textctrl.h"
#endif
#include "wx/textctrl.h"
#include "wx/utils.h"
//-----------------------------------------------------------------------------
// wxTextCtrl
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl,wxControl)
BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
// EVT_CHAR(wxTextCtrl::OnChar)
END_EVENT_TABLE()
wxTextCtrl::wxTextCtrl(void) : streambuf()
{
};
wxTextCtrl::wxTextCtrl( wxWindow *parent, const wxWindowID id, const wxString &value,
const wxPoint &pos, const wxSize &size,
const int style, const wxString &name ) : streambuf()
{
Create( parent, id, value, pos, size, style, name );
};
bool wxTextCtrl::Create( wxWindow *parent, const wxWindowID id, const wxString &value,
const wxPoint &pos, const wxSize &size,
const int style, const wxString &name )
{
m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name );
if (style & wxTE_MULTILINE)
m_widget = gtk_text_new( NULL, NULL );
else
m_widget = gtk_entry_new();
if (!value.IsNull())
{
gint tmp = 0;
gtk_editable_insert_text( GTK_EDITABLE(m_widget), value, value.Length(), &tmp );
};
wxSize newSize = size;
if (newSize.x == -1) newSize.x = 80;
if (newSize.y == -1) newSize.y = 26;
SetSize( newSize.x, newSize.y );
PostCreation();
Show( TRUE );
return TRUE;
};
wxString wxTextCtrl::GetValue(void) const
{
wxString tmp;
if (m_windowStyle & wxTE_MULTILINE)
{
gint len = gtk_text_get_length( GTK_TEXT(m_widget) );
tmp = gtk_editable_get_chars( GTK_EDITABLE(m_widget), 0, len-1 );
}
else
{
tmp = gtk_entry_get_text( GTK_ENTRY(m_widget) );
};
return tmp;
};
void wxTextCtrl::SetValue( const wxString &value )
{
wxString tmp = "";
if (!value.IsNull()) tmp = value;
if (m_windowStyle & wxTE_MULTILINE)
{
gint len = gtk_text_get_length( GTK_TEXT(m_widget) );
gtk_editable_delete_text( GTK_EDITABLE(m_widget), 0, len-1 );
len = 0;
gtk_editable_insert_text( GTK_EDITABLE(m_widget), tmp, tmp.Length(), &len );
}
else
{
gtk_entry_set_text( GTK_ENTRY(m_widget), tmp );
};
};
void wxTextCtrl::WriteText( const wxString &text )
{
if (text.IsNull()) return;
if (m_windowStyle & wxTE_MULTILINE)
{
gint len = gtk_text_get_length( GTK_TEXT(m_widget) );
gtk_editable_insert_text( GTK_EDITABLE(m_widget), text, text.Length(), &len );
}
else
{
gtk_entry_append_text( GTK_ENTRY(m_widget), text );
};
};
/*
wxString wxTextCtrl::GetLineText( const long lineNo ) const
{
};
bool wxTextCtrl::LoadFile( const wxString &file )
{
};
bool wxTextCtrl::SaveFile( const wxString &file )
{
};
void wxTextCtrl::DiscardEdits(void)
{
};
bool wxTextCtrl::IsModified(void)
{
};
void wxTextCtrl::OnDropFiles( wxDropFilesEvent &event )
{
};
long wxTextCtrl::PositionToXY( const long pos, long *x, long *y ) const
{
};
long wxTextCtrl::XYToPosition( const long x, const long y )
{
};
int wxTextCtrl::GetNumberOfLines(void)
{
};
*/
void wxTextCtrl::SetInsertionPoint( const long pos )
{
int tmp = (int) pos;
if (m_windowStyle & wxTE_MULTILINE)
gtk_text_set_point( GTK_TEXT(m_widget), tmp );
else
gtk_entry_set_position( GTK_ENTRY(m_widget), tmp );
};
void wxTextCtrl::SetInsertionPointEnd(void)
{
int pos = 0;
if (m_windowStyle & wxTE_MULTILINE)
pos = gtk_text_get_length( GTK_TEXT(m_widget) );
else
pos = GTK_ENTRY(m_widget)->text_length;
SetInsertionPoint( pos-1 );
};
void wxTextCtrl::SetEditable( const bool editable )
{
if (m_windowStyle & wxTE_MULTILINE)
gtk_text_set_editable( GTK_TEXT(m_widget), editable );
else
gtk_entry_set_editable( GTK_ENTRY(m_widget), editable );
};
void wxTextCtrl::SetSelection( const long from, const long to )
{
gtk_editable_select_region( GTK_EDITABLE(m_widget), (gint)from, (gint)to );
};
void wxTextCtrl::ShowPosition( const long WXUNUSED(pos) )
{
};
long wxTextCtrl::GetInsertionPoint(void) const
{
return (long) GTK_EDITABLE(m_widget)->current_pos;
};
long wxTextCtrl::GetLastPosition(void) const
{
int pos = 0;
if (m_windowStyle & wxTE_MULTILINE)
pos = gtk_text_get_length( GTK_TEXT(m_widget) );
else
pos = GTK_ENTRY(m_widget)->text_length;
return (long)pos-1;
};
void wxTextCtrl::Remove( const long from, const long to )
{
gtk_editable_delete_text( GTK_EDITABLE(m_widget), (gint)from, (gint)to );
};
void wxTextCtrl::Replace( const long from, const long to, const wxString &value )
{
gtk_editable_delete_text( GTK_EDITABLE(m_widget), (gint)from, (gint)to );
if (value.IsNull()) return;
gint pos = (gint)to;
gtk_editable_insert_text( GTK_EDITABLE(m_widget), value, value.Length(), &pos );
};
void wxTextCtrl::Cut(void)
{
gtk_editable_cut_clipboard( GTK_EDITABLE(m_widget), 0 );
};
void wxTextCtrl::Copy(void)
{
gtk_editable_copy_clipboard( GTK_EDITABLE(m_widget), 0 );
};
void wxTextCtrl::Paste(void)
{
gtk_editable_paste_clipboard( GTK_EDITABLE(m_widget), 0 );
};
void wxTextCtrl::Delete(void)
{
SetValue( "" );
};
void wxTextCtrl::OnChar( wxKeyEvent &WXUNUSED(event) )
{
};
int wxTextCtrl::overflow(int c)
{
// Make sure there is a holding area
if ( allocate()==EOF )
{
wxError("Streambuf allocation failed","Internal error");
return EOF;
}
// Verify that there are no characters in get area
if ( gptr() && gptr() < egptr() )
{
wxError("Who's trespassing my get area?","Internal error");
return EOF;
}
// Reset get area
setg(0,0,0);
// Make sure there is a put area
if ( ! pptr() )
{
/* This doesn't seem to be fatal so comment out error message */
// wxError("Put area not opened","Internal error");
setp( base(), base() );
}
// Determine how many characters have been inserted but no consumed
int plen = pptr() - pbase();
// Now Jerry relies on the fact that the buffer is at least 2 chars
// long, but the holding area "may be as small as 1" ???
// And we need an additional \0, so let's keep this inefficient but
// safe copy.
// If c!=EOF, it is a character that must also be comsumed
int xtra = c==EOF? 0 : 1;
// Write temporary C-string to wxTextWindow
{
char *txt = new char[plen+xtra+1];
memcpy(txt, pbase(), plen);
txt[plen] = (char)c; // append c
txt[plen+xtra] = '\0'; // append '\0' or overwrite c
// If the put area already contained \0, output will be truncated there
WriteText(txt);
delete[] txt;
}
// Reset put area
setp(pbase(), epptr());
#if defined(__WATCOMC__)
return __NOT_EOF;
#elif defined(zapeof) // HP-UX (all cfront based?)
return zapeof(c);
#else
return c!=EOF ? c : 0; // this should make everybody happy
#endif
/* OLD CODE
int len = pptr() - pbase();
char *txt = new char[len+1];
strncpy(txt, pbase(), len);
txt[len] = '\0';
(*this) << txt;
setp(pbase(), epptr());
delete[] txt;
return EOF;
*/
};
int wxTextCtrl::sync(void)
{
// Verify that there are no characters in get area
if ( gptr() && gptr() < egptr() )
{
wxError("Who's trespassing my get area?","Internal error");
return EOF;
}
if ( pptr() && pptr() > pbase() ) return overflow(EOF);
return 0;
/* OLD CODE
int len = pptr() - pbase();
char *txt = new char[len+1];
strncpy(txt, pbase(), len);
txt[len] = '\0';
(*this) << txt;
setp(pbase(), epptr());
delete[] txt;
return 0;
*/
};
int wxTextCtrl::underflow(void)
{
return EOF;
};
wxTextCtrl& wxTextCtrl::operator<<(const wxString& s)
{
WriteText(s);
return *this;
}
wxTextCtrl& wxTextCtrl::operator<<(const float f)
{
static char buf[100];
sprintf(buf, "%.2f", f);
WriteText(buf);
return *this;
}
wxTextCtrl& wxTextCtrl::operator<<(const double d)
{
static char buf[100];
sprintf(buf, "%.2f", d);
WriteText(buf);
return *this;
}
wxTextCtrl& wxTextCtrl::operator<<(const int i)
{
static char buf[100];
sprintf(buf, "%i", i);
WriteText(buf);
return *this;
}
wxTextCtrl& wxTextCtrl::operator<<(const long i)
{
static char buf[100];
sprintf(buf, "%ld", i);
WriteText(buf);
return *this;
}
wxTextCtrl& wxTextCtrl::operator<<(const char c)
{
char buf[2];
buf[0] = c;
buf[1] = 0;
WriteText(buf);
return *this;
}

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

@@ -0,0 +1,71 @@
/////////////////////////////////////////////////////////////////////////////
// Name: timer.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 "timer.h"
#endif
#include "wx/timer.h"
//-----------------------------------------------------------------------------
// wxTimer
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxTimer,wxObject)
gint timeout_callback( gpointer data )
{
wxTimer *timer = (wxTimer*)data;
timer->Notify();
if (timer->OneShot()) timer->Stop();
return TRUE;
};
wxTimer::wxTimer(void)
{
m_tag = -1;
m_time = 1000;
m_oneShot = FALSE;
};
wxTimer::~wxTimer(void)
{
Stop();
};
int wxTimer::Interval(void)
{
return m_time;
};
bool wxTimer::OneShot(void)
{
return m_oneShot;
};
void wxTimer::Notify(void)
{
};
void wxTimer::Start( int millisecs, bool oneShot )
{
if (millisecs != -1) m_time = millisecs;
m_oneShot = oneShot;
m_tag = gtk_timeout_add( millisecs, timeout_callback, this );
};
void wxTimer::Stop(void)
{
if (m_tag != -1)
gtk_timeout_remove( m_tag );
m_tag = -1;
};

406
src/gtk1/utilsgtk.cpp Normal file
View File

@@ -0,0 +1,406 @@
/////////////////////////////////////////////////////////////////////////////
// Name: utils.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 "utils.h"
//#endif
#include "wx/utils.h"
#include "wx/string.h"
#include <stdarg.h>
#include <dirent.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/wait.h>
#include <pwd.h>
#include <errno.h>
#include <netdb.h>
#ifdef __SVR4__
#include <sys/systeminfo.h>
#endif
//------------------------------------------------------------------------
// misc.
//------------------------------------------------------------------------
void wxBell(void)
{
gdk_beep();
};
//------------------------------------------------------------------------
// user and home routines
//------------------------------------------------------------------------
char* wxGetHomeDir( char *dest )
{
wxString tmp = wxGetUserHome( wxString() );
if (tmp.IsNull())
strcpy( wxBuffer, "/" );
else
strcpy( wxBuffer, tmp );
if (dest) strcpy( dest, WXSTRINGCAST tmp );
return wxBuffer;
};
char *wxGetUserHome( const wxString &user )
{
struct passwd *who = NULL;
if (user.IsNull() || (user== ""))
{
register char *ptr;
if ((ptr = getenv("HOME")) != NULL)
return ptr;
if ((ptr = getenv("USER")) != NULL
|| (ptr = getenv("LOGNAME")) != NULL) {
who = getpwnam(ptr);
}
// We now make sure the the user exists!
if (who == NULL)
who = getpwuid(getuid());
}
else
who = getpwnam (user);
return who ? who->pw_dir : (char*)NULL;
};
//------------------------------------------------------------------------
// id routines
//------------------------------------------------------------------------
bool wxGetHostName(char *buf, int sz)
{
*buf = '\0';
#if defined(__SVR4__) && !defined(__sgi)
return (sysinfo(SI_HOSTNAME, buf, sz) != -1);
#else /* BSD Sockets */
char name[255];
struct hostent *h;
// Get hostname
if (gethostname(name, sizeof(name)/sizeof(char)-1) == -1)
return FALSE;
// Get official full name of host
strncpy(buf, (h=gethostbyname(name))!=NULL ? h->h_name : name, sz-1);
return TRUE;
#endif
}
bool wxGetUserId(char *buf, int sz)
{
struct passwd *who;
*buf = '\0';
if ((who = getpwuid(getuid ())) != NULL) {
strncpy (buf, who->pw_name, sz-1);
return TRUE;
}
return FALSE;
}
bool wxGetUserName(char *buf, int sz)
{
struct passwd *who;
*buf = '\0';
if ((who = getpwuid (getuid ())) != NULL) {
strncpy (buf, who->pw_gecos, sz - 1);
return TRUE;
}
return FALSE;
}
//------------------------------------------------------------------------
// error and debug output routines
//------------------------------------------------------------------------
void wxDebugMsg( const char *format, ... )
{
va_list ap;
va_start( ap, format );
vfprintf( stderr, format, ap );
fflush( stderr );
va_end(ap);
};
void wxError( const wxString &msg, const wxString &title )
{
fprintf( stderr, "Error " );
if (!title.IsNull()) fprintf( stderr, "%s ", WXSTRINGCAST(title) );
if (!msg.IsNull()) fprintf( stderr, ": %s", WXSTRINGCAST(msg) );
fprintf( stderr, ".\n" );
};
void wxFatalError( const wxString &msg, const wxString &title )
{
fprintf( stderr, "Error " );
if (!title.IsNull()) fprintf( stderr, "%s ", WXSTRINGCAST(title) );
if (!msg.IsNull()) fprintf( stderr, ": %s", WXSTRINGCAST(msg) );
fprintf( stderr, ".\n" );
exit(1);
};
//------------------------------------------------------------------------
// directory routines
//------------------------------------------------------------------------
bool wxDirExists( const wxString& dir )
{
char buf[500];
strcpy( buf, WXSTRINGCAST(dir) );
struct stat sbuf;
return ((stat(buf, &sbuf) != -1) && S_ISDIR(sbuf.st_mode) ? TRUE : FALSE);
};
//------------------------------------------------------------------------
// wild character routines
//------------------------------------------------------------------------
bool wxIsWild( const wxString& pattern )
{
wxString tmp = pattern;
char *pat = WXSTRINGCAST(tmp);
while (*pat) {
switch (*pat++) {
case '?': case '*': case '[': case '{':
return TRUE;
case '\\':
if (!*pat++)
return FALSE;
}
}
return FALSE;
};
bool wxMatchWild( const wxString& pat, const wxString& text, bool dot_special )
{
wxString tmp1 = pat;
char *pattern = WXSTRINGCAST(tmp1);
wxString tmp2 = text;
char *str = WXSTRINGCAST(tmp2);
char c;
char *cp;
bool done = FALSE, ret_code, ok;
// Below is for vi fans
const char OB = '{', CB = '}';
// dot_special means '.' only matches '.'
if (dot_special && *str == '.' && *pattern != *str)
return FALSE;
while ((*pattern != '\0') && (!done)
&& (((*str=='\0')&&((*pattern==OB)||(*pattern=='*')))||(*str!='\0'))) {
switch (*pattern) {
case '\\':
pattern++;
if (*pattern != '\0')
pattern++;
break;
case '*':
pattern++;
ret_code = FALSE;
while ((*str!='\0')
&& (!(ret_code=wxMatchWild(pattern, str++, FALSE))))
/*loop*/;
if (ret_code) {
while (*str != '\0')
str++;
while (*pattern != '\0')
pattern++;
}
break;
case '[':
pattern++;
repeat:
if ((*pattern == '\0') || (*pattern == ']')) {
done = TRUE;
break;
}
if (*pattern == '\\') {
pattern++;
if (*pattern == '\0') {
done = TRUE;
break;
}
}
if (*(pattern + 1) == '-') {
c = *pattern;
pattern += 2;
if (*pattern == ']') {
done = TRUE;
break;
}
if (*pattern == '\\') {
pattern++;
if (*pattern == '\0') {
done = TRUE;
break;
}
}
if ((*str < c) || (*str > *pattern)) {
pattern++;
goto repeat;
}
} else if (*pattern != *str) {
pattern++;
goto repeat;
}
pattern++;
while ((*pattern != ']') && (*pattern != '\0')) {
if ((*pattern == '\\') && (*(pattern + 1) != '\0'))
pattern++;
pattern++;
}
if (*pattern != '\0') {
pattern++, str++;
}
break;
case '?':
pattern++;
str++;
break;
case OB:
pattern++;
while ((*pattern != CB) && (*pattern != '\0')) {
cp = str;
ok = TRUE;
while (ok && (*cp != '\0') && (*pattern != '\0')
&& (*pattern != ',') && (*pattern != CB)) {
if (*pattern == '\\')
pattern++;
ok = (*pattern++ == *cp++);
}
if (*pattern == '\0') {
ok = FALSE;
done = TRUE;
break;
} else if (ok) {
str = cp;
while ((*pattern != CB) && (*pattern != '\0')) {
if (*++pattern == '\\') {
if (*++pattern == CB)
pattern++;
}
}
} else {
while (*pattern!=CB && *pattern!=',' && *pattern!='\0') {
if (*++pattern == '\\') {
if (*++pattern == CB || *pattern == ',')
pattern++;
}
}
}
if (*pattern != '\0')
pattern++;
}
break;
default:
if (*str == *pattern) {
str++, pattern++;
} else {
done = TRUE;
}
}
}
while (*pattern == '*')
pattern++;
return ((*str == '\0') && (*pattern == '\0'));
};
//------------------------------------------------------------------------
// subprocess routines
//------------------------------------------------------------------------
long wxExecute( char **argv, bool Async )
{
if (*argv == NULL)
return FALSE;
/* fork the process */
#if defined(sun) || defined(__ultrix) || defined(__bsdi__)
pid_t pid = vfork();
#else
pid_t pid = fork();
#endif
if (pid == -1) {
perror ("fork failed");
return FALSE;
} else if (pid == 0) {
/* child */
#ifdef _AIX
execvp ((const char *)*argv, (const char **)argv);
#else
execvp (*argv, argv);
#endif
if (errno == ENOENT)
wxError("command not found", *argv);
else
perror (*argv);
wxError("could not execute", *argv);
_exit (-1);
}
// Code below is NOT really acceptable!
// One should NEVER use wait under X
// Ideas? A Sleep idle callback?
// WARNING: WARNING: WARNING: WARNING:
// The CODE BELOW IS BAD BAD BAD BAD!
if (Async) {
int status;
/*
wxSleep(2); // Give a little time
*/
#if !defined(DG) && \
!defined(__AIX__) && \
!defined(__xlC__) && \
!defined(__SVR4__) && \
!defined(__SUN__) && \
!defined(__ALPHA__) && \
!defined(__SGI__) && \
!defined(__HPUX__) && \
!defined(__SUNPRO_CC) && \
!defined(__FreeBSD__)
while (wait((union wait*)&status) != pid)
#else
while (wait(&status) != pid)
#endif
{};
/*
wxSleep(3); // 3 sec?
*/
};
return TRUE;
};
long wxExecute( const wxString& command, bool Async )
{
if (command.IsNull() || command == "") return FALSE;
int argc = 0;
char *argv[127];
char tmp[1024];
const char *IFS = " \t\n";
strncpy (tmp, command, sizeof(tmp) / sizeof(char) - 1);
tmp[sizeof (tmp) / sizeof (char) - 1] = '\0';
argv[argc++] = strtok (tmp, IFS);
while ((argv[argc++] = strtok(NULL, IFS)) != NULL)
/* loop */ ;
return wxExecute(argv, Async);
};

332
src/gtk1/utilsres.cpp Normal file
View File

@@ -0,0 +1,332 @@
/////////////////////////////////////////////////////////////////////////////
// Name: utils.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 "utils.h"
//#endif
#include "wx/utils.h"
#include "wx/string.h"
#include "wx/list.h"
#include <ctype.h>
#include <string.h>
#include <unistd.h>
#ifdef __SVR4__
#include <sys/systeminfo.h>
#endif
#include "gdk/gdkx.h" // GDK_DISPLAY
#include "gdk/gdkprivate.h" // gdk_progclass
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xresource.h>
//-----------------------------------------------------------------------------
// constants
//-----------------------------------------------------------------------------
// Yuck this is really BOTH site and platform dependent
// so we should use some other strategy!
#ifdef __SUN__
#define DEFAULT_XRESOURCE_DIR "/usr/openwin/lib/app-defaults"
#else
#define DEFAULT_XRESOURCE_DIR "/usr/lib/X11/app-defaults"
#endif
//-----------------------------------------------------------------------------
// glabal data (data.cpp)
//-----------------------------------------------------------------------------
extern wxList wxResourceCache;
extern XrmDatabase wxResourceDatabase;
//-----------------------------------------------------------------------------
// utility functions for get/write resources
//-----------------------------------------------------------------------------
static char *GetResourcePath(char *buf, char *name, bool create)
{
if (create && FileExists(name)) {
strcpy(buf, name);
return buf; // Exists so ...
}
if (*name == '/')
strcpy(buf, name);
else {
// Put in standard place for resource files if not absolute
strcpy(buf, DEFAULT_XRESOURCE_DIR);
strcat(buf, "/");
strcat(buf, FileNameFromPath(name));
}
if (create) {
// Touch the file to create it
FILE *fd = fopen(buf, "w");
if (fd) fclose(fd);
}
return buf;
}
// Read $HOME for what it says is home, if not
// read $USER or $LOGNAME for user name else determine
// the Real User, then determine the Real home dir.
static char *GetIniFile(char *dest, const char *filename)
{
char *home = NULL;
if (filename && wxIsAbsolutePath(filename))
{
strcpy(dest, filename);
}
else
{
if ((home = wxGetUserHome(wxString())) != NULL)
{
strcpy(dest, home);
if (dest[strlen(dest) - 1] != '/') strcat(dest, "/");
if (filename == NULL)
{
if ((filename = getenv("XENVIRONMENT")) == NULL) filename = ".Xdefaults";
}
else
if (*filename != '.') strcat(dest, ".");
strcat(dest, filename);
}
else
{
dest[0] = '\0';
}
}
return dest;
}
static void wxXMergeDatabases(void)
{
XrmDatabase homeDB, serverDB, applicationDB;
char filenamebuf[1024];
char *filename = &filenamebuf[0];
char *environment;
char *classname = gdk_progclass; // Robert Roebling ??
char name[256];
(void)strcpy(name, "/usr/lib/X11/app-defaults/");
(void)strcat(name, classname ? classname : "wxWindows");
// Get application defaults file, if any
if ((applicationDB = XrmGetFileDatabase(name)))
(void)XrmMergeDatabases(applicationDB, &wxResourceDatabase);
// Merge server defaults, created by xrdb, loaded as a property of the root
// window when the server initializes and loaded into the display
// structure on XOpenDisplay;
// if not defined, use .Xdefaults
if (XResourceManagerString(GDK_DISPLAY()) != NULL) {
serverDB = XrmGetStringDatabase(XResourceManagerString(GDK_DISPLAY()));
} else {
(void)GetIniFile(filename, NULL);
serverDB = XrmGetFileDatabase(filename);
}
if (serverDB)
XrmMergeDatabases(serverDB, &wxResourceDatabase);
// Open XENVIRONMENT file, or if not defined, the .Xdefaults,
// and merge into existing database
if ((environment = getenv("XENVIRONMENT")) == NULL) {
size_t len;
environment = GetIniFile(filename, NULL);
len = strlen(environment);
#if !defined(SVR4) || defined(__sgi)
(void)gethostname(environment + len, 1024 - len);
#else
(void)sysinfo(SI_HOSTNAME, environment + len, 1024 - len);
#endif
}
if ((homeDB = XrmGetFileDatabase(environment)))
XrmMergeDatabases(homeDB, &wxResourceDatabase);
}
//-----------------------------------------------------------------------------
// called on application exit
//-----------------------------------------------------------------------------
void wxFlushResources(void)
{
char nameBuffer[512];
wxNode *node = wxResourceCache.First();
while (node) {
char *file = node->key.string;
// If file doesn't exist, create it first.
(void)GetResourcePath(nameBuffer, file, TRUE);
XrmDatabase database = (XrmDatabase)node->Data();
XrmPutFileDatabase(database, nameBuffer);
XrmDestroyDatabase(database);
wxNode *next = node->Next();
delete node;
node = next;
}
}
void wxDeleteResources(const char *file)
{
char buffer[500];
(void)GetIniFile(buffer, file);
wxNode *node = wxResourceCache.Find(buffer);
if (node) {
XrmDatabase database = (XrmDatabase)node->Data();
XrmDestroyDatabase(database);
delete node;
}
}
//-----------------------------------------------------------------------------
// resource functions
//-----------------------------------------------------------------------------
bool wxWriteResource(const wxString& section, const wxString& entry, const wxString& value, const wxString& file )
{
char buffer[500];
if (!entry) return FALSE;
(void)GetIniFile(buffer, file);
XrmDatabase database;
wxNode *node = wxResourceCache.Find(buffer);
if (node)
database = (XrmDatabase)node->Data();
else {
database = XrmGetFileDatabase(buffer);
wxResourceCache.Append(buffer, (wxObject *)database);
}
char resName[300];
strcpy(resName, !section.IsNull() ? WXSTRINGCAST section : "wxWindows");
strcat(resName, ".");
strcat(resName, entry);
XrmPutStringResource(&database, resName, value);
return TRUE;
};
bool wxWriteResource(const wxString& section, const wxString& entry, float value, const wxString& file )
{
char buf[50];
sprintf(buf, "%.4f", value);
return wxWriteResource(section, entry, buf, file);
};
bool wxWriteResource(const wxString& section, const wxString& entry, long value, const wxString& file )
{
char buf[50];
sprintf(buf, "%ld", value);
return wxWriteResource(section, entry, buf, file);
};
bool wxWriteResource(const wxString& section, const wxString& entry, int value, const wxString& file )
{
char buf[50];
sprintf(buf, "%d", value);
return wxWriteResource(section, entry, buf, file);
};
bool wxGetResource(const wxString& section, const wxString& entry, char **value, const wxString& file )
{
if (!wxResourceDatabase)
wxXMergeDatabases();
XrmDatabase database;
if (file) {
char buffer[500];
// Is this right? Trying to get it to look in the user's
// home directory instead of current directory -- JACS
(void)GetIniFile(buffer, file);
wxNode *node = wxResourceCache.Find(buffer);
if (node)
database = (XrmDatabase)node->Data();
else {
database = XrmGetFileDatabase(buffer);
wxResourceCache.Append(buffer, (wxObject *)database);
}
} else
database = wxResourceDatabase;
XrmValue xvalue;
char *str_type[20];
char buf[150];
strcpy(buf, section);
strcat(buf, ".");
strcat(buf, entry);
bool success = XrmGetResource(database, buf, "*", str_type, &xvalue);
// Try different combinations of upper/lower case, just in case...
if (!success) {
buf[0] = (isupper(buf[0]) ? tolower(buf[0]) : toupper(buf[0]));
success = XrmGetResource(database, buf, "*", str_type, &xvalue);
}
if (success) {
if (*value)
delete[] *value;
*value = new char[xvalue.size + 1];
strncpy(*value, xvalue.addr, (int)xvalue.size);
return TRUE;
}
return FALSE;
};
bool wxGetResource(const wxString& section, const wxString& entry, float *value, const wxString& file )
{
char *s = NULL;
bool succ = wxGetResource(section, entry, &s, file);
if (succ) {
*value = (float)strtod(s, NULL);
delete[]s;
return TRUE;
} else
return FALSE;
};
bool wxGetResource(const wxString& section, const wxString& entry, long *value, const wxString& file )
{
char *s = NULL;
bool succ = wxGetResource(section, entry, &s, file);
if (succ) {
*value = strtol(s, NULL, 10);
delete[]s;
return TRUE;
} else
return FALSE;
};
bool wxGetResource(const wxString& section, const wxString& entry, int *value, const wxString& file )
{
char *s = NULL;
bool succ = wxGetResource(section, entry, &s, file);
if (succ) {
// Handle True, False here
// True, Yes, Enables, Set or Activated
if (*s == 'T' || *s == 'Y' || *s == 'E' || *s == 'S' || *s == 'A')
*value = TRUE;
// False, No, Disabled, Reset, Cleared, Deactivated
else if (*s == 'F' || *s == 'N' || *s == 'D' || *s == 'R' || *s == 'C')
*value = FALSE;
// Handle as Integer
else
*value = (int)strtol(s, NULL, 10);
delete[]s;
return TRUE;
} else
return FALSE;
};

6
src/gtk1/verti.xbm Normal file
View File

@@ -0,0 +1,6 @@
#define verti_width 15
#define verti_height 15
static char verti_bits[] = {
0x84, 0x10, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10,
0x84, 0x10, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10, 0x84, 0x10,
0x84, 0x10, 0x84, 0x10, 0x84, 0x10};

512
src/gtk1/win_gtk.c Normal file
View File

@@ -0,0 +1,512 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx_gtk.h
// Purpose:
// Author: Robert Roebling
// Created: 01/02/97
// Id:
// Copyright: (c) 1998 Robert Roebling, Julian Smart and Markus Holzem
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#include "wx/gtk/win_gtk.h"
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
static void gtk_myfixed_class_init (GtkMyFixedClass *klass);
static void gtk_myfixed_init (GtkMyFixed *myfixed);
static void gtk_myfixed_map (GtkWidget *widget);
static void gtk_myfixed_unmap (GtkWidget *widget);
static void gtk_myfixed_realize (GtkWidget *widget);
static void gtk_myfixed_size_request (GtkWidget *widget,
GtkRequisition *requisition);
static void gtk_myfixed_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static void gtk_myfixed_paint (GtkWidget *widget,
GdkRectangle *area);
static void gtk_myfixed_draw (GtkWidget *widget,
GdkRectangle *area);
static gint gtk_myfixed_expose (GtkWidget *widget,
GdkEventExpose *event);
static void gtk_myfixed_add (GtkContainer *container,
GtkWidget *widget);
static void gtk_myfixed_remove (GtkContainer *container,
GtkWidget *widget);
static void gtk_myfixed_foreach (GtkContainer *container,
GtkCallback callback,
gpointer callback_data);
static GtkContainerClass *parent_class = NULL;
guint
gtk_myfixed_get_type ()
{
static guint myfixed_type = 0;
if (!myfixed_type)
{
GtkTypeInfo myfixed_info =
{
"GtkMyFixed",
sizeof (GtkMyFixed),
sizeof (GtkMyFixedClass),
(GtkClassInitFunc) gtk_myfixed_class_init,
(GtkObjectInitFunc) gtk_myfixed_init,
(GtkArgSetFunc) NULL,
(GtkArgGetFunc) NULL,
};
myfixed_type = gtk_type_unique (gtk_container_get_type (), &myfixed_info);
}
return myfixed_type;
}
static void
gtk_myfixed_class_init (GtkMyFixedClass *klass)
{
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
GtkContainerClass *container_class;
object_class = (GtkObjectClass*) klass;
widget_class = (GtkWidgetClass*) klass;
container_class = (GtkContainerClass*) klass;
parent_class = gtk_type_class (gtk_container_get_type ());
widget_class->map = gtk_myfixed_map;
widget_class->unmap = gtk_myfixed_unmap;
widget_class->realize = gtk_myfixed_realize;
widget_class->size_request = gtk_myfixed_size_request;
widget_class->size_allocate = gtk_myfixed_size_allocate;
widget_class->draw = gtk_myfixed_draw;
widget_class->expose_event = gtk_myfixed_expose;
container_class->add = gtk_myfixed_add;
container_class->remove = gtk_myfixed_remove;
container_class->foreach = gtk_myfixed_foreach;
}
static void
gtk_myfixed_init (GtkMyFixed *myfixed)
{
GTK_WIDGET_UNSET_FLAGS (myfixed, GTK_NO_WINDOW);
GTK_WIDGET_SET_FLAGS (myfixed, GTK_BASIC);
myfixed->children = NULL;
}
GtkWidget*
gtk_myfixed_new ()
{
GtkMyFixed *myfixed;
myfixed = gtk_type_new (gtk_myfixed_get_type ());
myfixed->scroll_offset_x = 0;
myfixed->scroll_offset_y = 0;
return GTK_WIDGET (myfixed);
}
void
gtk_myfixed_set_offset (GtkMyFixed *myfixed,
gint16 x,
gint16 y)
{
GtkWidget *widget;
g_return_if_fail (myfixed != NULL);
g_return_if_fail (GTK_IS_MYFIXED (myfixed));
myfixed->scroll_offset_x = x;
myfixed->scroll_offset_y = y;
widget = GTK_WIDGET( myfixed );
if (GTK_WIDGET_REALIZED( GTK_WIDGET(myfixed) ))
gdk_window_move_resize (widget->window,
widget->allocation.x + x,
widget->allocation.y + y,
32000,
32000);
}
void
gtk_myfixed_put (GtkMyFixed *myfixed,
GtkWidget *widget,
gint16 x,
gint16 y)
{
GtkMyFixedChild *child_info;
g_return_if_fail (myfixed != NULL);
g_return_if_fail (GTK_IS_MYFIXED (myfixed));
g_return_if_fail (widget != NULL);
child_info = g_new (GtkMyFixedChild, 1);
child_info->widget = widget;
child_info->x = x;
child_info->y = y;
gtk_widget_set_parent (widget, GTK_WIDGET (myfixed));
myfixed->children = g_list_append (myfixed->children, child_info);
if (GTK_WIDGET_REALIZED (myfixed) && !GTK_WIDGET_REALIZED (widget))
gtk_widget_realize (widget);
if (GTK_WIDGET_MAPPED (myfixed) && !GTK_WIDGET_MAPPED (widget))
gtk_widget_map (widget);
if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (myfixed))
gtk_widget_queue_resize (GTK_WIDGET (myfixed));
}
void
gtk_myfixed_move (GtkMyFixed *myfixed,
GtkWidget *widget,
gint16 x,
gint16 y)
{
GtkMyFixedChild *child;
GList *children;
g_return_if_fail (myfixed != NULL);
g_return_if_fail (GTK_IS_MYFIXED (myfixed));
g_return_if_fail (widget != NULL);
children = myfixed->children;
while (children)
{
child = children->data;
children = children->next;
if (child->widget == widget)
{
child->x = x;
child->y = y;
if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (myfixed))
gtk_widget_queue_resize (GTK_WIDGET (myfixed));
break;
}
}
}
static void
gtk_myfixed_map (GtkWidget *widget)
{
GtkMyFixed *myfixed;
GtkMyFixedChild *child;
GList *children;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_MYFIXED (widget));
GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
myfixed = GTK_MYFIXED (widget);
gdk_window_show (widget->window);
children = myfixed->children;
while (children)
{
child = children->data;
children = children->next;
if (GTK_WIDGET_VISIBLE (child->widget) &&
!GTK_WIDGET_MAPPED (child->widget))
gtk_widget_map (child->widget);
}
}
static void
gtk_myfixed_unmap (GtkWidget *widget)
{
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_MYFIXED (widget));
GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
}
static void
gtk_myfixed_realize (GtkWidget *widget)
{
GdkWindowAttr attributes;
gint attributes_mask;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_MYFIXED (widget));
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
attributes.window_type = GDK_WINDOW_CHILD;
attributes.x = widget->allocation.x;
attributes.y = widget->allocation.y;
attributes.width = 32000;
attributes.height = 32000;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.visual = gtk_widget_get_visual (widget);
attributes.colormap = gtk_widget_get_colormap (widget);
attributes.event_mask = gtk_widget_get_events (widget);
attributes.event_mask |=
GDK_EXPOSURE_MASK |
GDK_POINTER_MOTION_MASK |
GDK_BUTTON_MOTION_MASK |
GDK_BUTTON1_MOTION_MASK |
GDK_BUTTON2_MOTION_MASK |
GDK_BUTTON3_MOTION_MASK |
GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK |
GDK_KEY_PRESS_MASK |
GDK_KEY_RELEASE_MASK |
GDK_ENTER_NOTIFY_MASK |
GDK_LEAVE_NOTIFY_MASK |
GDK_FOCUS_CHANGE_MASK;
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
widget->window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes,
attributes_mask);
gdk_window_set_user_data (widget->window, widget);
widget->style = gtk_style_attach (widget->style, widget->window);
gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
}
static void
gtk_myfixed_size_request (GtkWidget *widget,
GtkRequisition *requisition)
{
GtkMyFixed *myfixed;
GtkMyFixedChild *child;
GList *children;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_MYFIXED (widget));
g_return_if_fail (requisition != NULL);
myfixed = GTK_MYFIXED (widget);
requisition->width = 0;
requisition->height = 0;
children = myfixed->children;
while (children)
{
child = children->data;
children = children->next;
if (GTK_WIDGET_VISIBLE (child->widget))
{
gtk_widget_size_request (child->widget, &child->widget->requisition);
}
}
}
static void
gtk_myfixed_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
GtkMyFixed *myfixed;
GtkMyFixedChild *child;
GtkAllocation child_allocation;
GList *children;
guint16 border_width;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_MYFIXED(widget));
g_return_if_fail (allocation != NULL);
myfixed = GTK_MYFIXED (widget);
widget->allocation = *allocation;
if (GTK_WIDGET_REALIZED (widget))
gdk_window_move_resize (widget->window,
allocation->x + myfixed->scroll_offset_x,
allocation->y + myfixed->scroll_offset_y,
32000,
32000
);
border_width = GTK_CONTAINER (myfixed)->border_width;
children = myfixed->children;
while (children)
{
child = children->data;
children = children->next;
if (GTK_WIDGET_VISIBLE (child->widget))
{
child_allocation.x = child->x + border_width;
child_allocation.y = child->y + border_width;
child_allocation.width = child->widget->requisition.width;
child_allocation.height = child->widget->requisition.height;
gtk_widget_size_allocate (child->widget, &child_allocation);
}
}
}
static void
gtk_myfixed_paint (GtkWidget *widget,
GdkRectangle *area)
{
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_MYFIXED (widget));
g_return_if_fail (area != NULL);
if (GTK_WIDGET_DRAWABLE (widget))
gdk_window_clear_area (widget->window,
area->x, area->y,
area->width, area->height);
}
static void
gtk_myfixed_draw (GtkWidget *widget,
GdkRectangle *area)
{
GtkMyFixed *myfixed;
GtkMyFixedChild *child;
GdkRectangle child_area;
GList *children;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_MYFIXED (widget));
if (GTK_WIDGET_DRAWABLE (widget))
{
myfixed = GTK_MYFIXED (widget);
gtk_myfixed_paint (widget, area);
children = myfixed->children;
while (children)
{
child = children->data;
children = children->next;
if (gtk_widget_intersect (child->widget, area, &child_area))
gtk_widget_draw (child->widget, &child_area);
}
}
}
static gint
gtk_myfixed_expose (GtkWidget *widget,
GdkEventExpose *event)
{
GtkMyFixed *myfixed;
GtkMyFixedChild *child;
GdkEventExpose child_event;
GList *children;
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_MYFIXED (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
if (GTK_WIDGET_DRAWABLE (widget))
{
myfixed = GTK_MYFIXED (widget);
child_event = *event;
children = myfixed->children;
while (children)
{
child = children->data;
children = children->next;
if (GTK_WIDGET_NO_WINDOW (child->widget) &&
gtk_widget_intersect (child->widget, &event->area,
&child_event.area))
gtk_widget_event (child->widget, (GdkEvent*) &child_event);
}
}
return FALSE;
}
static void
gtk_myfixed_add (GtkContainer *container,
GtkWidget *widget)
{
g_return_if_fail (container != NULL);
g_return_if_fail (GTK_IS_MYFIXED (container));
g_return_if_fail (widget != NULL);
gtk_myfixed_put (GTK_MYFIXED (container), widget, 0, 0);
}
static void
gtk_myfixed_remove (GtkContainer *container,
GtkWidget *widget)
{
GtkMyFixed *myfixed;
GtkMyFixedChild *child;
GList *children;
g_return_if_fail (container != NULL);
g_return_if_fail (GTK_IS_MYFIXED (container));
g_return_if_fail (widget != NULL);
myfixed = GTK_MYFIXED (container);
children = myfixed->children;
while (children)
{
child = children->data;
if (child->widget == widget)
{
gtk_widget_unparent (widget);
myfixed->children = g_list_remove_link (myfixed->children, children);
g_list_free (children);
g_free (child);
if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (container))
gtk_widget_queue_resize (GTK_WIDGET (container));
break;
}
children = children->next;
}
}
static void
gtk_myfixed_foreach (GtkContainer *container,
GtkCallback callback,
gpointer callback_data)
{
GtkMyFixed *myfixed;
GtkMyFixedChild *child;
GList *children;
g_return_if_fail (container != NULL);
g_return_if_fail (GTK_IS_MYFIXED (container));
g_return_if_fail (callback != NULL);
myfixed = GTK_MYFIXED (container);
children = myfixed->children;
while (children)
{
child = children->data;
children = children->next;
(* callback) (child->widget, callback_data);
}
}
#ifdef __cplusplus
}
#endif /* __cplusplus */

2386
src/gtk1/window.cpp Normal file

File diff suppressed because it is too large Load Diff