Added install scripts in missing places

Fixed wxFrame resize behaviour for GTK 1.1.3
  Added GetMousePosition
  Added const char** constructors to icon and bitmap
  Autolayout should now work for wxDialog


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1024 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
1998-11-23 12:43:57 +00:00
parent 16ee7f42e1
commit e52f60e652
26 changed files with 952 additions and 168 deletions

250
include/install-sh Executable file
View File

@@ -0,0 +1,250 @@
#! /bin/sh
#
# install - install a program, script, or datafile
# This comes from X11R5 (mit/util/scripts/install.sh).
#
# Copyright 1991 by the Massachusetts Institute of Technology
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation, and that the name of M.I.T. not be used in advertising or
# publicity pertaining to distribution of the software without specific,
# written prior permission. M.I.T. makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
transformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
dst=""
dir_arg=""
while [ x"$1" != x ]; do
case $1 in
-c) instcmd="$cpprog"
shift
continue;;
-d) dir_arg=true
shift
continue;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
-s) stripcmd="$stripprog"
shift
continue;;
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
shift
continue;;
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
shift
continue;;
*) if [ x"$src" = x ]
then
src=$1
else
# this colon is to work around a 386BSD /bin/sh bug
:
dst=$1
fi
shift
continue;;
esac
done
if [ x"$src" = x ]
then
echo "install: no input file specified"
exit 1
else
true
fi
if [ x"$dir_arg" != x ]; then
dst=$src
src=""
if [ -d $dst ]; then
instcmd=:
else
instcmd=mkdir
fi
else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if [ -f $src -o -d $src ]
then
true
else
echo "install: $src does not exist"
exit 1
fi
if [ x"$dst" = x ]
then
echo "install: no destination specified"
exit 1
else
true
fi
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d $dst ]
then
dst="$dst"/`basename $src`
else
true
fi
fi
## this sed command emulates the dirname command
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script
# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
defaultIFS='
'
IFS="${IFS-${defaultIFS}}"
oIFS="${IFS}"
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS="${oIFS}"
pathcomp=''
while [ $# -ne 0 ] ; do
pathcomp="${pathcomp}${1}"
shift
if [ ! -d "${pathcomp}" ] ;
then
$mkdirprog "${pathcomp}"
else
true
fi
pathcomp="${pathcomp}/"
done
fi
if [ x"$dir_arg" != x ]
then
$doit $instcmd $dst &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
else
# If we're going to rename the final executable, determine the name now.
if [ x"$transformarg" = x ]
then
dstfile=`basename $dst`
else
dstfile=`basename $dst $transformbasename |
sed $transformarg`$transformbasename
fi
# don't allow the sed command to completely eliminate the filename
if [ x"$dstfile" = x ]
then
dstfile=`basename $dst`
else
true
fi
# Make a temp file name in the proper directory.
dsttmp=$dstdir/#inst.$$#
# Move or copy the file name to the temp name
$doit $instcmd $src $dsttmp &&
trap "rm -f ${dsttmp}" 0 &&
# and set any options; do chmod last to preserve setuid bits
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
# Now rename the file to the real destination.
$doit $rmcmd -f $dstdir/$dstfile &&
$doit $mvcmd $dsttmp $dstdir/$dstfile
fi &&
exit 0

View File

@@ -331,9 +331,9 @@ extern void WXDLLEXPORT wxSetCursor(const wxCursor& cursor);
// Load from a resource // Load from a resource
# define wxICON(X) wxIcon("" #X "") # define wxICON(X) wxIcon("" #X "")
#elif defined(__WXGTK__) #elif defined(__WXGTK__) || defined(__WXMOTIF__)
// Initialize from an included XPM // Initialize from an included XPM
# define wxICON(X) wxIcon(X##_xpm) # define wxICON(X) wxIcon( (const char**) X##_xpm )
#else #else
// This will usually mean something on any platform // This will usually mean something on any platform

View File

@@ -62,6 +62,7 @@ public:
wxBitmap( int width, int height, int depth = -1 ); wxBitmap( int width, int height, int depth = -1 );
wxBitmap( const char bits[], int width, int height, int depth = 1 ); wxBitmap( const char bits[], int width, int height, int depth = 1 );
wxBitmap( const wxImage &image ); wxBitmap( const wxImage &image );
wxBitmap( const char **bits );
wxBitmap( char **bits ); wxBitmap( char **bits );
wxBitmap( const wxBitmap& bmp ); wxBitmap( const wxBitmap& bmp );
wxBitmap( const wxBitmap* bmp ); wxBitmap( const wxBitmap* bmp );

View File

@@ -62,7 +62,8 @@ public:
void OnApply( wxCommandEvent &event ); void OnApply( wxCommandEvent &event );
void OnCancel( wxCommandEvent &event ); void OnCancel( wxCommandEvent &event );
void OnOK( wxCommandEvent &event ); void OnOK( wxCommandEvent &event );
void OnPaint(wxPaintEvent& event); void OnPaint( wxPaintEvent& event );
void OnSize( wxSizeEvent &event );
/* /*
void OnCharHook( wxKeyEvent& event ); void OnCharHook( wxKeyEvent& event );
*/ */
@@ -93,6 +94,8 @@ public:
// implementation // implementation
virtual void GtkOnSize( int x, int y, int width, int height );
bool m_modalShowing; bool m_modalShowing;
wxString m_title; wxString m_title;
wxIcon m_icon; wxIcon m_icon;

View File

@@ -36,8 +36,9 @@ class wxIcon: public wxBitmap
public: public:
wxIcon(void); wxIcon(void);
wxIcon(const wxIcon& icon); wxIcon( const wxIcon& icon);
wxIcon(const wxIcon* icon); wxIcon( const wxIcon* icon);
wxIcon( const char **bits, int width=-1, int height=-1 );
wxIcon( char **bits, int width=-1, int height=-1 ); wxIcon( char **bits, int width=-1, int height=-1 );
wxIcon& operator = (const wxIcon& icon); wxIcon& operator = (const wxIcon& icon);

View File

@@ -62,6 +62,7 @@ public:
wxBitmap( int width, int height, int depth = -1 ); wxBitmap( int width, int height, int depth = -1 );
wxBitmap( const char bits[], int width, int height, int depth = 1 ); wxBitmap( const char bits[], int width, int height, int depth = 1 );
wxBitmap( const wxImage &image ); wxBitmap( const wxImage &image );
wxBitmap( const char **bits );
wxBitmap( char **bits ); wxBitmap( char **bits );
wxBitmap( const wxBitmap& bmp ); wxBitmap( const wxBitmap& bmp );
wxBitmap( const wxBitmap* bmp ); wxBitmap( const wxBitmap* bmp );

View File

@@ -62,7 +62,8 @@ public:
void OnApply( wxCommandEvent &event ); void OnApply( wxCommandEvent &event );
void OnCancel( wxCommandEvent &event ); void OnCancel( wxCommandEvent &event );
void OnOK( wxCommandEvent &event ); void OnOK( wxCommandEvent &event );
void OnPaint(wxPaintEvent& event); void OnPaint( wxPaintEvent& event );
void OnSize( wxSizeEvent &event );
/* /*
void OnCharHook( wxKeyEvent& event ); void OnCharHook( wxKeyEvent& event );
*/ */
@@ -93,6 +94,8 @@ public:
// implementation // implementation
virtual void GtkOnSize( int x, int y, int width, int height );
bool m_modalShowing; bool m_modalShowing;
wxString m_title; wxString m_title;
wxIcon m_icon; wxIcon m_icon;

View File

@@ -36,8 +36,9 @@ class wxIcon: public wxBitmap
public: public:
wxIcon(void); wxIcon(void);
wxIcon(const wxIcon& icon); wxIcon( const wxIcon& icon);
wxIcon(const wxIcon* icon); wxIcon( const wxIcon* icon);
wxIcon( const char **bits, int width=-1, int height=-1 );
wxIcon( char **bits, int width=-1, int height=-1 ); wxIcon( char **bits, int width=-1, int height=-1 );
wxIcon& operator = (const wxIcon& icon); wxIcon& operator = (const wxIcon& icon);

250
include/wx/install-sh Executable file
View File

@@ -0,0 +1,250 @@
#! /bin/sh
#
# install - install a program, script, or datafile
# This comes from X11R5 (mit/util/scripts/install.sh).
#
# Copyright 1991 by the Massachusetts Institute of Technology
#
# Permission to use, copy, modify, distribute, and sell this software and its
# documentation for any purpose is hereby granted without fee, provided that
# the above copyright notice appear in all copies and that both that
# copyright notice and this permission notice appear in supporting
# documentation, and that the name of M.I.T. not be used in advertising or
# publicity pertaining to distribution of the software without specific,
# written prior permission. M.I.T. makes no representations about the
# suitability of this software for any purpose. It is provided "as is"
# without express or implied warranty.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
transformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
dst=""
dir_arg=""
while [ x"$1" != x ]; do
case $1 in
-c) instcmd="$cpprog"
shift
continue;;
-d) dir_arg=true
shift
continue;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
-s) stripcmd="$stripprog"
shift
continue;;
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
shift
continue;;
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
shift
continue;;
*) if [ x"$src" = x ]
then
src=$1
else
# this colon is to work around a 386BSD /bin/sh bug
:
dst=$1
fi
shift
continue;;
esac
done
if [ x"$src" = x ]
then
echo "install: no input file specified"
exit 1
else
true
fi
if [ x"$dir_arg" != x ]; then
dst=$src
src=""
if [ -d $dst ]; then
instcmd=:
else
instcmd=mkdir
fi
else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if [ -f $src -o -d $src ]
then
true
else
echo "install: $src does not exist"
exit 1
fi
if [ x"$dst" = x ]
then
echo "install: no destination specified"
exit 1
else
true
fi
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d $dst ]
then
dst="$dst"/`basename $src`
else
true
fi
fi
## this sed command emulates the dirname command
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script
# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
defaultIFS='
'
IFS="${IFS-${defaultIFS}}"
oIFS="${IFS}"
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS="${oIFS}"
pathcomp=''
while [ $# -ne 0 ] ; do
pathcomp="${pathcomp}${1}"
shift
if [ ! -d "${pathcomp}" ] ;
then
$mkdirprog "${pathcomp}"
else
true
fi
pathcomp="${pathcomp}/"
done
fi
if [ x"$dir_arg" != x ]
then
$doit $instcmd $dst &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
else
# If we're going to rename the final executable, determine the name now.
if [ x"$transformarg" = x ]
then
dstfile=`basename $dst`
else
dstfile=`basename $dst $transformbasename |
sed $transformarg`$transformbasename
fi
# don't allow the sed command to completely eliminate the filename
if [ x"$dstfile" = x ]
then
dstfile=`basename $dst`
else
true
fi
# Make a temp file name in the proper directory.
dsttmp=$dstdir/#inst.$$#
# Move or copy the file name to the temp name
$doit $instcmd $src $dsttmp &&
trap "rm -f ${dsttmp}" 0 &&
# and set any options; do chmod last to preserve setuid bits
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
# Now rename the file to the real destination.
$doit $rmcmd -f $dstdir/$dstfile &&
$doit $mvcmd $dsttmp $dstdir/$dstfile
fi &&
exit 0

View File

@@ -119,11 +119,10 @@ bool MyApp::OnInit(void)
MyFrame *frame = new MyFrame((wxFrame *) NULL, (char *) "Controls wxWindows App", 50, 50, 530, 420 ); MyFrame *frame = new MyFrame((wxFrame *) NULL, (char *) "Controls wxWindows App", 50, 50, 530, 420 );
// Give it an icon // Give it an icon
#ifdef __WXMSW__ // The wxICON() macros loads an icon from a resource under Windows
frame->SetIcon(wxIcon("mondrian")); // and uses an #included XPM image under GTK+ and Motif
#else
frame->SetIcon(wxIcon( mondrian_xpm )); frame->SetIcon( wxICON(mondrian) );
#endif
wxMenu *file_menu = new wxMenu; wxMenu *file_menu = new wxMenu;
@@ -270,12 +269,12 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) :
#else #else
wxImageList *imagelist = new wxImageList(32, 32); wxImageList *imagelist = new wxImageList(32, 32);
imagelist-> Add( wxBitmap( list_xpm )); imagelist-> Add( wxBitmap( (const char**) list_xpm ));
imagelist-> Add( wxBitmap( choice_xpm )); imagelist-> Add( wxBitmap( (const char**) choice_xpm ));
imagelist-> Add( wxBitmap( combo_xpm )); imagelist-> Add( wxBitmap( (const char**) combo_xpm ));
imagelist-> Add( wxBitmap( text_xpm )); imagelist-> Add( wxBitmap( (const char**) text_xpm ));
imagelist-> Add( wxBitmap( radio_xpm )); imagelist-> Add( wxBitmap( (const char**) radio_xpm ));
imagelist-> Add( wxBitmap( gauge_xpm )); imagelist-> Add( wxBitmap( (const char**) gauge_xpm ));
#endif #endif
wxButton *button = (wxButton*)NULL; wxButton *button = (wxButton*)NULL;

