campo-sirio/wxPG/propgrid/docs/html/classwxPGMultiButton.htm
mtollari a3ed46f2c3 Spostamento cartelle da extlib
git-svn-id: svn://10.65.10.50/branches/R_10_00@23289 c028cbd2-c16b-5b4b-a496-9718f37d4682
2016-09-14 21:14:51 +00:00

187 lines
15 KiB
HTML

<!-- This comment will put IE 6, 7 and 8 in quirks mode -->
<!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"/>
<title>wxPropertyGrid: wxPGMultiButton Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javaScript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body onload='searchBox.OnSelectItem(0);'>
<!-- Generated by Doxygen 1.6.3 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Search');
--></script>
<div class="navigation" id="top">
<div class="tabs">
<ul>
<li><a href="index.htm"><span>Main&nbsp;Page</span></a></li>
<li><a href="pages.htm"><span>Related&nbsp;Pages</span></a></li>
<li><a href="modules.htm"><span>Modules</span></a></li>
<li class="current"><a href="annotated.htm"><span>Classes</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<img id="MSearchSelect" src="search/search.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</div>
</li>
</ul>
</div>
<div class="tabs">
<ul>
<li><a href="annotated.htm"><span>Class&nbsp;List</span></a></li>
<li><a href="classes.htm"><span>Class&nbsp;Index</span></a></li>
<li><a href="hierarchy.htm"><span>Class&nbsp;Hierarchy</span></a></li>
<li><a href="functions.htm"><span>Class&nbsp;Members</span></a></li>
</ul>
</div>
</div>
<div class="contents">
<h1>wxPGMultiButton Class Reference</h1><!-- doxytag: class="wxPGMultiButton" -->
<p>This class can be used to have multiple buttons in a property editor.
<a href="#_details">More...</a></p>
<p><code>#include &lt;editors.h&gt;</code></p>
<p><a href="classwxPGMultiButton-members.htm">List of all members.</a></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a552a07b4c393f715a4c41c7831191f07"></a><!-- doxytag: member="wxPGMultiButton::Add" ref="a552a07b4c393f715a4c41c7831191f07" args="(const wxString &amp;label, int id=&#45;2)" -->
void&nbsp;</td><td class="memItemRight" valign="bottom"><b>Add</b> (const wxString &amp;label, int id=-2)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ab0f6fe992314b30b4e5e5c3e77af1b60"></a><!-- doxytag: member="wxPGMultiButton::FinalizePosition" ref="ab0f6fe992314b30b4e5e5c3e77af1b60" args="(const wxPoint &amp;pos)" -->
void&nbsp;</td><td class="memItemRight" valign="bottom"><b>FinalizePosition</b> (const wxPoint &amp;pos)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a294ff2d69b2012376a9667bef7725771"></a><!-- doxytag: member="wxPGMultiButton::GetButton" ref="a294ff2d69b2012376a9667bef7725771" args="(unsigned int i) const " -->
const wxWindow *&nbsp;</td><td class="memItemRight" valign="bottom"><b>GetButton</b> (unsigned int i) const </td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a212fd62c7314b13ebe86de0f4ae544a7"></a><!-- doxytag: member="wxPGMultiButton::GetButton" ref="a212fd62c7314b13ebe86de0f4ae544a7" args="(unsigned int i)" -->
wxWindow *&nbsp;</td><td class="memItemRight" valign="bottom"><b>GetButton</b> (unsigned int i)</td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="acc7a39ae647f377106894f739995ad76"></a><!-- doxytag: member="wxPGMultiButton::GetButtonId" ref="acc7a39ae647f377106894f739995ad76" args="(unsigned int i) const " -->
int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classwxPGMultiButton.htm#acc7a39ae647f377106894f739995ad76">GetButtonId</a> (unsigned int i) const </td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Utility function to be used in event handlers. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a56d63abe46ddabf9102c4b420bb0083a"></a><!-- doxytag: member="wxPGMultiButton::GetCount" ref="a56d63abe46ddabf9102c4b420bb0083a" args="() const " -->
int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classwxPGMultiButton.htm#a56d63abe46ddabf9102c4b420bb0083a">GetCount</a> () const </td></tr>
<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns number of buttons. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a9f6e4cce4afba9fbf4f175724f887df4"></a><!-- doxytag: member="wxPGMultiButton::GetPrimarySize" ref="a9f6e4cce4afba9fbf4f175724f887df4" args="() const " -->
wxSize&nbsp;</td><td class="memItemRight" valign="bottom"><b>GetPrimarySize</b> () const </td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa2fe9ce10254f56e7a2894c45a7f36c5"></a><!-- doxytag: member="wxPGMultiButton::wxPGMultiButton" ref="aa2fe9ce10254f56e7a2894c45a7f36c5" args="(wxPropertyGrid *pg, const wxSize &amp;sz)" -->
&nbsp;</td><td class="memItemRight" valign="bottom"><b>wxPGMultiButton</b> (<a class="el" href="classwxPropertyGrid.htm">wxPropertyGrid</a> *pg, const wxSize &amp;sz)</td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>This class can be used to have multiple buttons in a property editor. </p>
<p>You will need to create a new property editor class, override CreateControls, and have it return <a class="el" href="classwxPGMultiButton.htm" title="This class can be used to have multiple buttons in a property editor.">wxPGMultiButton</a> instance in wxPGWindowList::SetSecondary(). For instance, here we add three buttons to a textctrl editor:</p>
<div class="fragment"><pre class="fragment"><span class="preprocessor"> #include &lt;wx/propgrid/editors.h&gt;</span>
<span class="keyword">class </span>wxMultiButtonTextCtrlEditor : <span class="keyword">public</span> <a class="code" href="classwxPGTextCtrlEditor.htm">wxPGTextCtrlEditor</a>
{
WX_PG_DECLARE_EDITOR_CLASS(wxMultiButtonTextCtrlEditor)
public:
wxMultiButtonTextCtrlEditor() {}
<span class="keyword">virtual</span> ~wxMultiButtonTextCtrlEditor() {}
wxPG_DECLARE_CREATECONTROLS
<span class="keyword">virtual</span> <span class="keywordtype">bool</span> OnEvent( <a class="code" href="classwxPropertyGrid.htm" title="wxPropertyGrid is a specialized two-column grid for editing properties such as strings...">wxPropertyGrid</a>* propGrid,
<a class="code" href="classwxPGProperty.htm" title="wxPGProperty is base class for all wxPropertyGrid properties.">wxPGProperty</a>* property,
wxWindow* ctrl,
wxEvent&amp; event ) <span class="keyword">const</span>;
};
WX_PG_IMPLEMENT_EDITOR_CLASS(MultiButtonTextCtrlEditor, wxMultiButtonTextCtrlEditor,
<a class="code" href="classwxPGTextCtrlEditor.htm">wxPGTextCtrlEditor</a>)
<a class="code" href="classwxPGWindowList.htm">wxPGWindowList</a> wxMultiButtonTextCtrlEditor::CreateControls( <a class="code" href="classwxPropertyGrid.htm" title="wxPropertyGrid is a specialized two-column grid for editing properties such as strings...">wxPropertyGrid</a>* propGrid,
<a class="code" href="classwxPGProperty.htm" title="wxPGProperty is base class for all wxPropertyGrid properties.">wxPGProperty</a>* property,
const wxPoint&amp; pos,
const wxSize&amp; sz )<span class="keyword"> const</span>
<span class="keyword"> </span>{
<span class="comment">// Create and populate buttons-subwindow</span>
<a class="code" href="classwxPGMultiButton.htm" title="This class can be used to have multiple buttons in a property editor.">wxPGMultiButton</a>* buttons = <span class="keyword">new</span> <a class="code" href="classwxPGMultiButton.htm" title="This class can be used to have multiple buttons in a property editor.">wxPGMultiButton</a>( propGrid, sz );
<span class="comment">// Add two regular buttons</span>
buttons-&gt;Add( wxT(<span class="stringliteral">&quot;...&quot;</span>) );
buttons-&gt;Add( wxT(<span class="stringliteral">&quot;A&quot;</span>) );
<span class="comment">// Add a bitmap button</span>
buttons-&gt;Add( wxArtProvider::GetBitmap(wxART_FOLDER) );
<span class="comment">// Create the &#39;primary&#39; editor control (textctrl in this case)</span>
<a class="code" href="classwxPGWindowList.htm">wxPGWindowList</a> wndList = <a class="code" href="classwxPGEditor.htm#a9d33fbd55fe4fe390bdaa826a7ff87e2" title="Instantiates editor controls.">wxPGTextCtrlEditor::CreateControls</a>
( propGrid, property, pos, buttons-&gt;GetPrimarySize() );
<span class="comment">// Finally, move buttons-subwindow to correct position and make sure</span>
<span class="comment">// returned wxPGWindowList contains our custom button list.</span>
buttons-&gt;FinalizePosition(pos);
wndList.SetSecondary( buttons );
<span class="keywordflow">return</span> wndList;
}
<span class="keywordtype">bool</span> wxMultiButtonTextCtrlEditor::OnEvent( <a class="code" href="classwxPropertyGrid.htm" title="wxPropertyGrid is a specialized two-column grid for editing properties such as strings...">wxPropertyGrid</a>* propGrid,
<a class="code" href="classwxPGProperty.htm" title="wxPGProperty is base class for all wxPropertyGrid properties.">wxPGProperty</a>* property,
wxWindow* ctrl,
wxEvent&amp; event )<span class="keyword"> const</span>
<span class="keyword"> </span>{
<span class="keywordflow">if</span> ( event.GetEventType() == wxEVT_COMMAND_BUTTON_CLICKED )
{
<a class="code" href="classwxPGMultiButton.htm" title="This class can be used to have multiple buttons in a property editor.">wxPGMultiButton</a>* buttons = (<a class="code" href="classwxPGMultiButton.htm" title="This class can be used to have multiple buttons in a property editor.">wxPGMultiButton</a>*) propGrid-&gt;<a class="code" href="classwxPropertyGrid.htm#a9c28c9d54f0db5c84a7722c04ab85f02" title="Returns pointer to current active secondary editor control (NULL if none).">GetEditorControlSecondary</a>();
<span class="keywordflow">if</span> ( event.GetId() == buttons-&gt;<a class="code" href="classwxPGMultiButton.htm#acc7a39ae647f377106894f739995ad76" title="Utility function to be used in event handlers.">GetButtonId</a>(0) )
{
<span class="comment">// Do something when first button is pressed,</span>
<span class="comment">// Return true if value in editor changed by this</span>
<span class="comment">// action.</span>
...
}
<span class="keywordflow">if</span> ( event.GetId() == buttons-&gt;<a class="code" href="classwxPGMultiButton.htm#acc7a39ae647f377106894f739995ad76" title="Utility function to be used in event handlers.">GetButtonId</a>(1) )
{
<span class="comment">// Do something when second button is pressed</span>
...
}
<span class="keywordflow">if</span> ( event.GetId() == buttons-&gt;<a class="code" href="classwxPGMultiButton.htm#acc7a39ae647f377106894f739995ad76" title="Utility function to be used in event handlers.">GetButtonId</a>(2) )
{
<span class="comment">// Do something when third button is pressed</span>
...
}
}
<span class="keywordflow">return</span> <a class="code" href="classwxPGEditor.htm#a035fa3bee4ac87e4300df0c637a56261" title="Handles events.">wxPGTextCtrlEditor::OnEvent</a>(propGrid, property, ctrl, event);
}
</pre></div><p>Further to use this editor, code like this can be used:</p>
<div class="fragment"><pre class="fragment"> <span class="comment">// Register editor class - needs only to be called once</span>
wxPGRegisterEditorClass( MultiButtonTextCtrlEditor );
<span class="comment">// Insert the property that will have multiple buttons</span>
propGrid-&gt;<a class="code" href="classwxPropertyGridInterface.htm#a8496963f469db86941157f8ce67896c4" title="Appends property to the list.">Append</a>( <span class="keyword">new</span> <a class="code" href="classwxLongStringProperty.htm" title="Like wxStringProperty, but has a button that triggers a small text editor dialog...">wxLongStringProperty</a>(wxT(<span class="stringliteral">&quot;MultipleButtons&quot;</span>), wxPG_LABEL) );
<span class="comment">// Change property to use editor created in the previous code segment</span>
propGrid-&gt;<a class="code" href="classwxPropertyGridInterface.htm#aff961af9dd2787fb97f510ea5ce46407" title="Sets editor control of a property.">SetPropertyEditor</a>( wxT(<span class="stringliteral">&quot;MultipleButtons&quot;</span>), wxPG_EDITOR(MultiButtonTextCtrlEditor) );
</pre></div> <hr/>The documentation for this class was generated from the following file:<ul>
<li>editors.h</li>
</ul>
</div>
<!--- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&nbsp;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&nbsp;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&nbsp;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&nbsp;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&nbsp;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&nbsp;</span>Enumerator</a></div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<hr class="footer"/><address style="text-align: right;"><small>Generated on Sun Aug 22 12:42:14 2010 for wxPropertyGrid by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>