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
# define wxICON(X) wxIcon("" #X "")
#elif defined(__WXGTK__)
#elif defined(__WXGTK__) || defined(__WXMOTIF__)
// Initialize from an included XPM
# define wxICON(X) wxIcon(X##_xpm)
# define wxICON(X) wxIcon( (const char**) X##_xpm )
#else
// This will usually mean something on any platform

View File

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

View File

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

View File

@@ -36,8 +36,9 @@ class wxIcon: public wxBitmap
public:
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& operator = (const wxIcon& icon);

View File

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

View File

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

View File

@@ -36,8 +36,9 @@ class wxIcon: public wxBitmap
public:
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& 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 );
// Give it an icon
#ifdef __WXMSW__
frame->SetIcon(wxIcon("mondrian"));
#else
frame->SetIcon(wxIcon( mondrian_xpm ));
#endif
// The wxICON() macros loads an icon from a resource under Windows
// and uses an #included XPM image under GTK+ and Motif
frame->SetIcon( wxICON(mondrian) );
wxMenu *file_menu = new wxMenu;
@@ -270,12 +269,12 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) :
#else
wxImageList *imagelist = new wxImageList(32, 32);
imagelist-> Add( wxBitmap( list_xpm ));
imagelist-> Add( wxBitmap( choice_xpm ));
imagelist-> Add( wxBitmap( combo_xpm ));
imagelist-> Add( wxBitmap( text_xpm ));
imagelist-> Add( wxBitmap( radio_xpm ));
imagelist-> Add( wxBitmap( gauge_xpm ));
imagelist-> Add( wxBitmap( (const char**) list_xpm ));
imagelist-> Add( wxBitmap( (const char**) choice_xpm ));
imagelist-> Add( wxBitmap( (const char**) combo_xpm ));
imagelist-> Add( wxBitmap( (const char**) text_xpm ));
imagelist-> Add( wxBitmap( (const char**) radio_xpm ));
imagelist-> Add( wxBitmap( (const char**) gauge_xpm ));
#endif
wxButton *button = (wxButton*)NULL;

View File

@@ -101,22 +101,23 @@ install::
$(INSTALL_DATA) $$f $(includedir)/wx/protocol/$$f ; \
done
@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 ;
@echo " Copying wx-config"
@cd $(WXBASEDIR) ; \
$(INSTALL) -d $(bindir) ;\
@cd $(WXBASEDIR)/src ; \
$(INSTALL) -d $(bindir) ; \
rm -f $(bindir)/wx-config ; \
$(INSTALL_PROGRAM) wx-config $(bindir)/wx-config
$(INSTALL_PROGRAM) $(WXBASEDIR)/wx-config $(bindir)/wx-config
@echo " Copying static library"
@cd $(WXBASEDIR)/lib/$(OS) ; \
@cd $(WXBASEDIR)/src ; \
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 \
echo " Copying shared library" ; \
cd $(WXBASEDIR)/lib/$(OS) ; \
@cd $(WXBASEDIR)/src ; \
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 ; \
echo " " ; \

View File

@@ -17,17 +17,14 @@
#include "wx/frame.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__
#include "wx/menuitem.h"
#endif //WXGTK
void wxFrame::OnIdle(wxIdleEvent& WXUNUSED(event) )
{
DoMenuUpdates();
}
#endif
// update all menus
void wxFrame::DoMenuUpdates()

View File

@@ -2249,7 +2249,7 @@ wxIcon wxResourceCreateIcon(const wxString& resource, wxResourceTable *table)
"Forgot to use wxResourceLoadIconData?"), (const char*) name);
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
wxLogWarning(_("No XBM facility available!"));
#endif

View File

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

View File

@@ -117,6 +117,29 @@ wxBitmap::wxBitmap( int width, int height, int depth )
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 )
{
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;
}
//-----------------------------------------------------------------------------
// "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
//-----------------------------------------------------------------------------
@@ -46,6 +64,7 @@ BEGIN_EVENT_TABLE(wxDialog,wxPanel)
EVT_BUTTON (wxID_OK, wxDialog::OnOK)
EVT_BUTTON (wxID_CANCEL, wxDialog::OnCancel)
EVT_BUTTON (wxID_APPLY, wxDialog::OnApply)
EVT_SIZE (wxDialog::OnSize)
EVT_CLOSE (wxDialog::OnCloseWindow)
END_EVENT_TABLE()
@@ -85,6 +104,9 @@ bool wxDialog::Create( wxWindow *parent,
gtk_signal_connect( GTK_OBJECT(m_widget), "delete_event",
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();
gtk_widget_show( m_wxwindow );
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 )
{
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() );
event.SetEventObject( this );
ProcessEvent( event );
GetEventHandler()->ProcessEvent( event );
m_resizing = FALSE;
}