View File

@@ -101,22 +101,23 @@ install::
$(INSTALL_DATA) $$f $(includedir)/wx/protocol/$$f ; \ $(INSTALL_DATA) $$f $(includedir)/wx/protocol/$$f ; \
done done
@echo " Moving setup.h to library path" @echo " Moving setup.h to library path"
@$(INSTALL) -d $(libdir)/wx/include/wx/gtk ;\ @cd $(WXBASEDIR)/src ; \
$(INSTALL) -d $(libdir)/wx/include/wx/gtk ;\
mv $(includedir)/wx/gtk/setup.h $(libdir)/wx/include/wx/gtk/setup.h ; mv $(includedir)/wx/gtk/setup.h $(libdir)/wx/include/wx/gtk/setup.h ;
@echo " Copying wx-config" @echo " Copying wx-config"
@cd $(WXBASEDIR) ; \ @cd $(WXBASEDIR)/src ; \
$(INSTALL) -d $(bindir) ;\ $(INSTALL) -d $(bindir) ; \
rm -f $(bindir)/wx-config ; \ rm -f $(bindir)/wx-config ; \
$(INSTALL_PROGRAM) wx-config $(bindir)/wx-config $(INSTALL_PROGRAM) $(WXBASEDIR)/wx-config $(bindir)/wx-config
@echo " Copying static library" @echo " Copying static library"
@cd $(WXBASEDIR)/lib/$(OS) ; \ @cd $(WXBASEDIR)/src ; \
rm -f $(libdir)/$(STATIC_LIBRARY) ; \ rm -f $(libdir)/$(STATIC_LIBRARY) ; \
$(INSTALL_DATA) $(STATIC_LIBRARY) $(libdir)/$(STATIC_LIBRARY) $(INSTALL_DATA) $(WXBASEDIR)/lib/$(OS)/$(STATIC_LIBRARY) $(libdir)/$(STATIC_LIBRARY)
@if test -f $(WXBASEDIR)/lib/$(OS)/$(SHARED_LIBRARY) ; then \ @if test -f $(WXBASEDIR)/lib/$(OS)/$(SHARED_LIBRARY) ; then \
echo " Copying shared library" ; \ echo " Copying shared library" ; \
cd $(WXBASEDIR)/lib/$(OS) ; \ @cd $(WXBASEDIR)/src ; \
rm -f $(libdir)/lib$(LIB_TARGET).so* ; \ rm -f $(libdir)/lib$(LIB_TARGET).so* ; \
$(INSTALL_PROGRAM) $(SHARED_LIBRARY) $(libdir)/$(SHARED_LIBRARY) ; \ $(INSTALL_PROGRAM) $(WXBASEDIR)/lib/$(OS)/$(SHARED_LIBRARY) $(libdir)/$(SHARED_LIBRARY) ; \
$(LN_S) $(SHARED_LIBRARY) $(libdir)/lib$(LIB_TARGET).so.$(LIB_MAJOR) ; \ $(LN_S) $(SHARED_LIBRARY) $(libdir)/lib$(LIB_TARGET).so.$(LIB_MAJOR) ; \
$(LN_S) $(SHARED_LIBRARY) $(libdir)/lib$(LIB_TARGET).so ; \ $(LN_S) $(SHARED_LIBRARY) $(libdir)/lib$(LIB_TARGET).so ; \
echo " " ; \ echo " " ; \

