wxIconBundle implementation.
wxTLW::SetIcons() properly implemented for wxMotif, wxGTK, wxMSW, wxX11, wxUniversal Placeholders that just call SetIcon for wxOS2 and wxMac. Regenerated makefiles. Added hardwired wxSYS_ICON_X/Y = 32 for wxGTK. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14809 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -23,6 +23,7 @@ all: $(MSW_MAKEFILES_DIR)/makefile.vc \
|
||||
$(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 \
|
||||
@@ -76,6 +77,9 @@ $(WXDIR)/src/os2/files.lst: os2.t filelist.txt wxwin.pro
|
||||
$(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 $@
|
||||
|
||||
|
@@ -176,6 +176,7 @@ hash.cpp Common Base
|
||||
hashmap.cpp Common Base
|
||||
helpbase.cpp Common
|
||||
http.cpp Common Socket,Base
|
||||
iconbndl.cpp Common
|
||||
imagall.cpp Common
|
||||
imagbmp.cpp Common
|
||||
image.cpp Common
|
||||
@@ -370,6 +371,7 @@ mimetype.cpp Unix Base,NotMac,NotMicro
|
||||
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
|
||||
@@ -845,6 +847,7 @@ helpbase.h WXH
|
||||
helphtml.h WXH
|
||||
helpwin.h WXH
|
||||
icon.h WXH
|
||||
iconbndl.h WXH
|
||||
image.h WXH
|
||||
imaggif.h WXH
|
||||
imagiff.h WXH
|
||||
@@ -1427,6 +1430,7 @@ execute.h UnixH
|
||||
fontutil.h UnixH
|
||||
gsockunx.h UnixH Base
|
||||
mimetype.h UnixH Base
|
||||
utilsx11.h UnixH
|
||||
|
||||
file.h ProtoH Base
|
||||
ftp.h ProtoH Base
|
||||
|
@@ -161,7 +161,8 @@ public:
|
||||
#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 );
|
||||
|
@@ -54,6 +54,7 @@ public:
|
||||
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);
|
||||
@@ -71,6 +72,9 @@ public:
|
||||
// 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();
|
||||
|
@@ -161,7 +161,8 @@ public:
|
||||
#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 );
|
||||
|
@@ -54,6 +54,7 @@ public:
|
||||
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);
|
||||
@@ -71,6 +72,9 @@ public:
|
||||
// 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();
|
||||
|
73
include/wx/iconbndl.h
Normal file
73
include/wx/iconbndl.h
Normal file
@@ -0,0 +1,73 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// 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_
|
@@ -55,6 +55,7 @@ public:
|
||||
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; }
|
||||
|
@@ -54,6 +54,7 @@ public:
|
||||
|
||||
// Set icon
|
||||
virtual void SetIcon(const wxIcon& icon);
|
||||
virtual void SetIcons(const wxIconBundle& icons);
|
||||
|
||||
#if wxUSE_STATUSBAR
|
||||
virtual void PositionStatusBar();
|
||||
@@ -108,6 +109,9 @@ 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;
|
||||
|
@@ -152,6 +152,7 @@ public:
|
||||
|
||||
// Set icon
|
||||
virtual void SetIcon(const wxIcon& icon);
|
||||
virtual void SetIcons(const wxIconBundle& icons );
|
||||
|
||||
// Override wxFrame operations
|
||||
void CaptureMouse();
|
||||
|
@@ -55,6 +55,7 @@ public:
|
||||
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);
|
||||
|
@@ -67,6 +67,8 @@ public:
|
||||
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
|
||||
|
@@ -23,7 +23,7 @@
|
||||
#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;
|
||||
@@ -83,10 +83,16 @@ public:
|
||||
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;
|
||||
@@ -133,7 +139,7 @@ protected:
|
||||
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)
|
||||
|
@@ -123,7 +123,8 @@ public:
|
||||
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
|
||||
// --------------------------
|
||||
|
33
include/wx/unix/utilsx11.h
Normal file
33
include/wx/unix/utilsx11.h
Normal file
@@ -0,0 +1,33 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// 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_
|
@@ -65,7 +65,8 @@ enum wxFSIconType
|
||||
wxFS_VOL_ICO_MAX
|
||||
};
|
||||
|
||||
WX_DECLARE_EXPORTED_OBJARRAY(wxIcon, wxIconArray);
|
||||
// already in wx/iconbndl.h
|
||||
// WX_DECLARE_EXPORTED_OBJARRAY(wxIcon, wxIconArray);
|
||||
|
||||
#endif // wxUSE_GUI
|
||||
|
||||
|
@@ -54,7 +54,8 @@ public:
|
||||
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 );
|
||||
@@ -72,6 +73,9 @@ protected:
|
||||
// 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;
|
||||
|
114
src/common/iconbndl.cpp
Normal file
114
src/common/iconbndl.cpp
Normal file
@@ -0,0 +1,114 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// 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 );
|
||||
}
|
@@ -104,6 +104,7 @@ ALL_SOURCES = \
|
||||
common/hashmap.cpp \
|
||||
common/helpbase.cpp \
|
||||
common/http.cpp \
|
||||
common/iconbndl.cpp \
|
||||
common/imagall.cpp \
|
||||
common/imagbmp.cpp \
|
||||
common/image.cpp \
|
||||
@@ -244,6 +245,7 @@ ALL_SOURCES = \
|
||||
unix/snglinst.cpp \
|
||||
unix/threadpsx.cpp \
|
||||
unix/utilsunx.cpp \
|
||||
unix/utilsx11.cpp \
|
||||
html/helpctrl.cpp \
|
||||
html/helpdata.cpp \
|
||||
html/helpfrm.cpp \
|
||||
@@ -367,6 +369,7 @@ ALL_HEADERS = \
|
||||
helphtml.h \
|
||||
helpwin.h \
|
||||
icon.h \
|
||||
iconbndl.h \
|
||||
imagbmp.h \
|
||||
image.h \
|
||||
imaggif.h \
|
||||
@@ -604,6 +607,7 @@ ALL_HEADERS = \
|
||||
unix/fontutil.h \
|
||||
unix/gsockunx.h \
|
||||
unix/mimetype.h \
|
||||
unix/utilsx11.h \
|
||||
html/forcelnk.h \
|
||||
html/helpctrl.h \
|
||||
html/helpdata.h \
|
||||
@@ -680,6 +684,7 @@ COMMONOBJS = \
|
||||
hashmap.o \
|
||||
helpbase.o \
|
||||
http.o \
|
||||
iconbndl.o \
|
||||
imagall.o \
|
||||
imagbmp.o \
|
||||
image.o \
|
||||
@@ -947,7 +952,8 @@ UNIXOBJS = \
|
||||
mimetype.o \
|
||||
snglinst.o \
|
||||
threadpsx.o \
|
||||
utilsunx.o
|
||||
utilsunx.o \
|
||||
utilsx11.o
|
||||
|
||||
HTMLOBJS = \
|
||||
helpctrl.o \
|
||||
|
@@ -349,7 +349,9 @@ int wxSystemSettingsNative::GetMetric( wxSystemMetric index )
|
||||
// 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;
|
||||
|
@@ -38,6 +38,8 @@
|
||||
|
||||
#include "wx/gtk/win_gtk.h"
|
||||
|
||||
#include "wx/unix/utilsx11.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// idle system
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -814,13 +816,9 @@ void wxTopLevelWindowGTK::SetTitle( const wxString &title )
|
||||
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)
|
||||
@@ -833,6 +831,24 @@ void wxTopLevelWindowGTK::SetIcon( const wxIcon &icon )
|
||||
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
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@@ -104,6 +104,7 @@ ALL_SOURCES = \
|
||||
common/hashmap.cpp \
|
||||
common/helpbase.cpp \
|
||||
common/http.cpp \
|
||||
common/iconbndl.cpp \
|
||||
common/imagall.cpp \
|
||||
common/imagbmp.cpp \
|
||||
common/image.cpp \
|
||||
@@ -244,6 +245,7 @@ ALL_SOURCES = \
|
||||
unix/snglinst.cpp \
|
||||
unix/threadpsx.cpp \
|
||||
unix/utilsunx.cpp \
|
||||
unix/utilsx11.cpp \
|
||||
html/helpctrl.cpp \
|
||||
html/helpdata.cpp \
|
||||
html/helpfrm.cpp \
|
||||
@@ -367,6 +369,7 @@ ALL_HEADERS = \
|
||||
helphtml.h \
|
||||
helpwin.h \
|
||||
icon.h \
|
||||
iconbndl.h \
|
||||
imagbmp.h \
|
||||
image.h \
|
||||
imaggif.h \
|
||||
@@ -604,6 +607,7 @@ ALL_HEADERS = \
|
||||
unix/fontutil.h \
|
||||
unix/gsockunx.h \
|
||||
unix/mimetype.h \
|
||||
unix/utilsx11.h \
|
||||
html/forcelnk.h \
|
||||
html/helpctrl.h \
|
||||
html/helpdata.h \
|
||||
@@ -680,6 +684,7 @@ COMMONOBJS = \
|
||||
hashmap.o \
|
||||
helpbase.o \
|
||||
http.o \
|
||||
iconbndl.o \
|
||||
imagall.o \
|
||||
imagbmp.o \
|
||||
image.o \
|
||||
@@ -947,7 +952,8 @@ UNIXOBJS = \
|
||||
mimetype.o \
|
||||
snglinst.o \
|
||||
threadpsx.o \
|
||||
utilsunx.o
|
||||
utilsunx.o \
|
||||
utilsx11.o
|
||||
|
||||
HTMLOBJS = \
|
||||
helpctrl.o \
|
||||
|
@@ -349,7 +349,9 @@ int wxSystemSettingsNative::GetMetric( wxSystemMetric index )
|
||||
// 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;
|
||||
|
@@ -38,6 +38,8 @@
|
||||
|
||||
#include "wx/gtk/win_gtk.h"
|
||||
|
||||
#include "wx/unix/utilsx11.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// idle system
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -814,13 +816,9 @@ void wxTopLevelWindowGTK::SetTitle( const wxString &title )
|
||||
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)
|
||||
@@ -833,6 +831,24 @@ void wxTopLevelWindowGTK::SetIcon( const wxIcon &icon )
|
||||
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
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@@ -101,6 +101,7 @@ ALL_SOURCES = \
|
||||
common/hashmap.cpp \
|
||||
common/helpbase.cpp \
|
||||
common/http.cpp \
|
||||
common/iconbndl.cpp \
|
||||
common/imagall.cpp \
|
||||
common/imagbmp.cpp \
|
||||
common/image.cpp \
|
||||
@@ -374,6 +375,7 @@ ALL_HEADERS = \
|
||||
helphtml.h \
|
||||
helpwin.h \
|
||||
icon.h \
|
||||
iconbndl.h \
|
||||
imagbmp.h \
|
||||
image.h \
|
||||
imaggif.h \
|
||||
@@ -631,6 +633,7 @@ ALL_HEADERS = \
|
||||
unix/fontutil.h \
|
||||
unix/gsockunx.h \
|
||||
unix/mimetype.h \
|
||||
unix/utilsx11.h \
|
||||
html/forcelnk.h \
|
||||
html/helpctrl.h \
|
||||
html/helpdata.h \
|
||||
@@ -707,6 +710,7 @@ COMMONOBJS = \
|
||||
hashmap.o \
|
||||
helpbase.o \
|
||||
http.o \
|
||||
iconbndl.o \
|
||||
imagall.o \
|
||||
imagbmp.o \
|
||||
image.o \
|
||||
|
@@ -101,6 +101,7 @@ ALL_SOURCES = \
|
||||
common/hashmap.cpp \
|
||||
common/helpbase.cpp \
|
||||
common/http.cpp \
|
||||
common/iconbndl.cpp \
|
||||
common/imagall.cpp \
|
||||
common/imagbmp.cpp \
|
||||
common/image.cpp \
|
||||
@@ -374,6 +375,7 @@ ALL_HEADERS = \
|
||||
helphtml.h \
|
||||
helpwin.h \
|
||||
icon.h \
|
||||
iconbndl.h \
|
||||
imagbmp.h \
|
||||
image.h \
|
||||
imaggif.h \
|
||||
@@ -631,6 +633,7 @@ ALL_HEADERS = \
|
||||
unix/fontutil.h \
|
||||
unix/gsockunx.h \
|
||||
unix/mimetype.h \
|
||||
unix/utilsx11.h \
|
||||
html/forcelnk.h \
|
||||
html/helpctrl.h \
|
||||
html/helpdata.h \
|
||||
@@ -707,6 +710,7 @@ COMMONOBJS = \
|
||||
hashmap.o \
|
||||
helpbase.o \
|
||||
http.o \
|
||||
iconbndl.o \
|
||||
imagall.o \
|
||||
imagbmp.o \
|
||||
image.o \
|
||||
|
@@ -41,7 +41,7 @@ wxUSE_GUI=1
|
||||
!if "$(wxUSE_GUI)" == "1"
|
||||
|
||||
#!if "$(WXUSINGDLL)" == "1"
|
||||
#DUMMYOBJ=
|
||||
DUMMYOBJ=
|
||||
#!endif
|
||||
|
||||
$(PROGRAM).exe: $(WXLIB) $(OBJECTS) $(PROGRAM).res
|
||||
|
@@ -104,6 +104,7 @@ ALL_SOURCES = \
|
||||
common/hashmap.cpp \
|
||||
common/helpbase.cpp \
|
||||
common/http.cpp \
|
||||
common/iconbndl.cpp \
|
||||
common/imagall.cpp \
|
||||
common/imagbmp.cpp \
|
||||
common/image.cpp \
|
||||
@@ -329,6 +330,7 @@ ALL_HEADERS = \
|
||||
helphtml.h \
|
||||
helpwin.h \
|
||||
icon.h \
|
||||
iconbndl.h \
|
||||
imagbmp.h \
|
||||
image.h \
|
||||
imaggif.h \
|
||||
@@ -504,6 +506,7 @@ ALL_HEADERS = \
|
||||
unix/fontutil.h \
|
||||
unix/gsockunx.h \
|
||||
unix/mimetype.h \
|
||||
unix/utilsx11.h \
|
||||
html/forcelnk.h \
|
||||
html/helpctrl.h \
|
||||
html/helpdata.h \
|
||||
@@ -581,6 +584,7 @@ COMMONOBJS = \
|
||||
hashmap.o \
|
||||
helpbase.o \
|
||||
http.o \
|
||||
iconbndl.o \
|
||||
imagall.o \
|
||||
imagbmp.o \
|
||||
image.o \
|
||||
|
@@ -101,6 +101,7 @@ ALL_SOURCES = \
|
||||
common/hashmap.cpp \
|
||||
common/helpbase.cpp \
|
||||
common/http.cpp \
|
||||
common/iconbndl.cpp \
|
||||
common/imagall.cpp \
|
||||
common/imagbmp.cpp \
|
||||
common/image.cpp \
|
||||
@@ -329,6 +330,7 @@ ALL_HEADERS = \
|
||||
helphtml.h \
|
||||
helpwin.h \
|
||||
icon.h \
|
||||
iconbndl.h \
|
||||
imagbmp.h \
|
||||
image.h \
|
||||
imaggif.h \
|
||||
@@ -598,6 +600,7 @@ ALL_HEADERS = \
|
||||
unix/fontutil.h \
|
||||
unix/gsockunx.h \
|
||||
unix/mimetype.h \
|
||||
unix/utilsx11.h \
|
||||
html/forcelnk.h \
|
||||
html/helpctrl.h \
|
||||
html/helpdata.h \
|
||||
@@ -674,6 +677,7 @@ COMMONOBJS = \
|
||||
hashmap.o \
|
||||
helpbase.o \
|
||||
http.o \
|
||||
iconbndl.o \
|
||||
imagall.o \
|
||||
imagbmp.o \
|
||||
image.o \
|
||||
|
@@ -103,6 +103,7 @@ ALL_SOURCES = \
|
||||
common/hashmap.cpp \
|
||||
common/helpbase.cpp \
|
||||
common/http.cpp \
|
||||
common/iconbndl.cpp \
|
||||
common/imagall.cpp \
|
||||
common/imagbmp.cpp \
|
||||
common/image.cpp \
|
||||
@@ -235,6 +236,7 @@ ALL_SOURCES = \
|
||||
unix/snglinst.cpp \
|
||||
unix/threadpsx.cpp \
|
||||
unix/utilsunx.cpp \
|
||||
unix/utilsx11.cpp \
|
||||
html/helpctrl.cpp \
|
||||
html/helpdata.cpp \
|
||||
html/helpfrm.cpp \
|
||||
@@ -358,6 +360,7 @@ ALL_HEADERS = \
|
||||
helphtml.h \
|
||||
helpwin.h \
|
||||
icon.h \
|
||||
iconbndl.h \
|
||||
imagbmp.h \
|
||||
image.h \
|
||||
imaggif.h \
|
||||
@@ -592,6 +595,7 @@ ALL_HEADERS = \
|
||||
unix/fontutil.h \
|
||||
unix/gsockunx.h \
|
||||
unix/mimetype.h \
|
||||
unix/utilsx11.h \
|
||||
html/forcelnk.h \
|
||||
html/helpctrl.h \
|
||||
html/helpdata.h \
|
||||
@@ -668,6 +672,7 @@ COMMONOBJS = \
|
||||
hashmap.o \
|
||||
helpbase.o \
|
||||
http.o \
|
||||
iconbndl.o \
|
||||
imagall.o \
|
||||
imagbmp.o \
|
||||
image.o \
|
||||
@@ -852,7 +857,8 @@ UNIXOBJS = \
|
||||
mimetype.o \
|
||||
snglinst.o \
|
||||
threadpsx.o \
|
||||
utilsunx.o
|
||||
utilsunx.o \
|
||||
utilsx11.o
|
||||
|
||||
HTMLOBJS = \
|
||||
helpctrl.o \
|
||||
|
@@ -50,6 +50,7 @@
|
||||
|
||||
#include <Xm/Xm.h>
|
||||
#include <X11/Shell.h>
|
||||
#include <X11/Core.h>
|
||||
#if XmVersion >= 1002
|
||||
#include <Xm/XmAll.h>
|
||||
#else
|
||||
@@ -73,6 +74,7 @@
|
||||
#endif
|
||||
|
||||
#include "wx/motif/private.h"
|
||||
#include "wx/unix/utilsx11.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// private functions
|
||||
@@ -627,10 +629,8 @@ void wxFrame::SetTitle(const wxString& title)
|
||||
NULL);
|
||||
}
|
||||
|
||||
void wxFrame::SetIcon(const wxIcon& icon)
|
||||
void wxFrame::DoSetIcon(const wxIcon& icon)
|
||||
{
|
||||
m_icon = icon;
|
||||
|
||||
if (!m_frameShell)
|
||||
return;
|
||||
|
||||
@@ -640,6 +640,23 @@ void wxFrame::SetIcon(const wxIcon& icon)
|
||||
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)
|
||||
|
@@ -527,14 +527,20 @@ void wxMDIChildFrame::SetMenuBar(wxMenuBar *menuBar)
|
||||
// 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;
|
||||
|
@@ -88,6 +88,7 @@ ALL_SOURCES = \
|
||||
common/hashmap.cpp \
|
||||
common/helpbase.cpp \
|
||||
common/http.cpp \
|
||||
common/iconbndl.cpp \
|
||||
common/imagall.cpp \
|
||||
common/imagbmp.cpp \
|
||||
common/image.cpp \
|
||||
@@ -389,6 +390,7 @@ ALL_HEADERS = \
|
||||
helphtml.h \
|
||||
helpwin.h \
|
||||
icon.h \
|
||||
iconbndl.h \
|
||||
imagbmp.h \
|
||||
image.h \
|
||||
imaggif.h \
|
||||
@@ -666,6 +668,7 @@ ALL_HEADERS = \
|
||||
unix/fontutil.h \
|
||||
unix/gsockunx.h \
|
||||
unix/mimetype.h \
|
||||
unix/utilsx11.h \
|
||||
html/forcelnk.h \
|
||||
html/helpctrl.h \
|
||||
html/helpdata.h \
|
||||
@@ -742,6 +745,7 @@ COMMONOBJS = \
|
||||
hashmap.o \
|
||||
helpbase.o \
|
||||
http.o \
|
||||
iconbndl.o \
|
||||
imagall.o \
|
||||
imagbmp.o \
|
||||
image.o \
|
||||
|
@@ -602,7 +602,8 @@ bool wxFrame::HandlePaint()
|
||||
#ifndef __WXMICROWIN__
|
||||
if ( m_iconized )
|
||||
{
|
||||
HICON hIcon = m_icon.Ok() ? GetHiconOf(m_icon)
|
||||
const wxIcon& icon = GetIcon();
|
||||
HICON hIcon = icon.Ok() ? GetHiconOf(icon)
|
||||
: (HICON)GetDefaultIcon();
|
||||
|
||||
// Hold a pointer to the dc so long as the OnPaint() message
|
||||
@@ -837,7 +838,8 @@ long wxFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
|
||||
|
||||
case WM_QUERYDRAGICON:
|
||||
{
|
||||
HICON hIcon = m_icon.Ok() ? GetHiconOf(m_icon)
|
||||
const wxIcon& icon = GetIcon();
|
||||
HICON hIcon = icon.Ok() ? GetHiconOf(icon)
|
||||
: (HICON)GetDefaultIcon();
|
||||
rc = (long)hIcon;
|
||||
processed = rc != 0;
|
||||
|
@@ -171,6 +171,7 @@ COMMONOBJS = \
|
||||
$(MSWDIR)\hashmap.obj \
|
||||
$(MSWDIR)\helpbase.obj \
|
||||
$(MSWDIR)\http.obj \
|
||||
$(MSWDIR)\iconbndl.obj \
|
||||
$(MSWDIR)\imagall.obj \
|
||||
$(MSWDIR)\imagbmp.obj \
|
||||
$(MSWDIR)\image.obj \
|
||||
@@ -763,6 +764,8 @@ $(MSWDIR)\helpbase.obj: $(COMMDIR)\helpbase.$(SRCSUFF)
|
||||
|
||||
$(MSWDIR)\http.obj: $(COMMDIR)\http.$(SRCSUFF)
|
||||
|
||||
$(MSWDIR)\iconbndl.obj: $(COMMDIR)\iconbndl.$(SRCSUFF)
|
||||
|
||||
$(MSWDIR)\imagall.obj: $(COMMDIR)\imagall.$(SRCSUFF)
|
||||
|
||||
$(MSWDIR)\imagbmp.obj: $(COMMDIR)\imagbmp.$(SRCSUFF)
|
||||
|
@@ -157,6 +157,7 @@ COMMONOBJS = \
|
||||
$(MSWDIR)\hash.obj \
|
||||
$(MSWDIR)\hashmap.obj \
|
||||
$(MSWDIR)\helpbase.obj \
|
||||
$(MSWDIR)\iconbndl.obj \
|
||||
$(MSWDIR)\imagall.obj \
|
||||
$(MSWDIR)\imagbmp.obj \
|
||||
$(MSWDIR)\image.obj \
|
||||
@@ -615,6 +616,8 @@ $(MSWDIR)\hashmap.obj: $(COMMDIR)\hashmap.$(SRCSUFF)
|
||||
|
||||
$(MSWDIR)\helpbase.obj: $(COMMDIR)\helpbase.$(SRCSUFF)
|
||||
|
||||
$(MSWDIR)\iconbndl.obj: $(COMMDIR)\iconbndl.$(SRCSUFF)
|
||||
|
||||
$(MSWDIR)\imagall.obj: $(COMMDIR)\imagall.$(SRCSUFF)
|
||||
|
||||
$(MSWDIR)\imagbmp.obj: $(COMMDIR)\imagbmp.$(SRCSUFF)
|
||||
|
@@ -142,6 +142,7 @@ COMMONOBJS1 = \
|
||||
$(COMMDIR)\hash.obj \
|
||||
$(COMMDIR)\hashmap.obj \
|
||||
$(COMMDIR)\helpbase.obj \
|
||||
$(COMMDIR)\iconbndl.obj \
|
||||
$(COMMDIR)\imagall.obj \
|
||||
$(COMMDIR)\imagbmp.obj \
|
||||
$(COMMDIR)\image.obj \
|
||||
@@ -1057,6 +1058,11 @@ $(COMMDIR)/helpbase.obj: $*.$(SRCSUFF)
|
||||
$(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)
|
||||
|
@@ -210,6 +210,7 @@ COMMONOBJS = \
|
||||
$(COMMDIR)/geometry.$(OBJSUFF) \
|
||||
$(COMMDIR)/gifdecod.$(OBJSUFF) \
|
||||
$(COMMDIR)/helpbase.$(OBJSUFF) \
|
||||
$(COMMDIR)/iconbndl.$(OBJSUFF) \
|
||||
$(COMMDIR)/imagall.$(OBJSUFF) \
|
||||
$(COMMDIR)/imagbmp.$(OBJSUFF) \
|
||||
$(COMMDIR)/image.$(OBJSUFF) \
|
||||
|
@@ -115,6 +115,7 @@ COMMONOBJS = \
|
||||
$(COMMDIR)\hashmap.obj \
|
||||
$(COMMDIR)\helpbase.obj \
|
||||
$(COMMDIR)\http.obj \
|
||||
$(COMMDIR)\iconbndl.obj \
|
||||
$(COMMDIR)\imagall.obj \
|
||||
$(COMMDIR)\imagbmp.obj \
|
||||
$(COMMDIR)\image.obj \
|
||||
|
@@ -191,6 +191,7 @@ COMMONOBJS = \
|
||||
$(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 \
|
||||
|
@@ -153,6 +153,7 @@ COMMONOBJS = &
|
||||
hashmap.obj &
|
||||
helpbase.obj &
|
||||
http.obj &
|
||||
iconbndl.obj &
|
||||
imagall.obj &
|
||||
imagbmp.obj &
|
||||
image.obj &
|
||||
@@ -903,6 +904,9 @@ helpbase.obj: $(COMMDIR)\helpbase.cpp
|
||||
http.obj: $(COMMDIR)\http.cpp
|
||||
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
|
||||
|
||||
iconbndl.obj: $(COMMDIR)\iconbndl.cpp
|
||||
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
|
||||
|
||||
imagall.obj: $(COMMDIR)\imagall.cpp
|
||||
*$(CCC) $(CPPFLAGS) $(IFLAGS) $<
|
||||
|
||||
|
@@ -584,14 +584,26 @@ bool wxTopLevelWindowMSW::ShowFullScreen(bool show, long style)
|
||||
|
||||
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(GetHwnd(), WM_SETICON,
|
||||
(WPARAM)TRUE, (LPARAM)GetHiconOf(m_icon));
|
||||
::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( GetHwndOf( this ), WM_SETICON, ICON_BIG,
|
||||
(LPARAM)GetHiconOf(big) );
|
||||
}
|
||||
#endif // __WIN95__
|
||||
}
|
||||
|
@@ -109,7 +109,8 @@ static FileInfoMap s_fileInfo(25);
|
||||
// Other initialization.
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
#if wxUSE_GUI
|
||||
WX_DEFINE_OBJARRAY(wxIconArray);
|
||||
// already in wx/iconbndl.h
|
||||
// WX_DEFINE_OBJARRAY(wxIconArray);
|
||||
#endif
|
||||
|
||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
|
@@ -97,6 +97,7 @@ ALL_SOURCES = \
|
||||
common/hashmap.cpp \
|
||||
common/helpbase.cpp \
|
||||
common/http.cpp \
|
||||
common/iconbndl.cpp \
|
||||
common/imagall.cpp \
|
||||
common/imagbmp.cpp \
|
||||
common/image.cpp \
|
||||
@@ -368,6 +369,7 @@ ALL_HEADERS = \
|
||||
helphtml.h \
|
||||
helpwin.h \
|
||||
icon.h \
|
||||
iconbndl.h \
|
||||
imagbmp.h \
|
||||
image.h \
|
||||
imaggif.h \
|
||||
@@ -688,6 +690,7 @@ COMMONOBJS = \
|
||||
hashmap.o \
|
||||
helpbase.o \
|
||||
http.o \
|
||||
iconbndl.o \
|
||||
imagall.o \
|
||||
imagbmp.o \
|
||||
image.o \
|
||||
|
@@ -296,13 +296,14 @@ int wxTopLevelWindow::GetMinHeight() const
|
||||
// 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;
|
||||
|
89
src/unix/utilsx11.cpp
Normal file
89
src/unix/utilsx11.cpp
Normal file
@@ -0,0 +1,89 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// 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
|
@@ -309,6 +309,10 @@ SOURCE=.\common\http.cpp
|
||||
# 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
|
||||
@@ -1626,6 +1630,10 @@ SOURCE=..\include\wx\icon.h
|
||||
# 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
|
||||
|
@@ -468,6 +468,10 @@ SOURCE=.\common\http.cpp
|
||||
# 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
|
||||
@@ -1906,6 +1910,10 @@ SOURCE=..\include\wx\icon.h
|
||||
# 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
|
||||
|
@@ -1,4 +1,4 @@
|
||||
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!
|
||||
|
||||
###############################################################################
|
||||
@@ -59,21 +59,6 @@ Package=<5>
|
||||
|
||||
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
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
@@ -135,6 +135,7 @@ ALL_SOURCES = \
|
||||
common/hashmap.cpp \
|
||||
common/helpbase.cpp \
|
||||
common/http.cpp \
|
||||
common/iconbndl.cpp \
|
||||
common/imagall.cpp \
|
||||
common/imagbmp.cpp \
|
||||
common/image.cpp \
|
||||
@@ -214,6 +215,7 @@ ALL_SOURCES = \
|
||||
unix/snglinst.cpp \
|
||||
unix/threadpsx.cpp \
|
||||
unix/utilsunx.cpp \
|
||||
unix/utilsx11.cpp \
|
||||
html/helpctrl.cpp \
|
||||
html/helpdata.cpp \
|
||||
html/helpfrm.cpp \
|
||||
@@ -337,6 +339,7 @@ ALL_HEADERS = \
|
||||
helphtml.h \
|
||||
helpwin.h \
|
||||
icon.h \
|
||||
iconbndl.h \
|
||||
imagbmp.h \
|
||||
image.h \
|
||||
imaggif.h \
|
||||
@@ -583,6 +586,7 @@ ALL_HEADERS = \
|
||||
unix/fontutil.h \
|
||||
unix/gsockunx.h \
|
||||
unix/mimetype.h \
|
||||
unix/utilsx11.h \
|
||||
html/forcelnk.h \
|
||||
html/helpctrl.h \
|
||||
html/helpdata.h \
|
||||
@@ -693,6 +697,7 @@ COMMONOBJS = \
|
||||
hashmap.o \
|
||||
helpbase.o \
|
||||
http.o \
|
||||
iconbndl.o \
|
||||
imagall.o \
|
||||
imagbmp.o \
|
||||
image.o \
|
||||
@@ -821,7 +826,8 @@ UNIXOBJS = \
|
||||
mimetype.o \
|
||||
snglinst.o \
|
||||
threadpsx.o \
|
||||
utilsunx.o
|
||||
utilsunx.o \
|
||||
utilsx11.o
|
||||
|
||||
HTMLOBJS = \
|
||||
helpctrl.o \
|
||||
|
@@ -43,6 +43,8 @@
|
||||
#include "wx/x11/private.h"
|
||||
#include "X11/Xutil.h"
|
||||
|
||||
#include "wx/unix/utilsx11.h"
|
||||
|
||||
bool wxMWMIsRunning(Window w);
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -393,11 +395,8 @@ bool wxTopLevelWindowX11::ShowFullScreen(bool show, long style)
|
||||
// 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
|
||||
@@ -419,6 +418,15 @@ void wxTopLevelWindowX11::SetIcon(const wxIcon& icon)
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
Reference in New Issue
Block a user