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 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>wxWidgets: wxPenList Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="extra_stylesheet.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="page_container">
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0" style="width: 100%;">
<tbody>
<tr>
<td id="projectlogo">
<a href="http://www.wxwidgets.org/" target="_new">
<img alt="wxWidgets" src="logo.png"/>
</a>
</td>
<td style="padding-left: 0.5em; text-align: right;">
<span id="projectnumber">Version: 3.0.2</span>
</td>
</tr>
</tbody>
</table>
</div>
<!-- Generated by Doxygen 1.8.2 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="pages.html"><span>Related Pages</span></a></li>
<li><a href="modules.html"><span>Categories</span></a></li>
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
<li><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="annotated.html"><span>Class List</span></a></li>
<li><a href="classes.html"><span>Class Index</span></a></li>
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> |
<a href="classwx_pen_list-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">wxPenList Class Reference<div class="ingroups"><a class="el" href="group__group__class__gdi.html">Graphics Device Interface (GDI)</a></div></div> </div>
</div><!--header-->
<div class="contents">
<p><code>#include <wx/pen.h></code></p>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>There is only one instance of this class: <a class="el" href="pen_8h.html#a9eb4c70a69dd5c289c6c53b0da13f48b" title="The global list of wxPen objects ready to be re-used (for better performances).">wxThePenList</a>. </p>
<p>Use this object to search for a previously created pen of the desired type and create it if not already found. In some windowing systems, the pen may be a scarce resource, so it can pay to reuse old resources if possible. When an application finishes, all pens 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>
<p>There are two mechanisms in recent versions of wxWidgets which make the pen 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 pen, because the referencing counting does it for you. For example, you can set a pen in a device context, and then immediately delete the pen you passed, because the pen is 'copied'.</p>
<p>So you may find it easier to ignore the pen list, and instead create and copy pens 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>
<p>The only compelling use for the pen list is for wxWidgets to keep track of pens in order to clean them up on exit. It is also kept for backward compatibility with earlier versions of wxWidgets.</p>
<h2></h2>
<div><span class="lib">Library:</span>  <span class="lib_text"><a class="el" href="page_libs.html#page_libs_wxcore">wxCore</a></span></div><div><span class="category">Category:</span>  <span class="category_text"><a class="el" href="group__group__class__gdi.html">Graphics Device Interface (GDI)</a></span></div><p><span class="stdobj">Predefined objects/pointers:</span> <a class="el" href="pen_8h.html#a9eb4c70a69dd5c289c6c53b0da13f48b" title="The global list of wxPen objects ready to be re-used (for better performances).">wxThePenList</a></p>
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classwx_pen.html" title="A pen is a drawing tool for drawing outlines.">wxPen</a> </dd></dl>
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:af0244769e4e820f75e12e065b440f66d"><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_pen_list.html#af0244769e4e820f75e12e065b440f66d">wxPenList</a> ()</td></tr>
<tr class="memdesc:af0244769e4e820f75e12e065b440f66d"><td class="mdescLeft"> </td><td class="mdescRight">Constructor. <a href="#af0244769e4e820f75e12e065b440f66d"></a><br/></td></tr>
<tr class="separator:af0244769e4e820f75e12e065b440f66d"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:ab350d769f4a3b89dc275cef1f6dbd17c"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classwx_pen.html">wxPen</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="classwx_pen_list.html#ab350d769f4a3b89dc275cef1f6dbd17c">FindOrCreatePen</a> (const <a class="el" href="classwx_colour.html">wxColour</a> &colour, int width=1, <a class="el" href="pen_8h.html#aebe64277219894a55d6b963607ad5f54">wxPenStyle</a> style=<a class="el" href="pen_8h.html#aebe64277219894a55d6b963607ad5f54a133ea384ff4d033977dfe59627b4cfce">wxPENSTYLE_SOLID</a>)</td></tr>
<tr class="memdesc:ab350d769f4a3b89dc275cef1f6dbd17c"><td class="mdescLeft"> </td><td class="mdescRight">Finds a pen with the specified attributes and returns it, else creates a new pen, adds it to the pen list, and returns it. <a href="#ab350d769f4a3b89dc275cef1f6dbd17c"></a><br/></td></tr>
<tr class="separator:ab350d769f4a3b89dc275cef1f6dbd17c"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<h2 class="groupheader">Constructor & Destructor Documentation</h2>
<a class="anchor" id="af0244769e4e820f75e12e065b440f66d"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">wxPenList::wxPenList </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Constructor. </p>
<p>The application should not construct its own pen list: use the object pointer <a class="el" href="pen_8h.html#a9eb4c70a69dd5c289c6c53b0da13f48b" title="The global list of wxPen objects ready to be re-used (for better performances).">wxThePenList</a>. </p>
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="ab350d769f4a3b89dc275cef1f6dbd17c"></a>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classwx_pen.html">wxPen</a>* wxPenList::FindOrCreatePen </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classwx_colour.html">wxColour</a> & </td>
<td class="paramname"><em>colour</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">int </td>
<td class="paramname"><em>width</em> = <code>1</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="pen_8h.html#aebe64277219894a55d6b963607ad5f54">wxPenStyle</a> </td>
<td class="paramname"><em>style</em> = <code><a class="el" href="pen_8h.html#aebe64277219894a55d6b963607ad5f54a133ea384ff4d033977dfe59627b4cfce">wxPENSTYLE_SOLID</a></code> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Finds a pen with the specified attributes and returns it, else creates a new pen, adds it to the pen list, and returns it. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">colour</td><td>Colour object. </td></tr>
<tr><td class="paramname">width</td><td>Width of pen. </td></tr>
<tr><td class="paramname">style</td><td>Pen style. See <a class="el" href="pen_8h.html#aebe64277219894a55d6b963607ad5f54" title="The possible styles for a wxPen.">wxPenStyle</a> for a list of styles. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
</div><!-- contents -->
<address class="footer">
<small>
Generated on Thu Nov 27 2014 13:46:52 for wxWidgets by <a href="http://www.doxygen.org/index.html" target="_new">Doxygen</a> 1.8.2
</small>
</address>
<script src="wxwidgets.js" type="text/javascript"></script>
</div><!-- #page_container -->
</body>
</html>
|