View File

@@ -50,7 +50,12 @@ static void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation*
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;
m_widget = gtk_window_new( win_type );
if ((size.x != -1) && (size.y != -1))
gtk_widget_set_usize( m_widget, m_width, m_height );
if ((pos.x != -1) && (pos.y != -1))
@@ -180,9 +186,11 @@ bool wxFrame::Show( bool show )
if (show)
{
/*
wxSizeEvent event( wxSize(m_width,m_height), GetId() );
m_sizeSet = FALSE;
ProcessEvent( event );
GetEventHandler()->ProcessEvent( event );
*/
}
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() );
event.SetEventObject( this );
ProcessEvent( event );
GetEventHandler()->ProcessEvent( event );
m_resizing = FALSE;
}
@@ -342,8 +350,9 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
// m_x = x;
// m_y = y;
if ((m_height == height) && (m_width == width) &&
(m_sizeSet)) return;
if (m_resizing) return;
m_resizing = TRUE;
if (!m_wxwindow) return;
m_width = width;
@@ -354,7 +363,7 @@ 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_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
@@ -395,7 +404,17 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
wxSizeEvent event( wxSize(m_width,m_height), GetId() );
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) )

View File

@@ -19,6 +19,11 @@
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) ) :
wxBitmap( bits )
{
@@ -28,17 +33,17 @@ wxIcon::wxIcon() : wxBitmap()
{
}
wxIcon::wxIcon(const wxIcon& icon) : wxBitmap()
wxIcon::wxIcon( const wxIcon& icon ) : wxBitmap()
{
Ref(icon);
}
wxIcon::wxIcon(const wxIcon* icon) : wxBitmap()
wxIcon::wxIcon( const wxIcon* icon ) : wxBitmap()
{
if (icon) Ref(*icon);
}
wxIcon& wxIcon::operator = (const wxIcon& icon)
wxIcon& wxIcon::operator = ( const wxIcon& icon )
{
if (*this == icon) return (*this);
Ref(icon);

View File

@@ -30,6 +30,11 @@
#include <netdb.h>
#include <signal.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xresource.h>
#include "gdk/gdkx.h" // GDK_DISPLAY
#ifdef __SVR4__
#include <sys/systeminfo.h>
@@ -51,17 +56,17 @@ extern "C"
void wxBell(void)
{
gdk_beep();
};
}
void wxSleep(int nSecs)
{
sleep(nSecs);
};
}
int wxKill(long pid, int sig)
{
return kill(pid, sig);
};
}
void wxDisplaySize( int *width, int *height )
{
@@ -71,10 +76,13 @@ void wxDisplaySize( int *width, int *height )
void wxGetMousePosition( int* x, int* y )
{
wxFAIL_MSG( "GetMousePosition not yet implemented" );
if (x) *x = 0;
if (y) *y = 0;
};
Window dumw;
int dumi;
unsigned int dumu;
XQueryPointer( GDK_DISPLAY(),GDK_ROOT_WINDOW(),
&dumw,&dumw,x,y,&dumi,&dumi,&dumu );
}
bool wxColourDisplay(void)
{
@@ -97,7 +105,7 @@ const char* wxGetHomeDir( wxString *home )
*home = wxGetUserHome( wxString() );
if (home->IsNull()) *home = "/";
return *home;
};
}
char *wxGetUserHome( const wxString &user )
{
@@ -108,20 +116,26 @@ char *wxGetUserHome( const wxString &user )
register char *ptr;
if ((ptr = getenv("HOME")) != NULL)
{
return ptr;
if ((ptr = getenv("USER")) != NULL
|| (ptr = getenv("LOGNAME")) != NULL) {
}
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

View File

@@ -104,10 +104,6 @@ gtk_myfixed_init (GtkMyFixed *myfixed)
GTK_WIDGET_UNSET_FLAGS (myfixed, GTK_NO_WINDOW);
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;
}
@@ -173,7 +169,7 @@ gtk_myfixed_move (GtkMyFixed *myfixed,
if (child->widget == widget)
{
if ((child->x == x) && (child->y == y)) return;
/* if ((child->x == x) && (child->y == y)) return; */
child->x = x;
child->y = y;

View File

@@ -117,6 +117,29 @@ wxBitmap::wxBitmap( int width, int height, int depth )
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 )
{
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;
}
//-----------------------------------------------------------------------------
// "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
//-----------------------------------------------------------------------------
@@ -46,6 +64,7 @@ BEGIN_EVENT_TABLE(wxDialog,wxPanel)
EVT_BUTTON (wxID_OK, wxDialog::OnOK)
EVT_BUTTON (wxID_CANCEL, wxDialog::OnCancel)
EVT_BUTTON (wxID_APPLY, wxDialog::OnApply)
EVT_SIZE (wxDialog::OnSize)
EVT_CLOSE (wxDialog::OnCloseWindow)
END_EVENT_TABLE()
@@ -85,6 +104,9 @@ bool wxDialog::Create( wxWindow *parent,
gtk_signal_connect( GTK_OBJECT(m_widget), "delete_event",
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();
gtk_widget_show( m_wxwindow );
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 )
{
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() );
event.SetEventObject( this );
ProcessEvent( event );
GetEventHandler()->ProcessEvent( event );
m_resizing = FALSE;
}

View File

@@ -50,7 +50,12 @@ static void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation*
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;
m_widget = gtk_window_new( win_type );
if ((size.x != -1) && (size.y != -1))
gtk_widget_set_usize( m_widget, m_width, m_height );
if ((pos.x != -1) && (pos.y != -1))
@@ -180,9 +186,11 @@ bool wxFrame::Show( bool show )
if (show)
{
/*
wxSizeEvent event( wxSize(m_width,m_height), GetId() );
m_sizeSet = FALSE;
ProcessEvent( event );
GetEventHandler()->ProcessEvent( event );
*/
}
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() );
event.SetEventObject( this );
ProcessEvent( event );
GetEventHandler()->ProcessEvent( event );
m_resizing = FALSE;
}
@@ -342,8 +350,9 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
// m_x = x;
// m_y = y;
if ((m_height == height) && (m_width == width) &&
(m_sizeSet)) return;
if (m_resizing) return;
m_resizing = TRUE;
if (!m_wxwindow) return;
m_width = width;
@@ -354,7 +363,7 @@ 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_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
@@ -395,7 +404,17 @@ void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height
wxSizeEvent event( wxSize(m_width,m_height), GetId() );
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) )

