$(WXDIR)/src/os2/files.lst \
$(WXDIR)/src/mgl/files.lst \
$(WXDIR)/src/microwin/files.lst \
+ $(WXDIR)/src/x11/files.lst \
$(WXDIR)/src/univ/files.lst \
$(WXDIR)/src/wxBase.dsp \
$(WXDIR)/src/wxWindows.dsp \
$(WXDIR)/src/univ/files.lst: univ.t filelist.txt wxwin.pro
$(TMAKE) -t univ wxwin.pro -o $@
+$(WXDIR)/src/x11/files.lst: x11.t filelist.txt wxwin.pro
+ $(TMAKE) -t x11 wxwin.pro -o $@
+
$(WXDIR)/src/wxBase.dsp: vc6base.t filelist.txt wxwin.pro
$(TMAKE) -t vc6base wxwin.pro -o $@
hashmap.cpp Common Base
helpbase.cpp Common
http.cpp Common Socket,Base
+iconbndl.cpp Common
imagall.cpp Common
imagbmp.cpp Common
image.cpp Common
snglinst.cpp Unix Base
threadpsx.cpp Unix Base,NotMac
utilsunx.cpp Unix Base
+utilsx11.cpp Unix NotMac,NotMGL,NotMicro
bmpbuttn.cpp Univ
button.cpp Univ
helphtml.h WXH
helpwin.h WXH
icon.h WXH
+iconbndl.h WXH
image.h WXH
imaggif.h WXH
imagiff.h WXH
fontutil.h UnixH
gsockunx.h UnixH Base
mimetype.h UnixH Base
+utilsx11.h UnixH
file.h ProtoH Base
ftp.h ProtoH Base
#endif
// no icon
- void SetIcon( const wxIcon &icon ) { m_icon = icon; }
+ void SetIcon( const wxIcon &icon ) { m_icons = wxIconBundle( icon ); }
+ void SetIcons( const wxIconBundle &icons ) { m_icons = icons; }
// no title
void SetTitle( const wxString &title );
virtual void Iconize(bool iconize = TRUE);
virtual bool IsIconized() const;
virtual void SetIcon(const wxIcon& icon);
+ virtual void SetIcons(const wxIconBundle& icons);
virtual void Restore();
virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
// from both DoSetSize() and DoSetClientSize()
virtual void DoMoveWindow(int x, int y, int width, int height);
+ // set the icon for this window
+ void DoSetIcon( const wxIcon& icon );
+
// GTK callbacks
virtual void GtkOnSize( int x, int y, int width, int height );
virtual void OnInternalIdle();
#endif
// no icon
- void SetIcon( const wxIcon &icon ) { m_icon = icon; }
+ void SetIcon( const wxIcon &icon ) { m_icons = wxIconBundle( icon ); }
+ void SetIcons( const wxIconBundle &icons ) { m_icons = icons; }
// no title
void SetTitle( const wxString &title );
virtual void Iconize(bool iconize = TRUE);
virtual bool IsIconized() const;
virtual void SetIcon(const wxIcon& icon);
+ virtual void SetIcons(const wxIconBundle& icons);
virtual void Restore();
virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
// from both DoSetSize() and DoSetClientSize()
virtual void DoMoveWindow(int x, int y, int width, int height);
+ // set the icon for this window
+ void DoSetIcon( const wxIcon& icon );
+
// GTK callbacks
virtual void GtkOnSize( int x, int y, int width, int height );
virtual void OnInternalIdle();
--- /dev/null
+///////////////////////////////////////////////////////////////////////////////
+// Name: wx/iconbndl.h
+// Purpose: wxIconBundle
+// Author: Mattia barbon
+// Modified by:
+// Created: 23.03.02
+// RCS-ID: $Id$
+// Copyright: (c) Mattia Barbon
+// Licence: wxWindows licence
+///////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_ICONBNDL_H_
+#define _WX_ICONBNDL_H_
+
+#ifdef __GNUG__
+#pragma interface "iconbndl.h"
+#endif
+
+#include "dynarray.h"
+// for wxSize
+#include "wx/gdicmn.h"
+
+class WXDLLEXPORT wxIcon;
+class WXDLLEXPORT wxString;
+
+WX_DECLARE_EXPORTED_OBJARRAY( wxIcon, wxIconArray );
+
+// this class can't load bitmaps of type wxBITMAP_TYPE_ICO_RESOURCE,
+// if you need them, you have to load them manually and call
+// wxIconCollection::AddIcon
+class WXDLLEXPORT wxIconBundle
+{
+public:
+ // default constructor
+ wxIconBundle() {}
+ // initializes the bundle with the icon(s) found in the file
+ wxIconBundle( const wxString& file, long type )
+ { AddIcon( file, type ); }
+ // initializes the bundle with a single icon
+ wxIconBundle( const wxIcon& icon )
+ { AddIcon( icon ); }
+
+ const wxIconBundle& operator =( const wxIconBundle& ic );
+ wxIconBundle( const wxIconBundle& ic )
+ { *this = ic; }
+
+ ~wxIconBundle() { DeleteIcons(); }
+
+ // adds all the icons contained in the file to the collection,
+ // if the collection already contains icons with the same
+ // width and height, they are replaced
+ void AddIcon( const wxString& file, long type );
+ // adds the icon to the collection, if the collection already
+ // contains an icon with the same width and height, it is
+ // replaced
+ void AddIcon( const wxIcon& icon );
+
+ // returns the icon with the given size; if no such icon exists,
+ // returns the icon with size wxSYS_ICON_[XY]; if no such icon exists,
+ // returns the first icon in the bundle
+ const wxIcon& GetIcon( const wxSize& size ) const;
+ // equivalent to GetIcon( wxSize( size, size ) )
+ const wxIcon& GetIcon( wxCoord size = -1 ) const
+ { return GetIcon( wxSize( size, size ) ); }
+private:
+ // delete all icons
+ void DeleteIcons();
+public:
+ wxIconArray m_icons;
+};
+
+#endif
+ // _WX_ICONBNDL_H_
virtual void Iconize(bool iconize = TRUE);
virtual bool IsIconized() const;
virtual void SetIcon(const wxIcon& icon);
+ virtual void SetIcons(const wxIconBundle& icons) { SetIcon( icons.GetIcon( -1 ) ); }
virtual void Restore();
virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL) { return FALSE; }
// Set icon
virtual void SetIcon(const wxIcon& icon);
-
+ virtual void SetIcons(const wxIconBundle& icons);
+
#if wxUSE_STATUSBAR
virtual void PositionStatusBar();
#endif // wxUSE_STATUSBAR
protected:
// common part of all ctors
void Init();
-
+
+ // set a single icon for the frame
+ void DoSetIcon( const wxIcon& icon );
+
//// Motif-specific
WXWidget m_frameShell;
WXWidget m_frameWidget;
// Set icon
virtual void SetIcon(const wxIcon& icon);
-
+ virtual void SetIcons(const wxIconBundle& icons );
+
// Override wxFrame operations
void CaptureMouse();
void ReleaseMouse();
virtual void Iconize(bool iconize = TRUE);
virtual bool IsIconized() const;
virtual void SetIcon(const wxIcon& icon);
+ virtual void SetIcons(const wxIconBundle& icons );
virtual void Restore();
virtual bool Show(bool show = TRUE);
virtual void Restore(void);
virtual void SendSizeEvent(void);
virtual void SetIcon(const wxIcon& rIcon);
+ inline virtual void SetIcons(const wxIconBundle& icons) { SetIcon( icons.GetIcon( -1 ) ); }
+
virtual bool Show(bool bShow = TRUE);
virtual bool ShowFullScreen( bool bShow
,long lStyle = wxFULLSCREEN_ALL
#endif
#include "wx/window.h"
-#include "wx/icon.h"
+#include "wx/iconbndl.h"
// the default names for various classs
WXDLLEXPORT_DATA(extern const wxChar*) wxFrameNameStr;
virtual bool IsIconized() const = 0;
// get the frame icon
- const wxIcon& GetIcon() const { return m_icon; }
+ const wxIcon& GetIcon() const { return m_icons.GetIcon( -1 ); }
+
+ // get the frame icons
+ const wxIconBundle& GetIcons() const { return m_icons; }
// set the frame icon
- virtual void SetIcon(const wxIcon& icon) { m_icon = icon; }
+ virtual void SetIcon(const wxIcon& icon) { m_icons = wxIconBundle( icon ); }
+
+ // set the frame icons
+ virtual void SetIcons(const wxIconBundle& icons ) { m_icons = icons; }
// maximize the window to cover entire screen
virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL) = 0;
bool SendIconizeEvent(bool iconized = TRUE);
// the frame icon
- wxIcon m_icon;
+ wxIconBundle m_icons;
// test whether this window makes part of the frame
// (menubar, toolbar and statusbar are excluded from automatic layout)
virtual wxPoint GetClientAreaOrigin() const;
virtual void DoGetClientSize(int *width, int *height) const;
virtual void DoSetClientSize(int width, int height);
- virtual void SetIcon(const wxIcon& icon);
+ virtual void SetIcon(const wxIcon& icon) { SetIcons( wxIconBundle( icon ) ); }
+ virtual void SetIcons(const wxIconBundle& icons);
// implementation from now on
// --------------------------
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: wx/unix/utilsx11.h
+// Purpose: Miscellaneous X11 functions
+// Author: Mattia Barbon
+// Modified by:
+// Created: 25.03.02
+// RCS-ID: $Id$
+// Copyright: (c) wxWindows team
+// Licence: wxWindows license
+/////////////////////////////////////////////////////////////////////////////
+
+#ifndef _WX_UNIX_UTILSX11_H_
+#define _WX_UNIX_UTILSX11_H_
+
+#include "wx/defs.h"
+
+#if defined(__WXMOTIF__) || defined(__WXGTK__) || defined(__WXX11__)
+
+#if defined(__WXGTK__)
+typedef void WXDisplay;
+typedef void* WXWindow;
+#endif
+
+class wxIconBundle;
+
+void wxSetIconsX11( WXDisplay* display, WXWindow window,
+ const wxIconBundle& ib );
+
+#endif
+ // __WXMOTIF__, __WXGTK__, __WXX11__
+
+#endif
+ // _WX_UNIX_UTILSX11_H_
wxFS_VOL_ICO_MAX
};
-WX_DECLARE_EXPORTED_OBJARRAY(wxIcon, wxIconArray);
+// already in wx/iconbndl.h
+// WX_DECLARE_EXPORTED_OBJARRAY(wxIcon, wxIconArray);
#endif // wxUSE_GUI
virtual bool IsMaximized() const;
virtual void Iconize(bool iconize = TRUE);
virtual bool IsIconized() const;
- virtual void SetIcon(const wxIcon& icon);
+ virtual void SetIcon(const wxIcon& icon) { SetIcons( wxIconBundle( icon ) ); }
+ virtual void SetIcons(const wxIconBundle& icons);
virtual void Restore();
virtual bool Show( bool show = TRUE );
// common part of all ctors
void Init();
+ // set the icon for the window
+ void DoSetIcon( const wxIcon& icon );
+
// For implementation purposes - sometimes decorations make the
// client area smaller
virtual wxPoint GetClientAreaOrigin() const;
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: iconbndl.cpp
+// Purpose: wxIconBundle
+// Author: Mattia Barbon
+// Created: 23.03.2002
+// RCS-ID: $Id$
+// Copyright: (c) Mattia barbon
+// Licence: wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+#ifdef __GNUG__
+ #pragma implementation "iconbndl.h"
+#endif
+
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+ #pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+ #include "wx/settings.h"
+ #include "wx/image.h"
+ #include "wx/icon.h"
+ #include "wx/log.h"
+ #include "wx/intl.h"
+#endif
+
+#include "wx/iconbndl.h"
+#include "wx/arrimpl.cpp"
+
+WX_DEFINE_OBJARRAY(wxIconArray)
+
+const wxIconBundle& wxIconBundle::operator =( const wxIconBundle& ic )
+{
+ if( this == &ic ) return *this;
+
+ size_t i, max = ic.m_icons.GetCount();
+
+ DeleteIcons();
+ for( i = 0; i < max; ++i )
+ m_icons.Add( ic.m_icons[i] );
+
+ return *this;
+}
+
+void wxIconBundle::DeleteIcons()
+{
+ m_icons.Empty();
+}
+
+void wxIconBundle::AddIcon( const wxString& file, long type )
+{
+ size_t count = wxImage::GetImageCount( file, type );
+ size_t i;
+ wxImage image;
+ wxIcon tmp;
+
+ for( i = 0; i < count; ++i )
+ {
+ if( !image.LoadFile( file, type, i ) )
+ {
+ wxLogError( _("Failed to load image %d from file '%s'."),
+ i, file.c_str() );
+ continue;
+ }
+
+ tmp.CopyFromBitmap( wxBitmap( image ) );
+ AddIcon( tmp );
+ }
+}
+
+const wxIcon& wxIconBundle::GetIcon( const wxSize& size ) const
+{
+ size_t i, max = m_icons.GetCount();
+ wxCoord sysX = wxSystemSettings::GetMetric( wxSYS_ICON_X ),
+ sysY = wxSystemSettings::GetMetric( wxSYS_ICON_Y );
+ wxIcon* sysIcon = 0;
+
+ for( i = 0; i < max; ++i )
+ {
+ wxCoord sx = m_icons[i].GetWidth(), sy = m_icons[i].GetHeight();
+ // requested size
+ if( sx == size.x && sy == size.y )
+ return m_icons[i];
+ // keep track if there is a system-size icon
+ if( sx == sysX && sy == sysY )
+ sysIcon = &m_icons[i];
+ }
+
+ // return the system-sized icon if we've got one
+ if( sysIcon ) return *sysIcon;
+ // return the first icon, if we have one
+ return max > 0 ? m_icons[0] : wxNullIcon;
+}
+
+void wxIconBundle::AddIcon( const wxIcon& icon )
+{
+ size_t i, max = m_icons.GetCount();
+
+ for( i = 0; i < max; ++i )
+ {
+ wxIcon& tmp = m_icons[i];
+ if( tmp.GetWidth() == icon.GetWidth() &&
+ tmp.GetHeight() == icon.GetHeight() )
+ {
+ tmp = icon;
+ return;
+ }
+ }
+
+ m_icons.Add( icon );
+}
common/hashmap.cpp \
common/helpbase.cpp \
common/http.cpp \
+ common/iconbndl.cpp \
common/imagall.cpp \
common/imagbmp.cpp \
common/image.cpp \
unix/snglinst.cpp \
unix/threadpsx.cpp \
unix/utilsunx.cpp \
+ unix/utilsx11.cpp \
html/helpctrl.cpp \
html/helpdata.cpp \
html/helpfrm.cpp \
helphtml.h \
helpwin.h \
icon.h \
+ iconbndl.h \
imagbmp.h \
image.h \
imaggif.h \
unix/fontutil.h \
unix/gsockunx.h \
unix/mimetype.h \
+ unix/utilsx11.h \
html/forcelnk.h \
html/helpctrl.h \
html/helpdata.h \
hashmap.o \
helpbase.o \
http.o \
+ iconbndl.o \
imagall.o \
imagbmp.o \
image.o \
mimetype.o \
snglinst.o \
threadpsx.o \
- utilsunx.o
+ utilsunx.o \
+ utilsx11.o
HTMLOBJS = \
helpctrl.o \
// VZ: is there any way to get the cursor size with GDK?
case wxSYS_CURSOR_X: return 16;
case wxSYS_CURSOR_Y: return 16;
-
+ // MBN: ditto for icons
+ case wxSYS_ICON_X: return 32;
+ case wxSYS_ICON_Y: return 32;
default:
wxFAIL_MSG( wxT("wxSystemSettings::GetMetric not fully implemented") );
return 0;
#include "wx/gtk/win_gtk.h"
+#include "wx/unix/utilsx11.h"
+
// ----------------------------------------------------------------------------
// idle system
// ----------------------------------------------------------------------------
gtk_window_set_title( GTK_WINDOW(m_widget), title.mbc_str() );
}
-void wxTopLevelWindowGTK::SetIcon( const wxIcon &icon )
+void wxTopLevelWindowGTK::DoSetIcon( const wxIcon &icon )
{
- wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
-
- wxTopLevelWindowBase::SetIcon(icon);
-
- if ( !m_icon.Ok() )
+ if ( !icon.Ok() )
return;
if (!m_widget->window)
gdk_window_set_icon( m_widget->window, (GdkWindow *) NULL, icon.GetPixmap(), bm );
}
+void wxTopLevelWindowGTK::SetIcon( const wxIcon &icon )
+{
+ SetIcons( wxIconBundle( icon ) );
+}
+
+void wxTopLevelWindowGTK::SetIcons( const wxIconBundle &icons )
+{
+ wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
+ GdkWindow* window = m_widget->window;
+ wxCHECK_RET( window, _T("window not created yet - can't set icon") );
+
+ wxTopLevelWindowBase::SetIcons( icons );
+
+ DoSetIcon( icons.GetIcon( -1 ) );
+ wxSetIconsX11( (WXDisplay*)GDK_WINDOW_XDISPLAY( window ),
+ (WXWindow)GDK_WINDOW_XWINDOW( window ), icons );
+}
+
// ----------------------------------------------------------------------------
// frame state: maximized/iconized/normal
// ----------------------------------------------------------------------------
common/hashmap.cpp \
common/helpbase.cpp \
common/http.cpp \
+ common/iconbndl.cpp \
common/imagall.cpp \
common/imagbmp.cpp \
common/image.cpp \
unix/snglinst.cpp \
unix/threadpsx.cpp \
unix/utilsunx.cpp \
+ unix/utilsx11.cpp \
html/helpctrl.cpp \
html/helpdata.cpp \
html/helpfrm.cpp \
helphtml.h \
helpwin.h \
icon.h \
+ iconbndl.h \
imagbmp.h \
image.h \
imaggif.h \
unix/fontutil.h \
unix/gsockunx.h \
unix/mimetype.h \
+ unix/utilsx11.h \
html/forcelnk.h \
html/helpctrl.h \
html/helpdata.h \
hashmap.o \
helpbase.o \
http.o \
+ iconbndl.o \
imagall.o \
imagbmp.o \
image.o \
mimetype.o \
snglinst.o \
threadpsx.o \
- utilsunx.o
+ utilsunx.o \
+ utilsx11.o
HTMLOBJS = \
helpctrl.o \
// VZ: is there any way to get the cursor size with GDK?
case wxSYS_CURSOR_X: return 16;
case wxSYS_CURSOR_Y: return 16;
-
+ // MBN: ditto for icons
+ case wxSYS_ICON_X: return 32;
+ case wxSYS_ICON_Y: return 32;
default:
wxFAIL_MSG( wxT("wxSystemSettings::GetMetric not fully implemented") );
return 0;
#include "wx/gtk/win_gtk.h"
+#include "wx/unix/utilsx11.h"
+
// ----------------------------------------------------------------------------
// idle system
// ----------------------------------------------------------------------------
gtk_window_set_title( GTK_WINDOW(m_widget), title.mbc_str() );
}
-void wxTopLevelWindowGTK::SetIcon( const wxIcon &icon )
+void wxTopLevelWindowGTK::DoSetIcon( const wxIcon &icon )
{
- wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
-
- wxTopLevelWindowBase::SetIcon(icon);
-
- if ( !m_icon.Ok() )
+ if ( !icon.Ok() )
return;
if (!m_widget->window)
gdk_window_set_icon( m_widget->window, (GdkWindow *) NULL, icon.GetPixmap(), bm );
}
+void wxTopLevelWindowGTK::SetIcon( const wxIcon &icon )
+{
+ SetIcons( wxIconBundle( icon ) );
+}
+
+void wxTopLevelWindowGTK::SetIcons( const wxIconBundle &icons )
+{
+ wxASSERT_MSG( (m_widget != NULL), wxT("invalid frame") );
+ GdkWindow* window = m_widget->window;
+ wxCHECK_RET( window, _T("window not created yet - can't set icon") );
+
+ wxTopLevelWindowBase::SetIcons( icons );
+
+ DoSetIcon( icons.GetIcon( -1 ) );
+ wxSetIconsX11( (WXDisplay*)GDK_WINDOW_XDISPLAY( window ),
+ (WXWindow)GDK_WINDOW_XWINDOW( window ), icons );
+}
+
// ----------------------------------------------------------------------------
// frame state: maximized/iconized/normal
// ----------------------------------------------------------------------------
common/hashmap.cpp \
common/helpbase.cpp \
common/http.cpp \
+ common/iconbndl.cpp \
common/imagall.cpp \
common/imagbmp.cpp \
common/image.cpp \
helphtml.h \
helpwin.h \
icon.h \
+ iconbndl.h \
imagbmp.h \
image.h \
imaggif.h \
unix/fontutil.h \
unix/gsockunx.h \
unix/mimetype.h \
+ unix/utilsx11.h \
html/forcelnk.h \
html/helpctrl.h \
html/helpdata.h \
hashmap.o \
helpbase.o \
http.o \
+ iconbndl.o \
imagall.o \
imagbmp.o \
image.o \
common/hashmap.cpp \
common/helpbase.cpp \
common/http.cpp \
+ common/iconbndl.cpp \
common/imagall.cpp \
common/imagbmp.cpp \
common/image.cpp \
helphtml.h \
helpwin.h \
icon.h \
+ iconbndl.h \
imagbmp.h \
image.h \
imaggif.h \
unix/fontutil.h \
unix/gsockunx.h \
unix/mimetype.h \
+ unix/utilsx11.h \
html/forcelnk.h \
html/helpctrl.h \
html/helpdata.h \
hashmap.o \
helpbase.o \
http.o \
+ iconbndl.o \
imagall.o \
imagbmp.o \
image.o \
!if "$(wxUSE_GUI)" == "1"
#!if "$(WXUSINGDLL)" == "1"
-#DUMMYOBJ=
+DUMMYOBJ=
#!endif
$(PROGRAM).exe: $(WXLIB) $(OBJECTS) $(PROGRAM).res
common/hashmap.cpp \
common/helpbase.cpp \
common/http.cpp \
+ common/iconbndl.cpp \
common/imagall.cpp \
common/imagbmp.cpp \
common/image.cpp \
helphtml.h \
helpwin.h \
icon.h \
+ iconbndl.h \
imagbmp.h \
image.h \
imaggif.h \
unix/fontutil.h \
unix/gsockunx.h \
unix/mimetype.h \
+ unix/utilsx11.h \
html/forcelnk.h \
html/helpctrl.h \
html/helpdata.h \
hashmap.o \
helpbase.o \
http.o \
+ iconbndl.o \
imagall.o \
imagbmp.o \
image.o \
common/hashmap.cpp \
common/helpbase.cpp \
common/http.cpp \
+ common/iconbndl.cpp \
common/imagall.cpp \
common/imagbmp.cpp \
common/image.cpp \
helphtml.h \
helpwin.h \
icon.h \
+ iconbndl.h \
imagbmp.h \
image.h \
imaggif.h \
unix/fontutil.h \
unix/gsockunx.h \
unix/mimetype.h \
+ unix/utilsx11.h \
html/forcelnk.h \
html/helpctrl.h \
html/helpdata.h \
hashmap.o \
helpbase.o \
http.o \
+ iconbndl.o \
imagall.o \
imagbmp.o \
image.o \
common/hashmap.cpp \
common/helpbase.cpp \
common/http.cpp \
+ common/iconbndl.cpp \
common/imagall.cpp \
common/imagbmp.cpp \
common/image.cpp \
unix/snglinst.cpp \
unix/threadpsx.cpp \
unix/utilsunx.cpp \
+ unix/utilsx11.cpp \
html/helpctrl.cpp \
html/helpdata.cpp \
html/helpfrm.cpp \
helphtml.h \
helpwin.h \
icon.h \
+ iconbndl.h \
imagbmp.h \
image.h \
imaggif.h \
unix/fontutil.h \
unix/gsockunx.h \
unix/mimetype.h \
+ unix/utilsx11.h \
html/forcelnk.h \
html/helpctrl.h \
html/helpdata.h \
hashmap.o \
helpbase.o \
http.o \
+ iconbndl.o \
imagall.o \
imagbmp.o \
image.o \
mimetype.o \
snglinst.o \
threadpsx.o \
- utilsunx.o
+ utilsunx.o \
+ utilsx11.o
HTMLOBJS = \
helpctrl.o \
#include <Xm/Xm.h>
#include <X11/Shell.h>
+#include <X11/Core.h>
#if XmVersion >= 1002
#include <Xm/XmAll.h>
#else
#endif
#include "wx/motif/private.h"
+#include "wx/unix/utilsx11.h"
// ----------------------------------------------------------------------------
// private functions
NULL);
}
-void wxFrame::SetIcon(const wxIcon& icon)
+void wxFrame::DoSetIcon(const wxIcon& icon)
{
- m_icon = icon;
-
if (!m_frameShell)
return;
XtVaSetValues((Widget) m_frameShell, XtNiconPixmap, icon.GetPixmap(), NULL);
}
+void wxFrame::SetIcon(const wxIcon& icon)
+{
+ SetIcons( wxIconBundle( icon ) );
+}
+
+void wxFrame::SetIcons(const wxIconBundle& icons)
+{
+ wxFrameBase::SetIcons( icons );
+
+ if (!m_frameShell)
+ return;
+
+ DoSetIcon( m_icons.GetIcon( -1 ) );
+ wxSetIconsX11(GetXDisplay(),
+ (WXWindow) XtWindow( (Widget) m_frameShell ), icons);
+}
+
void wxFrame::PositionStatusBar()
{
if (!m_frameStatusBar)
// Set icon
void wxMDIChildFrame::SetIcon(const wxIcon& icon)
{
- m_icon = icon;
- if (m_icon.Ok())
+ m_icons = wxIconBundle( icon );
+
+ if (icon.Ok())
{
// Not appropriate since there are no icons in
// a tabbed window
}
}
+void wxMDIChildFrame::SetIcons(const wxIconBundle& icons)
+{
+ m_icons = icons;
+}
+
void wxMDIChildFrame::SetTitle(const wxString& title)
{
m_title = title;
common/hashmap.cpp \
common/helpbase.cpp \
common/http.cpp \
+ common/iconbndl.cpp \
common/imagall.cpp \
common/imagbmp.cpp \
common/image.cpp \
helphtml.h \
helpwin.h \
icon.h \
+ iconbndl.h \
imagbmp.h \
image.h \
imaggif.h \
unix/fontutil.h \
unix/gsockunx.h \
unix/mimetype.h \
+ unix/utilsx11.h \
html/forcelnk.h \
html/helpctrl.h \
html/helpdata.h \
hashmap.o \
helpbase.o \
http.o \
+ iconbndl.o \
imagall.o \
imagbmp.o \
image.o \
#ifndef __WXMICROWIN__
if ( m_iconized )
{
- HICON hIcon = m_icon.Ok() ? GetHiconOf(m_icon)
- : (HICON)GetDefaultIcon();
+ const wxIcon& icon = GetIcon();
+ HICON hIcon = icon.Ok() ? GetHiconOf(icon)
+ : (HICON)GetDefaultIcon();
// Hold a pointer to the dc so long as the OnPaint() message
// is being processed
case WM_QUERYDRAGICON:
{
- HICON hIcon = m_icon.Ok() ? GetHiconOf(m_icon)
- : (HICON)GetDefaultIcon();
+ const wxIcon& icon = GetIcon();
+ HICON hIcon = icon.Ok() ? GetHiconOf(icon)
+ : (HICON)GetDefaultIcon();
rc = (long)hIcon;
processed = rc != 0;
}
$(MSWDIR)\hashmap.obj \
$(MSWDIR)\helpbase.obj \
$(MSWDIR)\http.obj \
+ $(MSWDIR)\iconbndl.obj \
$(MSWDIR)\imagall.obj \
$(MSWDIR)\imagbmp.obj \
$(MSWDIR)\image.obj \
$(MSWDIR)\http.obj: $(COMMDIR)\http.$(SRCSUFF)
+$(MSWDIR)\iconbndl.obj: $(COMMDIR)\iconbndl.$(SRCSUFF)
+
$(MSWDIR)\imagall.obj: $(COMMDIR)\imagall.$(SRCSUFF)
$(MSWDIR)\imagbmp.obj: $(COMMDIR)\imagbmp.$(SRCSUFF)
$(MSWDIR)\hash.obj \
$(MSWDIR)\hashmap.obj \
$(MSWDIR)\helpbase.obj \
+ $(MSWDIR)\iconbndl.obj \
$(MSWDIR)\imagall.obj \
$(MSWDIR)\imagbmp.obj \
$(MSWDIR)\image.obj \
$(MSWDIR)\helpbase.obj: $(COMMDIR)\helpbase.$(SRCSUFF)
+$(MSWDIR)\iconbndl.obj: $(COMMDIR)\iconbndl.$(SRCSUFF)
+
$(MSWDIR)\imagall.obj: $(COMMDIR)\imagall.$(SRCSUFF)
$(MSWDIR)\imagbmp.obj: $(COMMDIR)\imagbmp.$(SRCSUFF)
$(COMMDIR)\hash.obj \
$(COMMDIR)\hashmap.obj \
$(COMMDIR)\helpbase.obj \
+ $(COMMDIR)\iconbndl.obj \
$(COMMDIR)\imagall.obj \
$(COMMDIR)\imagbmp.obj \
$(COMMDIR)\image.obj \
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
<<
+$(COMMDIR)/iconbndl.obj: $*.$(SRCSUFF)
+ cl @<<
+$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
+<<
+
$(COMMDIR)/imagall.obj: $*.$(SRCSUFF)
cl @<<
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
$(COMMDIR)/geometry.$(OBJSUFF) \
$(COMMDIR)/gifdecod.$(OBJSUFF) \
$(COMMDIR)/helpbase.$(OBJSUFF) \
+ $(COMMDIR)/iconbndl.$(OBJSUFF) \
$(COMMDIR)/imagall.$(OBJSUFF) \
$(COMMDIR)/imagbmp.$(OBJSUFF) \
$(COMMDIR)/image.$(OBJSUFF) \
$(COMMDIR)\hashmap.obj \
$(COMMDIR)\helpbase.obj \
$(COMMDIR)\http.obj \
+ $(COMMDIR)\iconbndl.obj \
$(COMMDIR)\imagall.obj \
$(COMMDIR)\imagbmp.obj \
$(COMMDIR)\image.obj \
$(COMMDIR)\$D\hashmap.obj \
$(COMMDIR)\$D\helpbase.obj \
$(COMMDIR)\$D\http.obj \
+ $(COMMDIR)\$D\iconbndl.obj \
$(COMMDIR)\$D\imagall.obj \
$(COMMDIR)\$D\imagbmp.obj \
$(COMMDIR)\$D\image.obj \
hashmap.obj &
helpbase.obj &
http.obj &
+ iconbndl.obj &
imagall.obj &
imagbmp.obj &
image.obj &
http.obj: $(COMMDIR)\http.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
+iconbndl.obj: $(COMMDIR)\iconbndl.cpp
+ *$(CCC) $(CPPFLAGS) $(IFLAGS) $<
+
imagall.obj: $(COMMDIR)\imagall.cpp
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
void wxTopLevelWindowMSW::SetIcon(const wxIcon& icon)
{
- // this sets m_icon
- wxTopLevelWindowBase::SetIcon(icon);
+ SetIcons( wxIconBundle( icon ) );
+}
+
+void wxTopLevelWindowMSW::SetIcons(const wxIconBundle& icons)
+{
+ wxTopLevelWindowBase::SetIcons(icons);
#if defined(__WIN95__) && !defined(__WXMICROWIN__)
- if ( m_icon.Ok() )
+ const wxIcon& sml = icons.GetIcon( wxSize( 16, 16 ) );
+ if( sml.Ok() && sml.GetWidth() == 16 && sml.GetHeight() == 16 )
+ {
+ ::SendMessage( GetHwndOf( this ), WM_SETICON, ICON_SMALL,
+ (LPARAM)GetHiconOf(sml) );
+ }
+
+ const wxIcon& big = icons.GetIcon( wxSize( 32, 32 ) );
+ if( big.Ok() && big.GetWidth() == 32 && big.GetHeight() == 32 )
{
- ::SendMessage(GetHwnd(), WM_SETICON,
- (WPARAM)TRUE, (LPARAM)GetHiconOf(m_icon));
+ ::SendMessage( GetHwndOf( this ), WM_SETICON, ICON_BIG,
+ (LPARAM)GetHiconOf(big) );
}
#endif // __WIN95__
}
// Other initialization.
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#if wxUSE_GUI
-WX_DEFINE_OBJARRAY(wxIconArray);
+// already in wx/iconbndl.h
+// WX_DEFINE_OBJARRAY(wxIconArray);
#endif
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
common/hashmap.cpp \
common/helpbase.cpp \
common/http.cpp \
+ common/iconbndl.cpp \
common/imagall.cpp \
common/imagbmp.cpp \
common/image.cpp \
helphtml.h \
helpwin.h \
icon.h \
+ iconbndl.h \
imagbmp.h \
image.h \
imaggif.h \
hashmap.o \
helpbase.o \
http.o \
+ iconbndl.o \
imagall.o \
imagbmp.o \
image.o \
// icons
// ----------------------------------------------------------------------------
-void wxTopLevelWindow::SetIcon(const wxIcon& icon)
+void wxTopLevelWindow::SetIcons(const wxIconBundle& icons)
{
- wxTopLevelWindowNative::SetIcon(icon);
+ wxTopLevelWindowNative::SetIcons(icons);
if ( ms_drawDecorations && m_renderer )
{
wxSize size = m_renderer->GetFrameIconSize();
+ const wxIcon& icon = icons.GetIcon( size );
if ( !icon.Ok() || size.x == -1 )
m_titlebarIcon = icon;
--- /dev/null
+/////////////////////////////////////////////////////////////////////////////
+// Name: src/unix/utilsx11.cpp
+// Purpose: Miscellaneous X11 functions
+// Author: Mattia Barbon
+// Modified by:
+// Created: 25.03.02
+// RCS-ID: $Id$
+// Copyright: (c) wxWindows team
+// Licence: wxWindows license
+/////////////////////////////////////////////////////////////////////////////
+
+#if defined(__WXX11__) || defined(__WXGTK__) || defined(__WXMOTIF__)
+
+#include "wx/unix/utilsx11.h"
+#include "wx/iconbndl.h"
+#include "wx/image.h"
+#include "wx/icon.h"
+
+#include <X11/Xlib.h>
+#include <X11/Xatom.h>
+
+void wxSetIconsX11( WXDisplay* display, WXWindow window,
+ const wxIconBundle& ib )
+{
+ size_t size = 0;
+ size_t i, max = ib.m_icons.GetCount();
+
+ for( i = 0; i < max; ++i )
+ size += 2 + ib.m_icons[i].GetWidth() * ib.m_icons[i].GetHeight();
+
+ Atom net_wm_icon = XInternAtom( (Display*)display, "_NET_WM_ICON", 0 );
+
+ if( size > 0 )
+ {
+ wxUint32* data = new wxUint32[size];
+ wxUint32* ptr = data;
+
+ for( i = 0; i < max; ++i )
+ {
+ const wxImage image = ib.m_icons[i].ConvertToImage();
+ int width = image.GetWidth(), height = image.GetHeight();
+ unsigned char* imageData = image.GetData();
+ unsigned char* imageDataEnd = imageData + ( width * height * 3 );
+ bool hasMask = image.HasMask();
+ unsigned char rMask, gMask, bMask;
+ unsigned char r, g, b, a;
+
+ if( hasMask )
+ {
+ rMask = image.GetMaskRed();
+ gMask = image.GetMaskGreen();
+ bMask = image.GetMaskBlue();
+ }
+
+ *ptr++ = width;
+ *ptr++ = height;
+
+ while( imageData < imageDataEnd ) {
+ r = imageData[0];
+ g = imageData[1];
+ b = imageData[2];
+ if( hasMask && r == rMask && g == gMask && b == bMask )
+ a = 0;
+ else
+ a = 255;
+
+ *ptr++ = ( a << 24 ) | ( r << 16 ) | ( g << 8 ) | b;
+
+ imageData += 3;
+ }
+ }
+
+ XChangeProperty( (Display*)display,
+ (Window)window,
+ net_wm_icon,
+ XA_CARDINAL, 32,
+ PropModeReplace,
+ (unsigned char*)data, size );
+ delete[] data;
+ }
+ else
+ {
+ XDeleteProperty( (Display*)display,
+ (Window)window,
+ net_wm_icon );
+ }
+}
+
+#endif
# End Source File
# Begin Source File
+SOURCE=.\common\iconbndl.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\common\imagall.cpp
# End Source File
# Begin Source File
# End Source File
# Begin Source File
+SOURCE=..\include\wx\iconbndl.h
+# End Source File
+# Begin Source File
+
SOURCE=..\include\wx\imagbmp.h
# End Source File
# Begin Source File
# End Source File
# Begin Source File
+SOURCE=.\common\iconbndl.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\common\imagall.cpp
# End Source File
# Begin Source File
# End Source File
# Begin Source File
+SOURCE=..\include\wx\iconbndl.h
+# End Source File
+# Begin Source File
+
SOURCE=..\include\wx\imagbmp.h
# End Source File
# Begin Source File
-Microsoft Developer Studio Workspace File, Format Version 6.00
+Microsoft Developer Studio Workspace File, Format Version 5.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Package=<4>
{{{
- Begin Project Dependency
- Project_Dep_Name jpeg
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name png
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name regex
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name tiff
- End Project Dependency
- Begin Project Dependency
- Project_Dep_Name zlib
- End Project Dependency
}}}
###############################################################################
common/hashmap.cpp \
common/helpbase.cpp \
common/http.cpp \
+ common/iconbndl.cpp \
common/imagall.cpp \
common/imagbmp.cpp \
common/image.cpp \
unix/snglinst.cpp \
unix/threadpsx.cpp \
unix/utilsunx.cpp \
+ unix/utilsx11.cpp \
html/helpctrl.cpp \
html/helpdata.cpp \
html/helpfrm.cpp \
helphtml.h \
helpwin.h \
icon.h \
+ iconbndl.h \
imagbmp.h \
image.h \
imaggif.h \
unix/fontutil.h \
unix/gsockunx.h \
unix/mimetype.h \
+ unix/utilsx11.h \
html/forcelnk.h \
html/helpctrl.h \
html/helpdata.h \
hashmap.o \
helpbase.o \
http.o \
+ iconbndl.o \
imagall.o \
imagbmp.o \
image.o \
mimetype.o \
snglinst.o \
threadpsx.o \
- utilsunx.o
+ utilsunx.o \
+ utilsx11.o
HTMLOBJS = \
helpctrl.o \
#include "wx/x11/private.h"
#include "X11/Xutil.h"
+#include "wx/unix/utilsx11.h"
+
bool wxMWMIsRunning(Window w);
// ----------------------------------------------------------------------------
// wxTopLevelWindowX11 misc
// ----------------------------------------------------------------------------
-void wxTopLevelWindowX11::SetIcon(const wxIcon& icon)
+void wxTopLevelWindowX11::DoSetIcon(const wxIcon& icon)
{
- // this sets m_icon
- wxTopLevelWindowBase::SetIcon(icon);
-
if (icon.Ok() && GetMainWindow())
{
#if wxUSE_NANOX
}
}
+void wxTopLevelWindowX11::SetIcons(const wxIconBundle& icons )
+{
+ // this sets m_icon
+ wxTopLevelWindowBase::SetIcons( icons );
+
+ DoSetIcon( icons.GetIcon( -1 ) );
+ wxSetIconsX11( GetXDisplay(), GetXWindow(), icons );
+}
+
void wxTopLevelWindowX11::SetTitle(const wxString& title)
{
m_title = title;