1. Stewart Mackenzie
  2. cappuccino-docs

Source

cappuccino-docs / cappuccino docs / cappuccino.org / learn / documentation / _c_p_color_well_8j_source.html

<!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">

<!-- Mirrored from cappuccino.org/learn/documentation/_c_p_color_well_8j_source.html by HTTrack Website Copier/3.x [XR&CO'2006], Mon, 20 Sep 2010 02:19:29 GMT -->
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Cappuccino API: AppKit/CPColorWell.j Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.1 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="main.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
    </ul>
  </div>
<h1>AppKit/CPColorWell.j</h1><a href="_c_p_color_well_8j.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> * CPColorWell.j</span>
<a name="l00003"></a>00003 <span class="comment"> * AppKit</span>
<a name="l00004"></a>00004 <span class="comment"> *</span>
<a name="l00005"></a>00005 <span class="comment"> * Created by Ross Boucher.</span>
<a name="l00006"></a>00006 <span class="comment"> * Copyright 2008, 280 North, Inc.</span>
<a name="l00007"></a>00007 <span class="comment"> *</span>
<a name="l00008"></a>00008 <span class="comment"> * This library is free software; you can redistribute it and/or</span>
<a name="l00009"></a>00009 <span class="comment"> * modify it under the terms of the GNU Lesser General Public</span>
<a name="l00010"></a>00010 <span class="comment"> * License as published by the Free Software Foundation; either</span>
<a name="l00011"></a>00011 <span class="comment"> * version 2.1 of the License, or (at your option) any later version.</span>
<a name="l00012"></a>00012 <span class="comment"> *</span>
<a name="l00013"></a>00013 <span class="comment"> * This library is distributed in the hope that it will be useful,</span>
<a name="l00014"></a>00014 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00015"></a>00015 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span>
<a name="l00016"></a>00016 <span class="comment"> * Lesser General Public License for more details.</span>
<a name="l00017"></a>00017 <span class="comment"> *</span>
<a name="l00018"></a>00018 <span class="comment"> * You should have received a copy of the GNU Lesser General Public</span>
<a name="l00019"></a>00019 <span class="comment"> * License along with this library; if not, write to the Free Software</span>
<a name="l00020"></a>00020 <span class="comment"> * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA</span>
<a name="l00021"></a>00021 <span class="comment"> */</span>
<a name="l00022"></a>00022 
<a name="l00023"></a>00023 @<span class="keyword">import</span> &lt;Foundation/<a class="code" href="class_c_p_string.html" title="An immutable string (collection of characters).">CPString</a>.j&gt;
<a name="l00024"></a>00024 
<a name="l00025"></a>00025 @<span class="keyword">import</span> <span class="stringliteral">&quot;CPView.j&quot;</span>
<a name="l00026"></a>00026 @<span class="keyword">import</span> <span class="stringliteral">&quot;CPColor.j&quot;</span>
<a name="l00027"></a>00027 @<span class="keyword">import</span> <span class="stringliteral">&quot;CPColorPanel.j&quot;</span>
<a name="l00028"></a>00028 
<a name="l00029"></a>00029 
<a name="l00030"></a>00030 var _CPColorWellDidBecomeExclusiveNotification = <span class="stringliteral">@&quot;_CPColorWellDidBecomeExclusiveNotification&quot;</span>;
<a name="l00031"></a>00031 
<a name="l00040"></a><a class="code" href="class_c_p_color_well.html">00040</a> <span class="keyword">@implementation </span><a class="code" href="class_c_p_color_well.html">CPColorWell</a> : <a class="code" href="class_c_p_control.html">CPControl</a>
<a name="l00041"></a>00041 {
<a name="l00042"></a>00042     BOOL    _active;
<a name="l00043"></a>00043     BOOL    _bordered;
<a name="l00044"></a>00044     
<a name="l00045"></a>00045     <a class="code" href="class_c_p_color.html">CPColor</a> _color;
<a name="l00046"></a>00046     <a class="code" href="class_c_p_view.html">CPView</a>  _wellView;
<a name="l00047"></a>00047 }
<a name="l00048"></a>00048 
<a name="l00049"></a><a class="code" href="class_c_p_color_well.html#afbcf2b99ab951ffba127d0c328922c82">00049</a> - (id)initWithFrame:(CGRect)aFrame
<a name="l00050"></a>00050 {
<a name="l00051"></a>00051     <span class="keyword">self</span> = [<span class="keyword">super</span> initWithFrame:aFrame];
<a name="l00052"></a>00052     
<a name="l00053"></a>00053     <span class="keywordflow">if</span> (<span class="keyword">self</span>)
<a name="l00054"></a>00054     {
<a name="l00055"></a>00055         _active = NO;
<a name="l00056"></a>00056         _bordered = YES;
<a name="l00057"></a>00057         _color = [<a class="code" href="class_c_p_color.html">CPColor</a> whiteColor];
<a name="l00058"></a>00058         
<a name="l00059"></a>00059         [<span class="keyword">self</span> <a class="code" href="class_c_p_color_well.html#afb3af37215d1137f87ffdfb6f59d4c64">drawBezelWithHighlight</a>:NO];
<a name="l00060"></a>00060         [<span class="keyword">self</span> <a class="code" href="class_c_p_color_well.html#ab64e195fea57c1b29ec51e35b64ad1e7">drawWellInside</a>:CGRectInset([<span class="keyword">self</span> bounds], 3.0, 3.0)];
<a name="l00061"></a>00061         
<a name="l00062"></a>00062         [<span class="keyword">self</span> _registerForNotifications];
<a name="l00063"></a>00063     }
<a name="l00064"></a>00064     
<a name="l00065"></a>00065     <span class="keywordflow">return</span> <span class="keyword">self</span>;
<a name="l00066"></a>00066 }
<a name="l00067"></a>00067 
<a name="l00068"></a>00068 - (void)_registerForNotifications
<a name="l00069"></a>00069 {
<a name="l00070"></a>00070     var defaultCenter = [<a class="code" href="class_c_p_notification_center.html" title="Sends messages (CPNotification) between objects.">CPNotificationCenter</a> <a class="code" href="class_c_p_notification_center.html#a5abe725f1a1a48ac4cb1e45b6d9d50a8">defaultCenter</a>];
<a name="l00071"></a>00071 
<a name="l00072"></a>00072     [defaultCenter
<a name="l00073"></a>00073         addObserver:self
<a name="l00074"></a>00074            selector:@selector(colorWellDidBecomeExclusive:)
<a name="l00075"></a>00075                name:_CPColorWellDidBecomeExclusiveNotification
<a name="l00076"></a>00076              object:nil];
<a name="l00077"></a>00077 
<a name="l00078"></a>00078     [defaultCenter
<a name="l00079"></a>00079         addObserver:self
<a name="l00080"></a>00080            selector:@selector(colorPanelWillClose:)
<a name="l00081"></a>00081                name:CPWindowWillCloseNotification
<a name="l00082"></a>00082              object:[<a class="code" href="class_c_p_color_panel.html">CPColorPanel</a> <a class="code" href="class_c_p_color_panel.html#aef25bee4d3031443cf89a0d596c62c4a">sharedColorPanel</a>]];
<a name="l00083"></a>00083 }
<a name="l00084"></a>00084 
<a name="l00088"></a><a class="code" href="class_c_p_color_well.html#a71c654093e681ba656ccdc0eef70f206">00088</a> - (BOOL)isBordered
<a name="l00089"></a>00089 {
<a name="l00090"></a>00090     <span class="keywordflow">return</span> _bordered;
<a name="l00091"></a>00091 }
<a name="l00092"></a>00092 
<a name="l00096"></a><a class="code" href="class_c_p_color_well.html#a097f5d1040d49d359df40fccabbd415e">00096</a> - (void)setBordered:(BOOL)bordered
<a name="l00097"></a>00097 {
<a name="l00098"></a>00098     <span class="keywordflow">if</span> (_bordered == bordered)
<a name="l00099"></a>00099         <span class="keywordflow">return</span>;
<a name="l00100"></a>00100         
<a name="l00101"></a>00101     _bordered = bordered;
<a name="l00102"></a>00102     
<a name="l00103"></a>00103     [<span class="keyword">self</span> <a class="code" href="class_c_p_color_well.html#ab64e195fea57c1b29ec51e35b64ad1e7">drawWellInside</a>:CGRectInset([<span class="keyword">self</span> bounds], 3.0, 3.0)];
<a name="l00104"></a>00104 }
<a name="l00105"></a>00105 
<a name="l00106"></a>00106 <span class="comment">// Managing Color From Color Wells</span>
<a name="l00107"></a>00107 
<a name="l00111"></a><a class="code" href="class_c_p_color_well.html#a01c0af93adf3335983d6df2b428a302d">00111</a> - (<a class="code" href="class_c_p_color.html">CPColor</a>)color
<a name="l00112"></a>00112 {
<a name="l00113"></a>00113     <span class="keywordflow">return</span> _color;
<a name="l00114"></a>00114 }
<a name="l00115"></a>00115 
<a name="l00119"></a><a class="code" href="class_c_p_color_well.html#aa31d12b84c88461a057cb69ce047ab6c">00119</a> - (void)setColor:(<a class="code" href="class_c_p_color.html">CPColor</a>)aColor
<a name="l00120"></a>00120 {
<a name="l00121"></a>00121     <span class="keywordflow">if</span> (_color == aColor)
<a name="l00122"></a>00122         <span class="keywordflow">return</span>;
<a name="l00123"></a>00123     
<a name="l00124"></a>00124     _color = aColor;
<a name="l00125"></a>00125     
<a name="l00126"></a>00126     [<span class="keyword">self</span> <a class="code" href="class_c_p_color_well.html#ab64e195fea57c1b29ec51e35b64ad1e7">drawWellInside</a>:CGRectInset([<span class="keyword">self</span> bounds], 3.0, 3.0)];
<a name="l00127"></a>00127 }
<a name="l00128"></a>00128 
<a name="l00133"></a><a class="code" href="class_c_p_color_well.html#a5da4ae9eccb76f8fc8407a6a1dfa159f">00133</a> - (void)takeColorFrom:(<span class="keywordtype">id</span>)aSender
<a name="l00134"></a>00134 {
<a name="l00135"></a>00135     [<span class="keyword">self</span> <a class="code" href="class_c_p_color_well.html#aa31d12b84c88461a057cb69ce047ab6c">setColor</a>:[aSender color]];
<a name="l00136"></a>00136 }
<a name="l00137"></a>00137 
<a name="l00138"></a>00138 <span class="comment">// Activating and Deactivating Color Wells</span>
<a name="l00144"></a><a class="code" href="class_c_p_color_well.html#a4df55142c79a4e56c040046e139b8f5a">00144</a> <span class="comment"></span>- (void)activate:(BOOL)shouldBeExclusive
<a name="l00145"></a>00145 {
<a name="l00146"></a>00146     <span class="keywordflow">if</span> (shouldBeExclusive)
<a name="l00147"></a>00147         <span class="comment">// FIXME: make this queue!</span>
<a name="l00148"></a>00148         [[<a class="code" href="class_c_p_notification_center.html" title="Sends messages (CPNotification) between objects.">CPNotificationCenter</a> <a class="code" href="class_c_p_notification_center.html#a5abe725f1a1a48ac4cb1e45b6d9d50a8">defaultCenter</a>]
<a name="l00149"></a>00149             <a class="code" href="class_c_p_notification_center.html#ac9402b295db607cbd92ae56bce50b37f">postNotificationName</a>:_CPColorWellDidBecomeExclusiveNotification
<a name="l00150"></a>00150                           <a class="code" href="class_c_p_notification_center.html#ac9402b295db607cbd92ae56bce50b37f">object</a>:self];
<a name="l00151"></a>00151 
<a name="l00152"></a>00152 
<a name="l00153"></a>00153     <span class="keywordflow">if</span> ([<span class="keyword">self</span> isActive])
<a name="l00154"></a>00154         <span class="keywordflow">return</span>;
<a name="l00155"></a>00155         
<a name="l00156"></a>00156     _active = YES;
<a name="l00157"></a>00157     
<a name="l00158"></a>00158     [[<a class="code" href="class_c_p_notification_center.html" title="Sends messages (CPNotification) between objects.">CPNotificationCenter</a> <a class="code" href="class_c_p_notification_center.html#a5abe725f1a1a48ac4cb1e45b6d9d50a8">defaultCenter</a>]
<a name="l00159"></a>00159         <a class="code" href="class_c_p_notification_center.html#a6bd3e02409bf75cb0d8c7a58a5b03d0c">addObserver</a>:self
<a name="l00160"></a>00160            <a class="code" href="class_c_p_notification_center.html#a6bd3e02409bf75cb0d8c7a58a5b03d0c">selector</a>:@selector(<a class="code" href="class_c_p_notification_center.html#a6bd3e02409bf75cb0d8c7a58a5b03d0c">colorPanelDidChangeColor</a>:)
<a name="l00161"></a>00161                <a class="code" href="class_c_p_notification_center.html#a6bd3e02409bf75cb0d8c7a58a5b03d0c">name</a>:CPColorPanelColorDidChangeNotification
<a name="l00162"></a>00162              <a class="code" href="class_c_p_notification_center.html#a6bd3e02409bf75cb0d8c7a58a5b03d0c">object</a>:[<a class="code" href="class_c_p_color_panel.html">CPColorPanel</a> <a class="code" href="class_c_p_color_panel.html#aef25bee4d3031443cf89a0d596c62c4a">sharedColorPanel</a>]];
<a name="l00163"></a>00163 }
<a name="l00164"></a>00164 
<a name="l00168"></a><a class="code" href="class_c_p_color_well.html#aa53de2b9225126c63d9ba7b697307aa3">00168</a> - (void)deactivate
<a name="l00169"></a>00169 {
<a name="l00170"></a>00170     <span class="keywordflow">if</span> (![<span class="keyword">self</span> isActive])
<a name="l00171"></a>00171         <span class="keywordflow">return</span>;
<a name="l00172"></a>00172     
<a name="l00173"></a>00173     _active = NO;
<a name="l00174"></a>00174     
<a name="l00175"></a>00175     [[<a class="code" href="class_c_p_notification_center.html" title="Sends messages (CPNotification) between objects.">CPNotificationCenter</a> <a class="code" href="class_c_p_notification_center.html#a5abe725f1a1a48ac4cb1e45b6d9d50a8">defaultCenter</a>]
<a name="l00176"></a>00176         <a class="code" href="class_c_p_notification_center.html#a39d66af94a532e254902cb1462092c99">removeObserver</a>:self
<a name="l00177"></a>00177                   <a class="code" href="class_c_p_notification_center.html#a39d66af94a532e254902cb1462092c99">name</a>:CPColorPanelColorDidChangeNotification
<a name="l00178"></a>00178                 <a class="code" href="class_c_p_notification_center.html#a39d66af94a532e254902cb1462092c99">object</a>:[<a class="code" href="class_c_p_color_panel.html">CPColorPanel</a> <a class="code" href="class_c_p_color_panel.html#aef25bee4d3031443cf89a0d596c62c4a">sharedColorPanel</a>]];
<a name="l00179"></a>00179 }
<a name="l00180"></a>00180 
<a name="l00184"></a><a class="code" href="class_c_p_color_well.html#aff3eb280e4789394606590f4d8968be8">00184</a> - (BOOL)isActive
<a name="l00185"></a>00185 {
<a name="l00186"></a>00186     <span class="keywordflow">return</span> _active;
<a name="l00187"></a>00187 }
<a name="l00188"></a>00188 
<a name="l00189"></a>00189 <span class="comment">// Drawing a Color Well</span>
<a name="l00190"></a>00190 
<a name="l00191"></a><a class="code" href="class_c_p_color_well.html#afb3af37215d1137f87ffdfb6f59d4c64">00191</a> - (void)drawBezelWithHighlight:(BOOL)shouldHighlight
<a name="l00192"></a>00192 {
<a name="l00193"></a>00193 }
<a name="l00194"></a>00194 
<a name="l00199"></a><a class="code" href="class_c_p_color_well.html#ab64e195fea57c1b29ec51e35b64ad1e7">00199</a> - (void)drawWellInside:(CGRect)aRect
<a name="l00200"></a>00200 {
<a name="l00201"></a>00201     <span class="keywordflow">if</span> (!_wellView)
<a name="l00202"></a>00202     {
<a name="l00203"></a>00203         _wellView = [[<a class="code" href="class_c_p_view.html">CPView</a> alloc] initWithFrame:aRect];
<a name="l00204"></a>00204         [_wellView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
<a name="l00205"></a>00205         
<a name="l00206"></a>00206         [<span class="keyword">self</span> addSubview:_wellView];
<a name="l00207"></a>00207     }
<a name="l00208"></a>00208     <span class="keywordflow">else</span>
<a name="l00209"></a>00209         [_wellView setFrame:aRect];
<a name="l00210"></a>00210     
<a name="l00211"></a>00211     [_wellView setBackgroundColor:_color];
<a name="l00212"></a>00212 }
<a name="l00213"></a>00213 
<a name="l00214"></a><a class="code" href="class_c_p_color_well.html#aa725ade359a9356deefefa0f3b9e4ca7">00214</a> - (void)colorPanelDidChangeColor:(<a class="code" href="class_c_p_notification.html" title="A notification that can be posted to a CPNotificationCenter.">CPNotification</a>)aNotification
<a name="l00215"></a>00215 {
<a name="l00216"></a>00216     [<span class="keyword">self</span> <a class="code" href="class_c_p_color_well.html#a5da4ae9eccb76f8fc8407a6a1dfa159f">takeColorFrom</a>:[aNotification <a class="code" href="class_c_p_notification.html#a0a912e9648acf5e7f669aed339474158">object</a>]];
<a name="l00217"></a>00217     
<a name="l00218"></a>00218     [<span class="keyword">self</span> sendAction:[<span class="keyword">self</span> action] to:[<span class="keyword">self</span> target]];
<a name="l00219"></a>00219 }
<a name="l00220"></a>00220 
<a name="l00221"></a><a class="code" href="class_c_p_color_well.html#af381c69b296a0d1a6659f989beffd287">00221</a> - (void)colorWellDidBecomeExclusive:(<a class="code" href="class_c_p_notification.html" title="A notification that can be posted to a CPNotificationCenter.">CPNotification</a>)aNotification
<a name="l00222"></a>00222 {
<a name="l00223"></a>00223     <span class="keywordflow">if</span> (<span class="keyword">self</span> != [aNotification <span class="keywordtype">object</span>])
<a name="l00224"></a>00224         [<span class="keyword">self</span> <a class="code" href="class_c_p_color_well.html#aa53de2b9225126c63d9ba7b697307aa3">deactivate</a>];
<a name="l00225"></a>00225 }
<a name="l00226"></a>00226 
<a name="l00227"></a><a class="code" href="class_c_p_color_well.html#af2e71d1bd325be44bb9a82745960ef61">00227</a> - (void)colorPanelWillClose:(<a class="code" href="class_c_p_notification.html" title="A notification that can be posted to a CPNotificationCenter.">CPNotification</a>)aNotification
<a name="l00228"></a>00228 {
<a name="l00229"></a>00229     [<span class="keyword">self</span> <a class="code" href="class_c_p_color_well.html#aa53de2b9225126c63d9ba7b697307aa3">deactivate</a>];
<a name="l00230"></a>00230 }
<a name="l00231"></a>00231 
<a name="l00232"></a><a class="code" href="class_c_p_color_well.html#a38946d4bebb31b3d1928aa6d35b4d32a">00232</a> - (void)mouseDown:(<a class="code" href="class_c_p_event.html">CPEvent</a>)anEvent
<a name="l00233"></a>00233 {
<a name="l00234"></a>00234     [<span class="keyword">self</span> <a class="code" href="class_c_p_color_well.html#afb3af37215d1137f87ffdfb6f59d4c64">drawBezelWithHighlight</a>:YES];
<a name="l00235"></a>00235 }
<a name="l00236"></a>00236 
<a name="l00237"></a><a class="code" href="class_c_p_color_well.html#aa978672d8bee01ae5f37eff3e0eba62e">00237</a> - (void)mouseDragged:(<a class="code" href="class_c_p_event.html">CPEvent</a>)anEvent
<a name="l00238"></a>00238 {
<a name="l00239"></a>00239     [<span class="keyword">self</span> <a class="code" href="class_c_p_color_well.html#afb3af37215d1137f87ffdfb6f59d4c64">drawBezelWithHighlight</a>:CGRectContainsPoint([<span class="keyword">self</span> bounds], [<span class="keyword">self</span> convertPoint:[anEvent <a class="code" href="class_c_p_event.html#a5a57f4fa909de5d83e5402a8d8af4b94">locationInWindow</a>] fromView:nil])];
<a name="l00240"></a>00240 }
<a name="l00241"></a>00241 
<a name="l00242"></a><a class="code" href="class_c_p_color_well.html#a22581a678e3ddd67b652ef163702bc1c">00242</a> -(void)mouseUp:(<a class="code" href="class_c_p_event.html">CPEvent</a>)anEvent
<a name="l00243"></a>00243 {
<a name="l00244"></a>00244     [<span class="keyword">self</span> <a class="code" href="class_c_p_color_well.html#afb3af37215d1137f87ffdfb6f59d4c64">drawBezelWithHighlight</a>:NO];
<a name="l00245"></a>00245 
<a name="l00246"></a>00246     <span class="keywordflow">if</span> (!<a class="code" href="_c_g_geometry_8j.html#a1a96c087c2dc31ab61c3c88a3c6ec7c5">CGRectContainsPoint</a>([<span class="keyword">self</span> bounds], [<span class="keyword">self</span> convertPoint:[anEvent locationInWindow] fromView:nil]))
<a name="l00247"></a>00247         <span class="keywordflow">return</span>;
<a name="l00248"></a>00248         
<a name="l00249"></a>00249     [<span class="keyword">self</span> <a class="code" href="class_c_p_color_well.html#a4df55142c79a4e56c040046e139b8f5a">activate</a>:YES];
<a name="l00250"></a>00250 
<a name="l00251"></a>00251     var colorPanel = [<a class="code" href="class_c_p_color_panel.html">CPColorPanel</a> <a class="code" href="class_c_p_color_panel.html#aef25bee4d3031443cf89a0d596c62c4a">sharedColorPanel</a>];
<a name="l00252"></a>00252     
<a name="l00253"></a>00253     [colorPanel setColor:_color];
<a name="l00254"></a>00254     [colorPanel orderFront:self];
<a name="l00255"></a>00255 }
<a name="l00256"></a>00256 
<a name="l00257"></a>00257 <span class="keyword">@end</span>
<a name="l00258"></a>00258 
<a name="l00259"></a><a class="code" href="_c_p_color_well_8j.html#a2f6a35207dcc9c16f9471f8c1c134952">00259</a> var <a class="code" href="_c_p_color_well_8j.html#a2f6a35207dcc9c16f9471f8c1c134952">CPColorWellColorKey</a>     = <span class="stringliteral">&quot;CPColorWellColorKey&quot;</span>,
<a name="l00260"></a><a class="code" href="_c_p_color_well_8j.html#ad4723a2dad9ffd3ffe8f508c384f2a1c">00260</a>     <a class="code" href="_c_p_color_well_8j.html#ad4723a2dad9ffd3ffe8f508c384f2a1c">CPColorWellBorderedKey</a>  = <span class="stringliteral">&quot;CPColorWellBorderedKey&quot;</span>;
<a name="l00261"></a>00261 
<a name="l00262"></a>00262 <span class="keyword">@implementation </span><a class="code" href="class_c_p_color_well.html">CPColorWell</a> (CPCoding)
<a name="l00263"></a>00263 
<a name="l00268"></a><a class="code" href="class_c_p_color_well.html#afecffdd97ea5684edcfa739f83dfbc19">00268</a> - (id)initWithCoder:(<a class="code" href="class_c_p_coder.html" title="Defines methods for use when archiving &amp;amp; restoring (enc/decoding).">CPCoder</a>)aCoder
<a name="l00269"></a>00269 {
<a name="l00270"></a>00270     <span class="keyword">self</span> = [<span class="keyword">super</span> initWithCoder:aCoder];
<a name="l00271"></a>00271     
<a name="l00272"></a>00272     <span class="keywordflow">if</span> (<span class="keyword">self</span>)
<a name="l00273"></a>00273     {
<a name="l00274"></a>00274         _active = NO;
<a name="l00275"></a>00275         _bordered = [aCoder decodeObjectForKey:CPColorWellBorderedKey];
<a name="l00276"></a>00276         _color = [aCoder decodeObjectForKey:CPColorWellColorKey];
<a name="l00277"></a>00277 
<a name="l00278"></a>00278         [<span class="keyword">self</span> <a class="code" href="class_c_p_color_well.html#afb3af37215d1137f87ffdfb6f59d4c64">drawBezelWithHighlight</a>:NO];
<a name="l00279"></a>00279         [<span class="keyword">self</span> <a class="code" href="class_c_p_color_well.html#ab64e195fea57c1b29ec51e35b64ad1e7">drawWellInside</a>:CGRectInset([<span class="keyword">self</span> bounds], 3.0, 3.0)];
<a name="l00280"></a>00280 
<a name="l00281"></a>00281         [<span class="keyword">self</span> _registerForNotifications];
<a name="l00282"></a>00282     }
<a name="l00283"></a>00283     
<a name="l00284"></a>00284     <span class="keywordflow">return</span> <span class="keyword">self</span>;
<a name="l00285"></a>00285 }
<a name="l00286"></a>00286 
<a name="l00291"></a><a class="code" href="class_c_p_color_well.html#a04a933e1efe89170bddbb9546b72a141">00291</a> - (void)encodeWithCoder:(<a class="code" href="class_c_p_coder.html" title="Defines methods for use when archiving &amp;amp; restoring (enc/decoding).">CPCoder</a>)aCoder
<a name="l00292"></a>00292 {
<a name="l00293"></a>00293     <span class="comment">// We do this in order to avoid encoding the _wellView, which </span>
<a name="l00294"></a>00294     <span class="comment">// should just automatically be created programmatically as needed.</span>
<a name="l00295"></a>00295     var actualSubviews = _subviews;
<a name="l00296"></a>00296     
<a name="l00297"></a>00297     _subviews = [_subviews copy];
<a name="l00298"></a>00298     [_subviews removeObjectIdenticalTo:_wellView];
<a name="l00299"></a>00299     
<a name="l00300"></a>00300     [<span class="keyword">super</span> encodeWithCoder:aCoder];
<a name="l00301"></a>00301     
<a name="l00302"></a>00302     _subviews = actualSubviews;
<a name="l00303"></a>00303     
<a name="l00304"></a>00304     [aCoder encodeObject:_color forKey:CPColorWellColorKey];
<a name="l00305"></a>00305     [aCoder encodeObject:_bordered forKey:CPColorWellBorderedKey];
<a name="l00306"></a>00306 }
<a name="l00307"></a>00307 
<a name="l00308"></a>00308 <span class="keyword">@end</span>
</pre></div></div>
<hr size="1"/><address style="text-align: right;"><small>Generated on Tue Apr 6 10:32:54 2010 for Cappuccino API by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address>
</body>

<!-- Mirrored from cappuccino.org/learn/documentation/_c_p_color_well_8j_source.html by HTTrack Website Copier/3.x [XR&CO'2006], Mon, 20 Sep 2010 02:19:29 GMT -->
</html>