View File

@@ -19,6 +19,11 @@
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) ) :
wxBitmap( bits )
{
@@ -28,17 +33,17 @@ wxIcon::wxIcon() : wxBitmap()
{
}
wxIcon::wxIcon(const wxIcon& icon) : wxBitmap()
wxIcon::wxIcon( const wxIcon& icon ) : wxBitmap()
{
Ref(icon);
}
wxIcon::wxIcon(const wxIcon* icon) : wxBitmap()
wxIcon::wxIcon( const wxIcon* icon ) : wxBitmap()
{
if (icon) Ref(*icon);
}
wxIcon& wxIcon::operator = (const wxIcon& icon)
wxIcon& wxIcon::operator = ( const wxIcon& icon )
{
if (*this == icon) return (*this);
Ref(icon);

View File

@@ -30,6 +30,11 @@
#include <netdb.h>
#include <signal.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xresource.h>
#include "gdk/gdkx.h" // GDK_DISPLAY
#ifdef __SVR4__
#include <sys/systeminfo.h>
@@ -51,17 +56,17 @@ extern "C"
void wxBell(void)
{
gdk_beep();
};
}
void wxSleep(int nSecs)
{
sleep(nSecs);
};
}
int wxKill(long pid, int sig)
{
return kill(pid, sig);
};
}
void wxDisplaySize( int *width, int *height )
{
@@ -71,10 +76,13 @@ void wxDisplaySize( int *width, int *height )
void wxGetMousePosition( int* x, int* y )
{
wxFAIL_MSG( "GetMousePosition not yet implemented" );
if (x) *x = 0;
if (y) *y = 0;
};
Window dumw;
int dumi;
unsigned int dumu;
XQueryPointer( GDK_DISPLAY(),GDK_ROOT_WINDOW(),
&dumw,&dumw,x,y,&dumi,&dumi,&dumu );
}
bool wxColourDisplay(void)
{
@@ -97,7 +105,7 @@ const char* wxGetHomeDir( wxString *home )
*home = wxGetUserHome( wxString() );
if (home->IsNull()) *home = "/";
return *home;
};
}
char *wxGetUserHome( const wxString &user )
{
@@ -108,20 +116,26 @@ char *wxGetUserHome( const wxString &user )
register char *ptr;
if ((ptr = getenv("HOME")) != NULL)
{
return ptr;
if ((ptr = getenv("USER")) != NULL
|| (ptr = getenv("LOGNAME")) != NULL) {
}
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

View File

@@ -104,10 +104,6 @@ gtk_myfixed_init (GtkMyFixed *myfixed)
GTK_WIDGET_UNSET_FLAGS (myfixed, GTK_NO_WINDOW);
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;
}
@@ -173,7 +169,7 @@ gtk_myfixed_move (GtkMyFixed *myfixed,
if (child->widget == widget)
{
if ((child->x == x) && (child->y == y)) return;
/* if ((child->x == x) && (child->y == y)) return; */
child->x = x;
child->y = y;