View File

@@ -17,17 +17,14 @@
#include "wx/frame.h" #include "wx/frame.h"
#include "wx/menu.h" #include "wx/menu.h"
#include "wx/menuitem.h"
// wxGTK is a special case because it doesn't use the generic wxMenuItem
// class, but it's own (already defined in wx/menu.h) one
#ifndef __WXGTK__ #ifndef __WXGTK__
#include "wx/menuitem.h"
#endif //WXGTK
void wxFrame::OnIdle(wxIdleEvent& WXUNUSED(event) ) void wxFrame::OnIdle(wxIdleEvent& WXUNUSED(event) )
{ {
DoMenuUpdates(); DoMenuUpdates();
} }
#endif
// update all menus // update all menus
void wxFrame::DoMenuUpdates() void wxFrame::DoMenuUpdates()

View File

@@ -2249,7 +2249,7 @@ wxIcon wxResourceCreateIcon(const wxString& resource, wxResourceTable *table)
"Forgot to use wxResourceLoadIconData?"), (const char*) name); "Forgot to use wxResourceLoadIconData?"), (const char*) name);
return (wxIcon *) NULL; return (wxIcon *) NULL;
} }
return wxIcon((char **)item->GetValue1(), (int)item->GetValue2(), (int)item->GetValue3()); return wxIcon((const char **)item->GetValue1(), (int)item->GetValue2(), (int)item->GetValue3());
#else #else
wxLogWarning(_("No XBM facility available!")); wxLogWarning(_("No XBM facility available!"));
#endif #endif

View File

@@ -48,7 +48,6 @@ LIB_CPP_SRC=\
common/framecmn.cpp \ common/framecmn.cpp \
common/stream.cpp \ common/stream.cpp \
common/datstrm.cpp \ common/datstrm.cpp \
common/wfstream.cpp \
common/mstream.cpp \ common/mstream.cpp \
common/zstream.cpp \ common/zstream.cpp \
common/objstrm.cpp \ common/objstrm.cpp \

View File

