home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-09-14 | 4.5 KB | 133 lines | [TEXT/CWIE] |
- // ===========================================================================
- // File: LEnhancedCicnButton.cp
- // Version: 1.0 - Feb 08,1996
- // Author: Mike Shields (mshields@inconnect.com)
- //
- // Copyright ©1996 Mike Shields. All rights reserved.
- // I hereby grant users of LEnhancedCicnButton permission to use it (or any modified
- // version of it) in applications (or any other type of Macintosh software
- // like extensions -- freeware, shareware, commercial, or other) for free,
- // subject to the terms that:
- //
- // (1) This agreement is non-exclusive.
- //
- // (2) I, Mike Shields, retain the copyright to the original source code.
- //
- // These two items are the only required conditions for use. However, I do have
- // an additional request. Note, however, that this is only a request, and
- // that it is not a required condition for use of this code.
- //
- // (1) That I be given credit for LEnhancedCicnButton code in the copyrights or
- // acknowledgements section of your manual or other appropriate documentation.
- //
- //
- // I would like to repeat that this last item is only a request. You are prefectly
- // free to choose not to do any or all of them.
- //
- // This source code is distributed in the hope that it will be useful,
- // but WITHOUT ANY WARRANTY; without even the implied warranty of
- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- // ===========================================================================
- // LEnhancedIconPane.cp <- double-click + Command-D to see class definition
- //
- //
- // LEnhancedCicnButton is an enhancement to the PP supplied LCicnButton Class.
- // This subclass will cause the button to appear disabled when the button is
- // actually disabled using Disable(). The normal LCicnButton does not take the
- // Enabled status into account when it is drawing the graphic.
- //
- #include "LEnhancedCicnButton.h"
- #include <LStream.h>
-
-
- // ---------------------------------------------------------------------------
- // • CreateFromStream
- // ---------------------------------------------------------------------------
- // Create a new CicnButton object from the data in a Stream
- LEnhancedCicnButton* LEnhancedCicnButton::CreateFromStream(LStream *inStream)
- {
- return (new LEnhancedCicnButton(inStream));
- }
-
-
- // ---------------------------------------------------------------------------
- // • LEnhancedCicnButton
- // ---------------------------------------------------------------------------
- // Default Constructor
- LEnhancedCicnButton::LEnhancedCicnButton()
- {
- }
-
-
- // ---------------------------------------------------------------------------
- // • LEnhancedCicnButton(const LEnhancedCicnButton&)
- // ---------------------------------------------------------------------------
- // Copy Constructor
- LEnhancedCicnButton::LEnhancedCicnButton(const LEnhancedCicnButton &inOriginal)
- : LCicnButton(inOriginal)
- {
- }
-
-
- // ---------------------------------------------------------------------------
- // • LEnhancedCicnButton
- // ---------------------------------------------------------------------------
- // Construct from input parameters
- LEnhancedCicnButton::LEnhancedCicnButton(const SPaneInfo &inPaneInfo, MessageT inClickedMessage,
- ResIDT inNormalID, ResIDT inPushedID)
- : LCicnButton(inPaneInfo, inClickedMessage, inNormalID, inPushedID)
- {
- }
-
-
- // ---------------------------------------------------------------------------
- // • LEnhancedCicnButton(LStream*)
- // ---------------------------------------------------------------------------
- // Construct a new CicnButton from the data in a Stream
- //
- // Stream data must be:
- // ResIDT Resource ID for normal graphic
- // ResIDT Resource ID for pushed graphic
- LEnhancedCicnButton::LEnhancedCicnButton(LStream *inStream)
- : LCicnButton(inStream)
- {
- }
-
-
- // ---------------------------------------------------------------------------
- // • ~LEnhancedCicnButton
- // ---------------------------------------------------------------------------
- // Destructor
- LEnhancedCicnButton::~LEnhancedCicnButton()
- {
- }
-
-
- // ---------------------------------------------------------------------------
- // • DrawSelf
- // ---------------------------------------------------------------------------
- // Draw the CicnButton
- void LEnhancedCicnButton::DrawSelf()
- {
- Rect frame;
- CalcLocalFrameRect(frame);
-
- if ( mNormalCicnH == nil )
- { // Load 'cicn' if necessary
- mNormalCicnH = ::GetCIcon(mNormalID);
- }
-
- if ( mNormalCicnH != nil )
- {
- if ( mEnabled != triState_Off )
- {
- ::PlotCIconHandle(&frame, atNone, ttNone, mNormalCicnH);
- }
- else
- {
- ::PlotCIconHandle(&frame, atNone, ttDisabled, mNormalCicnH);
- }
- }
- }
-
-