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:
@@ -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 " " ; \
|
||||
|
@@ -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()
|
||||
|
@@ -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
|
||||
|
@@ -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 \
|
||||
|
@@ -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" )
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -42,15 +42,20 @@ extern wxList wxPendingDelete;
|
||||
static 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->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,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_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
|
||||
|
||||
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_widget_set_usize( m_frameStatusBar->m_widget, m_width, wxSTATUS_HEIGHT );
|
||||
}
|
||||
|
||||
|
||||
m_sizeSet = TRUE;
|
||||
|
||||
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) )
|
||||
|
@@ -19,8 +19,13 @@
|
||||
|
||||
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 )
|
||||
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);
|
||||
Ref(icon);
|
||||
return *this;
|
||||
if (*this == icon) return (*this);
|
||||
Ref(icon);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@@ -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>
|
||||
@@ -50,42 +55,45 @@ extern "C"
|
||||
|
||||
void wxBell(void)
|
||||
{
|
||||
gdk_beep();
|
||||
};
|
||||
gdk_beep();
|
||||
}
|
||||
|
||||
void wxSleep(int nSecs)
|
||||
{
|
||||
sleep(nSecs);
|
||||
};
|
||||
sleep(nSecs);
|
||||
}
|
||||
|
||||
int wxKill(long pid, int sig)
|
||||
{
|
||||
return kill(pid, sig);
|
||||
};
|
||||
return kill(pid, sig);
|
||||
}
|
||||
|
||||
void wxDisplaySize( int *width, int *height )
|
||||
{
|
||||
if (width) *width = gdk_screen_width();
|
||||
if (height) *height = gdk_screen_height();
|
||||
if (width) *width = gdk_screen_width();
|
||||
if (height) *height = gdk_screen_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)
|
||||
{
|
||||
wxFAIL_MSG( "wxColourDisplay always returns TRUE" );
|
||||
return TRUE;
|
||||
wxFAIL_MSG( "wxColourDisplay always returns TRUE" );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int wxDisplayDepth(void)
|
||||
{
|
||||
wxFAIL_MSG( "wxDisplayDepth always returns 8" );
|
||||
return 8;
|
||||
wxFAIL_MSG( "wxDisplayDepth always returns 8" );
|
||||
return 8;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
@@ -94,34 +102,40 @@ int wxDisplayDepth(void)
|
||||
|
||||
const char* wxGetHomeDir( wxString *home )
|
||||
{
|
||||
*home = wxGetUserHome( wxString() );
|
||||
if (home->IsNull()) *home = "/";
|
||||
return *home;
|
||||
};
|
||||
*home = wxGetUserHome( wxString() );
|
||||
if (home->IsNull()) *home = "/";
|
||||
return *home;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
who = getpwnam (user);
|
||||
}
|
||||
|
||||
return who ? who->pw_dir : (char*)NULL;
|
||||
};
|
||||
return who ? who->pw_dir : (char*)NULL;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// id routines
|
||||
@@ -147,15 +161,15 @@ bool wxGetHostName(char *buf, int sz)
|
||||
// strncpy(buf, (h=gethostbyname(name))!=NULL ? h->h_name : name, sz-1);
|
||||
if((unsigned)sz > strlen(name)+strlen(domain)+1)
|
||||
{
|
||||
strcpy(buf, name);
|
||||
if(strcmp(domain,"(none)") == 0) // standalone machine
|
||||
{
|
||||
strcat(buf,".");
|
||||
strcat(buf,domain);
|
||||
}
|
||||
strcpy(buf, name);
|
||||
if(strcmp(domain,"(none)") == 0) // standalone machine
|
||||
{
|
||||
strcat(buf,".");
|
||||
strcat(buf,domain);
|
||||
}
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
#endif
|
||||
}
|
||||
@@ -223,10 +237,10 @@ void wxFatalError( const wxString &msg, const wxString &title )
|
||||
|
||||
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);
|
||||
char buf[500];
|
||||
strcpy( buf, WXSTRINGCAST(dir) );
|
||||
struct stat sbuf;
|
||||
return ((stat(buf, &sbuf) != -1) && S_ISDIR(sbuf.st_mode) ? TRUE : FALSE);
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
@@ -103,10 +103,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;
|
||||
|
@@ -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" )
|
||||
|
@@ -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;
|
||||
}
|
||||
|
@@ -42,15 +42,20 @@ extern wxList wxPendingDelete;
|
||||
static 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->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,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_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
|
||||
|
||||
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_widget_set_usize( m_frameStatusBar->m_widget, m_width, wxSTATUS_HEIGHT );
|
||||
}
|
||||
|
||||
|
||||
m_sizeSet = TRUE;
|
||||
|
||||
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) )
|
||||
|
@@ -19,8 +19,13 @@
|
||||
|
||||
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 )
|
||||
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);
|
||||
Ref(icon);
|
||||
return *this;
|
||||
if (*this == icon) return (*this);
|
||||
Ref(icon);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
@@ -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>
|
||||
@@ -50,42 +55,45 @@ extern "C"
|
||||
|
||||
void wxBell(void)
|
||||
{
|
||||
gdk_beep();
|
||||
};
|
||||
gdk_beep();
|
||||
}
|
||||
|
||||
void wxSleep(int nSecs)
|
||||
{
|
||||
sleep(nSecs);
|
||||
};
|
||||
sleep(nSecs);
|
||||
}
|
||||
|
||||
int wxKill(long pid, int sig)
|
||||
{
|
||||
return kill(pid, sig);
|
||||
};
|
||||
return kill(pid, sig);
|
||||
}
|
||||
|
||||
void wxDisplaySize( int *width, int *height )
|
||||
{
|
||||
if (width) *width = gdk_screen_width();
|
||||
if (height) *height = gdk_screen_height();
|
||||
if (width) *width = gdk_screen_width();
|
||||
if (height) *height = gdk_screen_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)
|
||||
{
|
||||
wxFAIL_MSG( "wxColourDisplay always returns TRUE" );
|
||||
return TRUE;
|
||||
wxFAIL_MSG( "wxColourDisplay always returns TRUE" );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int wxDisplayDepth(void)
|
||||
{
|
||||
wxFAIL_MSG( "wxDisplayDepth always returns 8" );
|
||||
return 8;
|
||||
wxFAIL_MSG( "wxDisplayDepth always returns 8" );
|
||||
return 8;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
@@ -94,34 +102,40 @@ int wxDisplayDepth(void)
|
||||
|
||||
const char* wxGetHomeDir( wxString *home )
|
||||
{
|
||||
*home = wxGetUserHome( wxString() );
|
||||
if (home->IsNull()) *home = "/";
|
||||
return *home;
|
||||
};
|
||||
*home = wxGetUserHome( wxString() );
|
||||
if (home->IsNull()) *home = "/";
|
||||
return *home;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
who = getpwnam (user);
|
||||
}
|
||||
|
||||
return who ? who->pw_dir : (char*)NULL;
|
||||
};
|
||||
return who ? who->pw_dir : (char*)NULL;
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
// id routines
|
||||
@@ -147,15 +161,15 @@ bool wxGetHostName(char *buf, int sz)
|
||||
// strncpy(buf, (h=gethostbyname(name))!=NULL ? h->h_name : name, sz-1);
|
||||
if((unsigned)sz > strlen(name)+strlen(domain)+1)
|
||||
{
|
||||
strcpy(buf, name);
|
||||
if(strcmp(domain,"(none)") == 0) // standalone machine
|
||||
{
|
||||
strcat(buf,".");
|
||||
strcat(buf,domain);
|
||||
}
|
||||
strcpy(buf, name);
|
||||
if(strcmp(domain,"(none)") == 0) // standalone machine
|
||||
{
|
||||
strcat(buf,".");
|
||||
strcat(buf,domain);
|
||||
}
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
#endif
|
||||
}
|
||||
@@ -223,10 +237,10 @@ void wxFatalError( const wxString &msg, const wxString &title )
|
||||
|
||||
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);
|
||||
char buf[500];
|
||||
strcpy( buf, WXSTRINGCAST(dir) );
|
||||
struct stat sbuf;
|
||||
return ((stat(buf, &sbuf) != -1) && S_ISDIR(sbuf.st_mode) ? TRUE : FALSE);
|
||||
};
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
@@ -103,10 +103,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;
|
||||
|
Reference in New Issue
Block a user