@@ -117,6 +117,29 @@ wxBitmap::wxBitmap( int width, int height, int depth )
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this); if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
} }
wxBitmap::wxBitmap( const char **bits )
{
wxCHECK_RET( bits != NULL, "invalid bitmap data" )
m_refData = new wxBitmapRefData();
GdkBitmap *mask = (GdkBitmap*) NULL;
GdkWindow *parent = (GdkWindow*) &gdk_root_parent;
M_BMPDATA->m_pixmap = gdk_pixmap_create_from_xpm_d( parent, &mask, NULL, (gchar **) bits );
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 = gdk_window_get_visual( parent )->depth; // ?
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
}
wxBitmap::wxBitmap( char **bits ) wxBitmap::wxBitmap( char **bits )
{ {
wxCHECK_RET( bits != NULL, "invalid bitmap data" ) wxCHECK_RET( bits != NULL, "invalid bitmap data" )

View File

@@ -38,6 +38,24 @@ bool gtk_dialog_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED
return TRUE; return TRUE;
} }
//-----------------------------------------------------------------------------
// "size_allocate"
//-----------------------------------------------------------------------------
static void gtk_dialog_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxDialog *win )
{
if (!win->HasVMT()) return;
/*
printf( "OnDialogResize from " );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
printf( win->GetClassInfo()->GetClassName() );
printf( ".\n" );
*/
win->GtkOnSize( alloc->x, alloc->y, alloc->width, alloc->height );
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxDialog // wxDialog
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -46,6 +64,7 @@ BEGIN_EVENT_TABLE(wxDialog,wxPanel)
EVT_BUTTON (wxID_OK, wxDialog::OnOK) EVT_BUTTON (wxID_OK, wxDialog::OnOK)
EVT_BUTTON (wxID_CANCEL, wxDialog::OnCancel) EVT_BUTTON (wxID_CANCEL, wxDialog::OnCancel)
EVT_BUTTON (wxID_APPLY, wxDialog::OnApply) EVT_BUTTON (wxID_APPLY, wxDialog::OnApply)
EVT_SIZE (wxDialog::OnSize)
EVT_CLOSE (wxDialog::OnCloseWindow) EVT_CLOSE (wxDialog::OnCloseWindow)
END_EVENT_TABLE() END_EVENT_TABLE()
@@ -85,6 +104,9 @@ bool wxDialog::Create( wxWindow *parent,
gtk_signal_connect( GTK_OBJECT(m_widget), "delete_event", gtk_signal_connect( GTK_OBJECT(m_widget), "delete_event",
GTK_SIGNAL_FUNC(gtk_dialog_delete_callback), (gpointer)this ); GTK_SIGNAL_FUNC(gtk_dialog_delete_callback), (gpointer)this );
gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
GTK_SIGNAL_FUNC(gtk_dialog_size_callback), (gpointer)this );
m_wxwindow = gtk_myfixed_new(); m_wxwindow = gtk_myfixed_new();
gtk_widget_show( m_wxwindow ); gtk_widget_show( m_wxwindow );
GTK_WIDGET_UNSET_FLAGS( m_wxwindow, GTK_CAN_FOCUS ); GTK_WIDGET_UNSET_FLAGS( m_wxwindow, GTK_CAN_FOCUS );
@@ -194,6 +216,66 @@ void wxDialog::OnCloseWindow( wxCloseEvent& event )
} }
} }
void wxDialog::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height )
{
// due to a bug in gtk, x,y are always 0
// m_x = x;
// m_y = y;
if ((m_height == height) && (m_width == width) &&
(m_sizeSet)) return;
if (!m_wxwindow) return;
m_width = width;
m_height = height;
if ((m_minWidth != -1) && (m_width < m_minWidth)) m_width = m_minWidth;
if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight;
if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_minWidth;
if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_minHeight;
gtk_widget_set_usize( m_widget, m_width, m_height );
m_sizeSet = TRUE;
wxSizeEvent event( wxSize(m_width,m_height), GetId() );
event.SetEventObject( this );
GetEventHandler()->ProcessEvent( event );
}
void wxDialog::OnSize( wxSizeEvent &WXUNUSED(event) )
{
wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
if (GetAutoLayout())
{
Layout();
}
else
{
// no child: go out !
if (!GetChildren()->First()) return;
// do we have exactly one child?
wxWindow *child = (wxWindow *) NULL;
for(wxNode *node = GetChildren()->First(); node; node = node->Next())
{
wxWindow *win = (wxWindow *)node->Data();
if (!IS_KIND_OF(win,wxFrame) && !IS_KIND_OF(win,wxDialog))
{
// it's the second one: do nothing
if (child) return;
child = win;
}
}
// yes: set it's size to fill all the frame
int client_x, client_y;
GetClientSize( &client_x, &client_y );
child->SetSize( 1, 1, client_x-2, client_y);
}
}
void wxDialog::SetSize( int x, int y, int width, int height, int sizeFlags ) void wxDialog::SetSize( int x, int y, int width, int height, int sizeFlags )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxASSERT_MSG( (m_widget != NULL), "invalid window" );
@@ -254,7 +336,7 @@ void wxDialog::SetSize( int x, int y, int width, int height, int sizeFlags )
wxSizeEvent event( wxSize(m_width,m_height), GetId() ); wxSizeEvent event( wxSize(m_width,m_height), GetId() );
event.SetEventObject( this ); event.SetEventObject( this );
ProcessEvent( event ); GetEventHandler()->ProcessEvent( event );
m_resizing = FALSE; m_resizing = FALSE;
} }

View File

@@ -42,15 +42,20 @@ extern wxList wxPendingDelete;
static void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxFrame *win ) static void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxFrame *win )
{ {
if (!win->HasVMT()) return; if (!win->HasVMT()) return;
/* /*
printf( "OnFrameResize from " ); printf( "OnFrameResize from " );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName()) if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
printf( win->GetClassInfo()->GetClassName() ); printf( win->GetClassInfo()->GetClassName() );
printf( ".\n" ); printf( ".\n" );
*/ */
win->GtkOnSize( alloc->x, alloc->y, alloc->width, alloc->height ); if ((win->m_width != alloc->width) || (win->m_height != alloc->height))
{
win->m_sizeSet = FALSE;
win->m_width = alloc->width;
win->m_height = alloc->height;
}
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -132,6 +137,7 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
if (style & wxSIMPLE_BORDER) win_type = GTK_WINDOW_POPUP; if (style & wxSIMPLE_BORDER) win_type = GTK_WINDOW_POPUP;
m_widget = gtk_window_new( win_type ); m_widget = gtk_window_new( win_type );
if ((size.x != -1) && (size.y != -1)) if ((size.x != -1) && (size.y != -1))
gtk_widget_set_usize( m_widget, m_width, m_height ); gtk_widget_set_usize( m_widget, m_width, m_height );
if ((pos.x != -1) && (pos.y != -1)) if ((pos.x != -1) && (pos.y != -1))
@@ -180,9 +186,11 @@ bool wxFrame::Show( bool show )
if (show) if (show)
{ {
/*
wxSizeEvent event( wxSize(m_width,m_height), GetId() ); wxSizeEvent event( wxSize(m_width,m_height), GetId() );
m_sizeSet = FALSE; m_sizeSet = FALSE;
ProcessEvent( event ); GetEventHandler()->ProcessEvent( event );
*/
} }
return wxWindow::Show( show ); return wxWindow::Show( show );
} }
@@ -279,7 +287,7 @@ void wxFrame::SetSize( int x, int y, int width, int height, int sizeFlags )
wxSizeEvent event( wxSize(m_width,m_height), GetId() ); wxSizeEvent event( wxSize(m_width,m_height), GetId() );
event.SetEventObject( this ); event.SetEventObject( this );
ProcessEvent( event ); GetEventHandler()->ProcessEvent( event );
m_resizing = FALSE; m_resizing = FALSE;
} }
@@ -342,8 +350,9 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
// m_x = x; // m_x = x;
// m_y = y; // m_y = y;
if ((m_height == height) && (m_width == width) && if (m_resizing) return;
(m_sizeSet)) return; m_resizing = TRUE;
if (!m_wxwindow) return; if (!m_wxwindow) return;
m_width = width; m_width = width;
@@ -354,8 +363,8 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_minWidth; if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_minWidth;
if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_minHeight; if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_minHeight;
gtk_widget_set_usize( m_widget, m_width, m_height ); // gtk_widget_set_usize( m_widget, m_width, m_height );
// This emulates the new wxMSW behaviour // This emulates the new wxMSW behaviour
if (m_frameMenuBar) if (m_frameMenuBar)
@@ -390,12 +399,22 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameStatusBar->m_widget, 0, m_height-wxSTATUS_HEIGHT ); gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameStatusBar->m_widget, 0, m_height-wxSTATUS_HEIGHT );
gtk_widget_set_usize( m_frameStatusBar->m_widget, m_width, wxSTATUS_HEIGHT ); gtk_widget_set_usize( m_frameStatusBar->m_widget, m_width, wxSTATUS_HEIGHT );
} }
m_sizeSet = TRUE; m_sizeSet = TRUE;
wxSizeEvent event( wxSize(m_width,m_height), GetId() ); wxSizeEvent event( wxSize(m_width,m_height), GetId() );
event.SetEventObject( this ); event.SetEventObject( this );
ProcessEvent( event ); GetEventHandler()->ProcessEvent( event );
m_resizing = FALSE;
}
void wxFrame::OnIdle(wxIdleEvent& WXUNUSED(event) )
{
if (!m_sizeSet)
GtkOnSize( m_x, m_y, m_width, m_height );
DoMenuUpdates();
} }
void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) ) void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) )

