]> git.saurik.com Git - wxWidgets.git/blame - include/wx/iconbndl.h
Move constant strings to .rodata/.data.rel.ro ELF segment from .data by making them...
[wxWidgets.git] / include / wx / iconbndl.h
CommitLineData
f618020a
MB
1///////////////////////////////////////////////////////////////////////////////
2// Name: wx/iconbndl.h
3// Purpose: wxIconBundle
4// Author: Mattia barbon
5// Modified by:
6// Created: 23.03.02
7// RCS-ID: $Id$
8// Copyright: (c) Mattia Barbon
65571936 9// Licence: wxWindows licence
f618020a
MB
10///////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_ICONBNDL_H_
13#define _WX_ICONBNDL_H_
14
32f96f74 15#include "wx/dynarray.h"
f618020a
MB
16// for wxSize
17#include "wx/gdicmn.h"
18
62a9d04c
VS
19class WXDLLIMPEXP_CORE wxIcon;
20class WXDLLIMPEXP_BASE wxString;
f618020a
MB
21
22WX_DECLARE_EXPORTED_OBJARRAY( wxIcon, wxIconArray );
23
24// this class can't load bitmaps of type wxBITMAP_TYPE_ICO_RESOURCE,
25// if you need them, you have to load them manually and call
26// wxIconCollection::AddIcon
27class WXDLLEXPORT wxIconBundle
28{
29public:
30 // default constructor
d84afea9 31 wxIconBundle() : m_icons() {}
f618020a 32 // initializes the bundle with the icon(s) found in the file
d84afea9 33 wxIconBundle( const wxString& file, long type ) : m_icons()
f618020a
MB
34 { AddIcon( file, type ); }
35 // initializes the bundle with a single icon
d84afea9 36 wxIconBundle( const wxIcon& icon ) : m_icons()
f618020a
MB
37 { AddIcon( icon ); }
38
39 const wxIconBundle& operator =( const wxIconBundle& ic );
d84afea9 40 wxIconBundle( const wxIconBundle& ic ) : m_icons()
f618020a
MB
41 { *this = ic; }
42
43 ~wxIconBundle() { DeleteIcons(); }
44
45 // adds all the icons contained in the file to the collection,
46 // if the collection already contains icons with the same
47 // width and height, they are replaced
48 void AddIcon( const wxString& file, long type );
49 // adds the icon to the collection, if the collection already
50 // contains an icon with the same width and height, it is
51 // replaced
52 void AddIcon( const wxIcon& icon );
53
54 // returns the icon with the given size; if no such icon exists,
55 // returns the icon with size wxSYS_ICON_[XY]; if no such icon exists,
56 // returns the first icon in the bundle
57 const wxIcon& GetIcon( const wxSize& size ) const;
58 // equivalent to GetIcon( wxSize( size, size ) )
7beb59f3 59 const wxIcon& GetIcon( wxCoord size = wxDefaultCoord ) const
f618020a
MB
60 { return GetIcon( wxSize( size, size ) ); }
61private:
62 // delete all icons
63 void DeleteIcons();
64public:
65 wxIconArray m_icons;
66};
67
68#endif
69 // _WX_ICONBNDL_H_