File: wx37.htm

package info (click to toggle)
wxwin2-doc 2.01-1
  • links: PTS
  • area: main
  • in suites: potato
  • size: 6,540 kB
  • ctags: 5,968
  • sloc: cpp: 15,157; makefile: 434; sh: 6
file content (95 lines) | stat: -rw-r--r-- 4,497 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<HTML>
<head><title>wxBrushList</title></head>

<BODY BGCOLOR=#FFFFFF>
<A NAME="wxbrushlist"></A><CENTER>
<A HREF="wx.htm"><img align=center src="contents.gif" BORDER=0 ALT="Contents"></A> <A HREF="wx22.htm#classref"><img align=center src="up.gif" BORDER=0 ALT="Up"></A> <A HREF="wx36.htm#wxbrush"><img align=center src="back.gif" BORDER=0 ALT="Previous"></A> <A HREF="wx38.htm#wxcalculatelayoutevent"><img align=center src="forward.gif" BORDER=0 ALT="Next"></A> </CENTER><HR>

<H2>wxBrushList</H2>
<P>
A brush list is a list containing all brushes which have been created.<P>
<B><FONT COLOR="#FF0000">Derived from</FONT></B><P>
<A HREF="wx127.htm#wxlist">wxList</A><BR>

<A HREF="wx158.htm#wxobject">wxObject</A><P>
<B><FONT COLOR="#FF0000">Include files</FONT></B><P>
&lt;wx/gdicmn.h&gt;<P>
<B><FONT COLOR="#FF0000">Remarks</FONT></B><P>
There is only one instance of this class: <B>wxTheBrushList</B>.  Use
this object to search for a previously created brush of the desired
type and create it if not already found. In some windowing systems,
the brush may be a scarce resource, so it can pay to reuse old
resources if possible. When an application finishes, all brushes will
be deleted and their resources freed, eliminating the possibility of
'memory leaks'. However, it is best not to rely on this automatic
cleanup because it can lead to double deletion in some circumstances.<P>
There are two mechanisms in recent versions of wxWindows which make the
brush list less useful than it once was. Under Windows, scarce resources
are cleaned up internally if they are not being used. Also, a referencing
counting mechanism applied to all GDI objects means that some sharing
of underlying resources is possible. You don't have to keep track of pointers,
working out when it is safe delete a brush, because the referencing counting does
it for you. For example, you can set a brush in a device context, and then
immediately delete the brush you passed, because the brush is 'copied'.<P>
So you may find it easier to ignore the brush list, and instead create
and copy brushes as you see fit. If your Windows resource meter suggests
your application is using too many resources, you can resort to using
GDI lists to share objects explicitly.<P>
The only compelling use for the brush list is for wxWindows to keep
track of brushes in order to clean them up on exit. It is also kept for
backward compatibility with earlier versions of wxWindows.<P>
<B><FONT COLOR="#FF0000">See also</FONT></B><P>
<A HREF="wx36.htm#wxbrush">wxBrush</A><P>
<B><FONT COLOR="#FF0000">Members</FONT></B><P>
<A HREF="#wxbrushlistconstr">wxBrushList::wxBrushList</A><BR>
<A HREF="#wxbrushlistaddbrush">wxBrushList::AddBrush</A><BR>
<A HREF="#wxbrushlistfindorcreatebrush">wxBrushList::FindOrCreateBrush</A><BR>
<A HREF="#wxbrushlistremovebrush">wxBrushList::RemoveBrush</A><BR>
<P>

<HR>
<A NAME="wxbrushlistconstr"></A>
<H3>wxBrushList::wxBrushList</H3>
<P>
<B>void</B> <B>wxBrushList</B>()<P>
Constructor. The application should not construct its own brush list:
use the object pointer <B>wxTheBrushList</B>.<P>

<HR>
<A NAME="wxbrushlistaddbrush"></A>
<H3>wxBrushList::AddBrush</H3>
<P>
<B>void</B> <B>AddBrush</B>(<B>wxBrush *</B><I>brush</I>)<P>
Used internally by wxWindows to add a brush to the list.<P>

<HR>
<A NAME="wxbrushlistfindorcreatebrush"></A>
<H3>wxBrushList::FindOrCreateBrush</H3>
<P>
<B>wxBrush *</B> <B>FindOrCreateBrush</B>(<B>const wxColour&amp; </B><I>colour</I>, <B>int</B><I> style</I>)<P>
Finds a brush with the specified attributes and returns it, else creates a new brush, adds it
to the brush list, and returns it.<P>
<B>wxBrush *</B> <B>FindOrCreateBrush</B>(<B>const wxString&amp; </B><I>colourName</I>, <B>int</B><I> style</I>)<P>
Finds a brush with the specified attributes and returns it, else creates a new brush, adds it
to the brush list, and returns it.<P>
Finds a brush of the given specification, or creates one and adds it to the list.<P>
<B><FONT COLOR="#FF0000">Parameters</FONT></B><P>
<I>colour</I><UL><UL>
Colour object.</UL></UL>
<P>
<I>colourName</I><UL><UL>
Colour name, which should be in the colour database.</UL></UL>
<P>
<I>style</I><UL><UL>
Brush style. See <A HREF="wx36.htm#wxbrushsetstyle">wxBrush::SetStyle</A> for a list of styles.</UL></UL>
<P>

<HR>
<A NAME="wxbrushlistremovebrush"></A>
<H3>wxBrushList::RemoveBrush</H3>
<P>
<B>void</B> <B>RemoveBrush</B>(<B>wxBrush *</B><I>brush</I>)<P>
Used by wxWindows to remove a brush from the list.<P>


</BODY></HTML>