View File

@@ -19,8 +19,13 @@
IMPLEMENT_DYNAMIC_CLASS(wxIcon,wxBitmap) IMPLEMENT_DYNAMIC_CLASS(wxIcon,wxBitmap)
wxIcon::wxIcon( const char **bits, int WXUNUSED(width), int WXUNUSED(height) ) :
wxBitmap( bits )
{
}
wxIcon::wxIcon( char **bits, int WXUNUSED(width), int WXUNUSED(height) ) : wxIcon::wxIcon( char **bits, int WXUNUSED(width), int WXUNUSED(height) ) :
wxBitmap( bits ) wxBitmap( bits )
{ {
} }
@@ -28,20 +33,20 @@ wxIcon::wxIcon() : wxBitmap()
{ {
} }
wxIcon::wxIcon(const wxIcon& icon) : wxBitmap() wxIcon::wxIcon( const wxIcon& icon ) : wxBitmap()
{ {
Ref(icon); Ref(icon);
} }
wxIcon::wxIcon(const wxIcon* icon) : wxBitmap() wxIcon::wxIcon( const wxIcon* icon ) : wxBitmap()
{ {
if (icon) Ref(*icon); if (icon) Ref(*icon);
} }
wxIcon& wxIcon::operator = (const wxIcon& icon) wxIcon& wxIcon::operator = ( const wxIcon& icon )
{ {
if (*this == icon) return (*this); if (*this == icon) return (*this);
Ref(icon); Ref(icon);
return *this; return *this;
} }

View File

@@ -30,6 +30,11 @@
#include <netdb.h> #include <netdb.h>
#include <signal.h> #include <signal.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xresource.h>
#include "gdk/gdkx.h" // GDK_DISPLAY
#ifdef __SVR4__ #ifdef __SVR4__
#include <sys/systeminfo.h> #include <sys/systeminfo.h>
@@ -50,42 +55,45 @@ extern "C"
void wxBell(void) void wxBell(void)
{ {
gdk_beep(); gdk_beep();
}; }
void wxSleep(int nSecs) void wxSleep(int nSecs)
{ {
sleep(nSecs); sleep(nSecs);
}; }
int wxKill(long pid, int sig) int wxKill(long pid, int sig)
{ {
return kill(pid, sig); return kill(pid, sig);
}; }
void wxDisplaySize( int *width, int *height ) void wxDisplaySize( int *width, int *height )
{ {
if (width) *width = gdk_screen_width(); if (width) *width = gdk_screen_width();
if (height) *height = gdk_screen_height(); if (height) *height = gdk_screen_height();
} }
void wxGetMousePosition( int* x, int* y ) void wxGetMousePosition( int* x, int* y )
{ {
wxFAIL_MSG( "GetMousePosition not yet implemented" ); Window dumw;
if (x) *x = 0; int dumi;
if (y) *y = 0; unsigned int dumu;
};
XQueryPointer( GDK_DISPLAY(),GDK_ROOT_WINDOW(),
&dumw,&dumw,x,y,&dumi,&dumi,&dumu );
}
bool wxColourDisplay(void) bool wxColourDisplay(void)
{ {
wxFAIL_MSG( "wxColourDisplay always returns TRUE" ); wxFAIL_MSG( "wxColourDisplay always returns TRUE" );
return TRUE; return TRUE;
} }
int wxDisplayDepth(void) int wxDisplayDepth(void)
{ {
wxFAIL_MSG( "wxDisplayDepth always returns 8" ); wxFAIL_MSG( "wxDisplayDepth always returns 8" );
return 8; return 8;
} }
//------------------------------------------------------------------------ //------------------------------------------------------------------------
@@ -94,34 +102,40 @@ int wxDisplayDepth(void)
const char* wxGetHomeDir( wxString *home ) const char* wxGetHomeDir( wxString *home )
{ {
*home = wxGetUserHome( wxString() ); *home = wxGetUserHome( wxString() );
if (home->IsNull()) *home = "/"; if (home->IsNull()) *home = "/";
return *home; return *home;
}; }
char *wxGetUserHome( const wxString &user ) char *wxGetUserHome( const wxString &user )
{ {
struct passwd *who = (struct passwd *) NULL; struct passwd *who = (struct passwd *) NULL;
if (user.IsNull() || (user== "")) if (user.IsNull() || (user== ""))
{ {
register char *ptr; register char *ptr;
if ((ptr = getenv("HOME")) != NULL) if ((ptr = getenv("HOME")) != NULL)
{
return ptr; return ptr;
if ((ptr = getenv("USER")) != NULL }
|| (ptr = getenv("LOGNAME")) != NULL) { if ((ptr = getenv("USER")) != NULL || (ptr = getenv("LOGNAME")) != NULL)
{
who = getpwnam(ptr); who = getpwnam(ptr);
} }
// We now make sure the the user exists! // We now make sure the the user exists!
if (who == NULL) if (who == NULL)
{
who = getpwuid(getuid()); who = getpwuid(getuid());
} }
else }
who = getpwnam (user); else
{
who = getpwnam (user);
}
return who ? who->pw_dir : (char*)NULL; return who ? who->pw_dir : (char*)NULL;
}; }
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// id routines // id routines
@@ -147,15 +161,15 @@ bool wxGetHostName(char *buf, int sz)
// strncpy(buf, (h=gethostbyname(name))!=NULL ? h->h_name : name, sz-1); // strncpy(buf, (h=gethostbyname(name))!=NULL ? h->h_name : name, sz-1);
if((unsigned)sz > strlen(name)+strlen(domain)+1) if((unsigned)sz > strlen(name)+strlen(domain)+1)
{ {
strcpy(buf, name); strcpy(buf, name);
if(strcmp(domain,"(none)") == 0) // standalone machine if(strcmp(domain,"(none)") == 0) // standalone machine
{ {
strcat(buf,"."); strcat(buf,".");
strcat(buf,domain); strcat(buf,domain);
} }
} }
else else
return FALSE; return FALSE;
return TRUE; return TRUE;
#endif #endif
} }
@@ -223,10 +237,10 @@ void wxFatalError( const wxString &msg, const wxString &title )
bool wxDirExists( const wxString& dir ) bool wxDirExists( const wxString& dir )
{ {
char buf[500]; char buf[500];
strcpy( buf, WXSTRINGCAST(dir) ); strcpy( buf, WXSTRINGCAST(dir) );
struct stat sbuf; struct stat sbuf;
return ((stat(buf, &sbuf) != -1) && S_ISDIR(sbuf.st_mode) ? TRUE : FALSE); return ((stat(buf, &sbuf) != -1) && S_ISDIR(sbuf.st_mode) ? TRUE : FALSE);
}; };
//------------------------------------------------------------------------ //------------------------------------------------------------------------

View File

@@ -103,10 +103,6 @@ gtk_myfixed_init (GtkMyFixed *myfixed)
{ {
GTK_WIDGET_UNSET_FLAGS (myfixed, GTK_NO_WINDOW); GTK_WIDGET_UNSET_FLAGS (myfixed, GTK_NO_WINDOW);
GTK_WIDGET_SET_FLAGS (myfixed, GTK_BASIC); GTK_WIDGET_SET_FLAGS (myfixed, GTK_BASIC);
#if (GTK_MINOR_VERSION == 1)
gtk_container_set_resize_mode( GTK_CONTAINER(myfixed), GTK_RESIZE_PARENT );
#endif
myfixed->children = NULL; myfixed->children = NULL;
} }
@@ -173,7 +169,7 @@ gtk_myfixed_move (GtkMyFixed *myfixed,
if (child->widget == widget) if (child->widget == widget)
{ {
if ((child->x == x) && (child->y == y)) return; /* if ((child->x == x) && (child->y == y)) return; */
child->x = x; child->x = x;
child->y = y; child->y = y;

View File

@@ -117,6 +117,29 @@ wxBitmap::wxBitmap( int width, int height, int depth )
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this); if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
} }
wxBitmap::wxBitmap( const char **bits )
{
wxCHECK_RET( bits != NULL, "invalid bitmap data" )
m_refData = new wxBitmapRefData();
GdkBitmap *mask = (GdkBitmap*) NULL;
GdkWindow *parent = (GdkWindow*) &gdk_root_parent;
M_BMPDATA->m_pixmap = gdk_pixmap_create_from_xpm_d( parent, &mask, NULL, (gchar **) bits );
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 = gdk_window_get_visual( parent )->depth; // ?
if (wxTheBitmapList) wxTheBitmapList->AddBitmap(this);
}
wxBitmap::wxBitmap( char **bits ) wxBitmap::wxBitmap( char **bits )
{ {
wxCHECK_RET( bits != NULL, "invalid bitmap data" ) wxCHECK_RET( bits != NULL, "invalid bitmap data" )

View File

@@ -38,6 +38,24 @@ bool gtk_dialog_delete_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSED
return TRUE; return TRUE;
} }
//-----------------------------------------------------------------------------
// "size_allocate"
//-----------------------------------------------------------------------------
static void gtk_dialog_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxDialog *win )
{
if (!win->HasVMT()) return;
/*
printf( "OnDialogResize from " );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
printf( win->GetClassInfo()->GetClassName() );
printf( ".\n" );
*/
win->GtkOnSize( alloc->x, alloc->y, alloc->width, alloc->height );
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxDialog // wxDialog
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -46,6 +64,7 @@ BEGIN_EVENT_TABLE(wxDialog,wxPanel)
EVT_BUTTON (wxID_OK, wxDialog::OnOK) EVT_BUTTON (wxID_OK, wxDialog::OnOK)
EVT_BUTTON (wxID_CANCEL, wxDialog::OnCancel) EVT_BUTTON (wxID_CANCEL, wxDialog::OnCancel)
EVT_BUTTON (wxID_APPLY, wxDialog::OnApply) EVT_BUTTON (wxID_APPLY, wxDialog::OnApply)
EVT_SIZE (wxDialog::OnSize)
EVT_CLOSE (wxDialog::OnCloseWindow) EVT_CLOSE (wxDialog::OnCloseWindow)
END_EVENT_TABLE() END_EVENT_TABLE()
@@ -85,6 +104,9 @@ bool wxDialog::Create( wxWindow *parent,
gtk_signal_connect( GTK_OBJECT(m_widget), "delete_event", gtk_signal_connect( GTK_OBJECT(m_widget), "delete_event",
GTK_SIGNAL_FUNC(gtk_dialog_delete_callback), (gpointer)this ); GTK_SIGNAL_FUNC(gtk_dialog_delete_callback), (gpointer)this );
gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
GTK_SIGNAL_FUNC(gtk_dialog_size_callback), (gpointer)this );
m_wxwindow = gtk_myfixed_new(); m_wxwindow = gtk_myfixed_new();
gtk_widget_show( m_wxwindow ); gtk_widget_show( m_wxwindow );
GTK_WIDGET_UNSET_FLAGS( m_wxwindow, GTK_CAN_FOCUS ); GTK_WIDGET_UNSET_FLAGS( m_wxwindow, GTK_CAN_FOCUS );
@@ -194,6 +216,66 @@ void wxDialog::OnCloseWindow( wxCloseEvent& event )
} }
} }
void wxDialog::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height )
{
// due to a bug in gtk, x,y are always 0
// m_x = x;
// m_y = y;
if ((m_height == height) && (m_width == width) &&
(m_sizeSet)) return;
if (!m_wxwindow) return;
m_width = width;
m_height = height;
if ((m_minWidth != -1) && (m_width < m_minWidth)) m_width = m_minWidth;
if ((m_minHeight != -1) && (m_height < m_minHeight)) m_height = m_minHeight;
if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_minWidth;
if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_minHeight;
gtk_widget_set_usize( m_widget, m_width, m_height );
m_sizeSet = TRUE;
wxSizeEvent event( wxSize(m_width,m_height), GetId() );
event.SetEventObject( this );
GetEventHandler()->ProcessEvent( event );
}
void wxDialog::OnSize( wxSizeEvent &WXUNUSED(event) )
{
wxASSERT_MSG( (m_widget != NULL), "invalid frame" );
if (GetAutoLayout())
{
Layout();
}
else
{
// no child: go out !
if (!GetChildren()->First()) return;
// do we have exactly one child?
wxWindow *child = (wxWindow *) NULL;
for(wxNode *node = GetChildren()->First(); node; node = node->Next())
{
wxWindow *win = (wxWindow *)node->Data();
if (!IS_KIND_OF(win,wxFrame) && !IS_KIND_OF(win,wxDialog))
{
// it's the second one: do nothing
if (child) return;
child = win;
}
}
// yes: set it's size to fill all the frame
int client_x, client_y;
GetClientSize( &client_x, &client_y );
child->SetSize( 1, 1, client_x-2, client_y);
}
}
void wxDialog::SetSize( int x, int y, int width, int height, int sizeFlags ) void wxDialog::SetSize( int x, int y, int width, int height, int sizeFlags )
{ {
wxASSERT_MSG( (m_widget != NULL), "invalid window" ); wxASSERT_MSG( (m_widget != NULL), "invalid window" );
@@ -254,7 +336,7 @@ void wxDialog::SetSize( int x, int y, int width, int height, int sizeFlags )
wxSizeEvent event( wxSize(m_width,m_height), GetId() ); wxSizeEvent event( wxSize(m_width,m_height), GetId() );
event.SetEventObject( this ); event.SetEventObject( this );
ProcessEvent( event ); GetEventHandler()->ProcessEvent( event );
m_resizing = FALSE; m_resizing = FALSE;
} }

View File

@@ -42,15 +42,20 @@ extern wxList wxPendingDelete;
static void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxFrame *win ) static void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxFrame *win )
{ {
if (!win->HasVMT()) return; if (!win->HasVMT()) return;
/* /*
printf( "OnFrameResize from " ); printf( "OnFrameResize from " );
if (win->GetClassInfo() && win->GetClassInfo()->GetClassName()) if (win->GetClassInfo() && win->GetClassInfo()->GetClassName())
printf( win->GetClassInfo()->GetClassName() ); printf( win->GetClassInfo()->GetClassName() );
printf( ".\n" ); printf( ".\n" );
*/ */
win->GtkOnSize( alloc->x, alloc->y, alloc->width, alloc->height ); if ((win->m_width != alloc->width) || (win->m_height != alloc->height))
{
win->m_sizeSet = FALSE;
win->m_width = alloc->width;
win->m_height = alloc->height;
}
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -132,6 +137,7 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
if (style & wxSIMPLE_BORDER) win_type = GTK_WINDOW_POPUP; if (style & wxSIMPLE_BORDER) win_type = GTK_WINDOW_POPUP;
m_widget = gtk_window_new( win_type ); m_widget = gtk_window_new( win_type );
if ((size.x != -1) && (size.y != -1)) if ((size.x != -1) && (size.y != -1))
gtk_widget_set_usize( m_widget, m_width, m_height ); gtk_widget_set_usize( m_widget, m_width, m_height );
if ((pos.x != -1) && (pos.y != -1)) if ((pos.x != -1) && (pos.y != -1))
@@ -180,9 +186,11 @@ bool wxFrame::Show( bool show )
if (show) if (show)
{ {
/*
wxSizeEvent event( wxSize(m_width,m_height), GetId() ); wxSizeEvent event( wxSize(m_width,m_height), GetId() );
m_sizeSet = FALSE; m_sizeSet = FALSE;
ProcessEvent( event ); GetEventHandler()->ProcessEvent( event );
*/
} }
return wxWindow::Show( show ); return wxWindow::Show( show );
} }
@@ -279,7 +287,7 @@ void wxFrame::SetSize( int x, int y, int width, int height, int sizeFlags )
wxSizeEvent event( wxSize(m_width,m_height), GetId() ); wxSizeEvent event( wxSize(m_width,m_height), GetId() );
event.SetEventObject( this ); event.SetEventObject( this );
ProcessEvent( event ); GetEventHandler()->ProcessEvent( event );
m_resizing = FALSE; m_resizing = FALSE;
} }
@@ -342,8 +350,9 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
// m_x = x; // m_x = x;
// m_y = y; // m_y = y;
if ((m_height == height) && (m_width == width) && if (m_resizing) return;
(m_sizeSet)) return; m_resizing = TRUE;
if (!m_wxwindow) return; if (!m_wxwindow) return;
m_width = width; m_width = width;
@@ -354,8 +363,8 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_minWidth; if ((m_maxWidth != -1) && (m_width > m_maxWidth)) m_width = m_minWidth;
if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_minHeight; if ((m_maxHeight != -1) && (m_height > m_maxHeight)) m_height = m_minHeight;
gtk_widget_set_usize( m_widget, m_width, m_height ); // gtk_widget_set_usize( m_widget, m_width, m_height );
// This emulates the new wxMSW behaviour // This emulates the new wxMSW behaviour
if (m_frameMenuBar) if (m_frameMenuBar)
@@ -390,12 +399,22 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameStatusBar->m_widget, 0, m_height-wxSTATUS_HEIGHT ); gtk_myfixed_move( GTK_MYFIXED(m_wxwindow), m_frameStatusBar->m_widget, 0, m_height-wxSTATUS_HEIGHT );
gtk_widget_set_usize( m_frameStatusBar->m_widget, m_width, wxSTATUS_HEIGHT ); gtk_widget_set_usize( m_frameStatusBar->m_widget, m_width, wxSTATUS_HEIGHT );
} }
m_sizeSet = TRUE; m_sizeSet = TRUE;
wxSizeEvent event( wxSize(m_width,m_height), GetId() ); wxSizeEvent event( wxSize(m_width,m_height), GetId() );
event.SetEventObject( this ); event.SetEventObject( this );
ProcessEvent( event ); GetEventHandler()->ProcessEvent( event );
m_resizing = FALSE;
}
void wxFrame::OnIdle(wxIdleEvent& WXUNUSED(event) )
{
if (!m_sizeSet)
GtkOnSize( m_x, m_y, m_width, m_height );
DoMenuUpdates();
} }
void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) ) void wxFrame::OnSize( wxSizeEvent &WXUNUSED(event) )

View File

@@ -19,8 +19,13 @@
IMPLEMENT_DYNAMIC_CLASS(wxIcon,wxBitmap) IMPLEMENT_DYNAMIC_CLASS(wxIcon,wxBitmap)
wxIcon::wxIcon( const char **bits, int WXUNUSED(width), int WXUNUSED(height) ) :
wxBitmap( bits )
{
}
wxIcon::wxIcon( char **bits, int WXUNUSED(width), int WXUNUSED(height) ) : wxIcon::wxIcon( char **bits, int WXUNUSED(width), int WXUNUSED(height) ) :
wxBitmap( bits ) wxBitmap( bits )
{ {
} }
@@ -28,20 +33,20 @@ wxIcon::wxIcon() : wxBitmap()
{ {
} }
wxIcon::wxIcon(const wxIcon& icon) : wxBitmap() wxIcon::wxIcon( const wxIcon& icon ) : wxBitmap()
{ {
Ref(icon); Ref(icon);
} }
wxIcon::wxIcon(const wxIcon* icon) : wxBitmap() wxIcon::wxIcon( const wxIcon* icon ) : wxBitmap()
{ {
if (icon) Ref(*icon); if (icon) Ref(*icon);
} }
wxIcon& wxIcon::operator = (const wxIcon& icon) wxIcon& wxIcon::operator = ( const wxIcon& icon )
{ {
if (*this == icon) return (*this); if (*this == icon) return (*this);
Ref(icon); Ref(icon);
return *this; return *this;
} }

View File

@@ -30,6 +30,11 @@
#include <netdb.h> #include <netdb.h>
#include <signal.h> #include <signal.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xresource.h>
#include "gdk/gdkx.h" // GDK_DISPLAY
#ifdef __SVR4__ #ifdef __SVR4__
#include <sys/systeminfo.h> #include <sys/systeminfo.h>
@@ -50,42 +55,45 @@ extern "C"
void wxBell(void) void wxBell(void)
{ {
gdk_beep(); gdk_beep();
}; }
void wxSleep(int nSecs) void wxSleep(int nSecs)
{ {
sleep(nSecs); sleep(nSecs);
}; }
int wxKill(long pid, int sig) int wxKill(long pid, int sig)
{ {
return kill(pid, sig); return kill(pid, sig);
}; }
void wxDisplaySize( int *width, int *height ) void wxDisplaySize( int *width, int *height )
{ {
if (width) *width = gdk_screen_width(); if (width) *width = gdk_screen_width();
if (height) *height = gdk_screen_height(); if (height) *height = gdk_screen_height();
} }
void wxGetMousePosition( int* x, int* y ) void wxGetMousePosition( int* x, int* y )
{ {
wxFAIL_MSG( "GetMousePosition not yet implemented" ); Window dumw;
if (x) *x = 0; int dumi;
if (y) *y = 0; unsigned int dumu;
};
XQueryPointer( GDK_DISPLAY(),GDK_ROOT_WINDOW(),
&dumw,&dumw,x,y,&dumi,&dumi,&dumu );
}
bool wxColourDisplay(void) bool wxColourDisplay(void)
{ {
wxFAIL_MSG( "wxColourDisplay always returns TRUE" ); wxFAIL_MSG( "wxColourDisplay always returns TRUE" );
return TRUE; return TRUE;
} }
int wxDisplayDepth(void) int wxDisplayDepth(void)
{ {
wxFAIL_MSG( "wxDisplayDepth always returns 8" ); wxFAIL_MSG( "wxDisplayDepth always returns 8" );
return 8; return 8;
} }
//------------------------------------------------------------------------ //------------------------------------------------------------------------
@@ -94,34 +102,40 @@ int wxDisplayDepth(void)
const char* wxGetHomeDir( wxString *home ) const char* wxGetHomeDir( wxString *home )
{ {
*home = wxGetUserHome( wxString() ); *home = wxGetUserHome( wxString() );
if (home->IsNull()) *home = "/"; if (home->IsNull()) *home = "/";
return *home; return *home;
}; }
char *wxGetUserHome( const wxString &user ) char *wxGetUserHome( const wxString &user )
{ {
struct passwd *who = (struct passwd *) NULL; struct passwd *who = (struct passwd *) NULL;
if (user.IsNull() || (user== "")) if (user.IsNull() || (user== ""))
{ {
register char *ptr; register char *ptr;
if ((ptr = getenv("HOME")) != NULL) if ((ptr = getenv("HOME")) != NULL)
{
return ptr; return ptr;
if ((ptr = getenv("USER")) != NULL }
|| (ptr = getenv("LOGNAME")) != NULL) { if ((ptr = getenv("USER")) != NULL || (ptr = getenv("LOGNAME")) != NULL)
{
who = getpwnam(ptr); who = getpwnam(ptr);
} }
// We now make sure the the user exists! // We now make sure the the user exists!
if (who == NULL) if (who == NULL)
{
who = getpwuid(getuid()); who = getpwuid(getuid());
} }
else }
who = getpwnam (user); else
{
who = getpwnam (user);
}
return who ? who->pw_dir : (char*)NULL; return who ? who->pw_dir : (char*)NULL;
}; }
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// id routines // id routines
@@ -147,15 +161,15 @@ bool wxGetHostName(char *buf, int sz)
// strncpy(buf, (h=gethostbyname(name))!=NULL ? h->h_name : name, sz-1); // strncpy(buf, (h=gethostbyname(name))!=NULL ? h->h_name : name, sz-1);
if((unsigned)sz > strlen(name)+strlen(domain)+1) if((unsigned)sz > strlen(name)+strlen(domain)+1)
{ {
strcpy(buf, name); strcpy(buf, name);
if(strcmp(domain,"(none)") == 0) // standalone machine if(strcmp(domain,"(none)") == 0) // standalone machine
{ {
strcat(buf,"."); strcat(buf,".");
strcat(buf,domain); strcat(buf,domain);
} }
} }
else else
return FALSE; return FALSE;
return TRUE; return TRUE;
#endif #endif
} }
@@ -223,10 +237,10 @@ void wxFatalError( const wxString &msg, const wxString &title )
bool wxDirExists( const wxString& dir ) bool wxDirExists( const wxString& dir )
{ {
char buf[500]; char buf[500];
strcpy( buf, WXSTRINGCAST(dir) ); strcpy( buf, WXSTRINGCAST(dir) );
struct stat sbuf; struct stat sbuf;
return ((stat(buf, &sbuf) != -1) && S_ISDIR(sbuf.st_mode) ? TRUE : FALSE); return ((stat(buf, &sbuf) != -1) && S_ISDIR(sbuf.st_mode) ? TRUE : FALSE);
}; };
//------------------------------------------------------------------------ //------------------------------------------------------------------------

View File

@@ -103,10 +103,6 @@ gtk_myfixed_init (GtkMyFixed *myfixed)
{ {
GTK_WIDGET_UNSET_FLAGS (myfixed, GTK_NO_WINDOW); GTK_WIDGET_UNSET_FLAGS (myfixed, GTK_NO_WINDOW);
GTK_WIDGET_SET_FLAGS (myfixed, GTK_BASIC); GTK_WIDGET_SET_FLAGS (myfixed, GTK_BASIC);
#if (GTK_MINOR_VERSION == 1)
gtk_container_set_resize_mode( GTK_CONTAINER(myfixed), GTK_RESIZE_PARENT );
#endif
myfixed->children = NULL; myfixed->children = NULL;
} }
@@ -173,7 +169,7 @@ gtk_myfixed_move (GtkMyFixed *myfixed,
if (child->widget == widget) if (child->widget == widget)
{ {
if ((child->x == x) && (child->y == y)) return; /* if ((child->x == x) && (child->y == y)) return; */
child->x = x; child->x = x;
child->y = y; child->y = y;