1998-03-28 05:44:41 +03:00
|
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
|
*
|
1999-11-06 06:43:54 +03:00
|
|
|
|
* The contents of this file are subject to the Netscape Public
|
|
|
|
|
* License Version 1.1 (the "License"); you may not use this file
|
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
|
* the License at http://www.mozilla.org/NPL/
|
1998-03-28 05:44:41 +03:00
|
|
|
|
*
|
1999-11-06 06:43:54 +03:00
|
|
|
|
* Software distributed under the License is distributed on an "AS
|
|
|
|
|
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
|
|
|
|
* implied. See the License for the specific language governing
|
|
|
|
|
* rights and limitations under the License.
|
1998-03-28 05:44:41 +03:00
|
|
|
|
*
|
1999-11-06 06:43:54 +03:00
|
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
|
*
|
|
|
|
|
* The Initial Developer of the Original Code is Netscape
|
1998-03-28 05:44:41 +03:00
|
|
|
|
* Communications Corporation. Portions created by Netscape are
|
1999-11-06 06:43:54 +03:00
|
|
|
|
* Copyright (C) 1998 Netscape Communications Corporation. All
|
|
|
|
|
* Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Contributor(s):
|
1998-03-28 05:44:41 +03:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <LArray.h>
|
|
|
|
|
#include <LControl.h>
|
|
|
|
|
#include <LString.h>
|
|
|
|
|
|
|
|
|
|
#include "UStdBevels.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef powerc
|
|
|
|
|
#pragma options align=mac68k
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
typedef struct STabDescriptor {
|
|
|
|
|
MessageT valueMessage;
|
|
|
|
|
Int16 width; // -1 means auto adjust, -2 =icon tab YUCK
|
|
|
|
|
Str63 title;
|
|
|
|
|
} STabDescriptor;
|
|
|
|
|
|
|
|
|
|
#ifdef powerc
|
|
|
|
|
#pragma options align=reset
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
const ResType_TabDescList = 'TabL';
|
|
|
|
|
const MessageT msg_TabSwitched = 'TbSw';
|
|
|
|
|
|
|
|
|
|
class CTabInstance;
|
|
|
|
|
|
|
|
|
|
class CTabControl : public LControl
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
enum { class_ID = 'TabC' };
|
|
|
|
|
enum { eNorthTab = 0, eEastTab, eSouthTab, eWestTab };
|
|
|
|
|
|
|
|
|
|
CTabControl(LStream* inStream);
|
|
|
|
|
virtual ~CTabControl();
|
|
|
|
|
|
|
|
|
|
// <20> Access
|
|
|
|
|
|
|
|
|
|
virtual void SetValue(Int32 inValue);
|
|
|
|
|
virtual MessageT GetMessageForValue(Int32 inValue);
|
|
|
|
|
virtual Point GetMinumumSize() { return mMinimumSize; } // -1 = uninitialized
|
|
|
|
|
|
|
|
|
|
// <20> Drawing
|
|
|
|
|
virtual void Draw(RgnHandle inSuperDrawRgnH);
|
|
|
|
|
virtual void ResizeFrameBy(
|
|
|
|
|
Int16 inWidthDelta,
|
|
|
|
|
Int16 inHeightDelta,
|
|
|
|
|
Boolean inRefresh);
|
|
|
|
|
|
|
|
|
|
virtual void DoLoadTabs(ResIDT inTabDescResID);
|
1998-06-23 01:21:28 +04:00
|
|
|
|
virtual void SetTabEnable(ResIDT inPageResID, Boolean inEnable);
|
1998-03-28 05:44:41 +03:00
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
// <20> Initialization & Configuration
|
|
|
|
|
virtual void FinishCreateSelf(void);
|
|
|
|
|
virtual void Recalc(void);
|
|
|
|
|
virtual void CalcTabMask(
|
|
|
|
|
const Rect& inControlFrame,
|
|
|
|
|
const Rect& inTabFrame,
|
|
|
|
|
RgnHandle ioTabMask);
|
|
|
|
|
// <20> Drawing
|
|
|
|
|
virtual void DrawSelf(void);
|
|
|
|
|
virtual void DrawOneTab(CTabInstance* inTab);
|
|
|
|
|
virtual void DrawTopBevel(CTabInstance* inTab);
|
|
|
|
|
virtual void DrawBottomBevel(CTabInstance *inTab, Boolean inCurrentTab);
|
|
|
|
|
virtual void SetClipForDrawingSides(void);
|
|
|
|
|
virtual void DrawSides(void);
|
|
|
|
|
|
|
|
|
|
virtual void DrawOneTabBackground(
|
|
|
|
|
RgnHandle inRegion,
|
|
|
|
|
Boolean inCurrentTab);
|
|
|
|
|
virtual void DrawOneTabFrame(RgnHandle inRegion, Boolean inCurrentTab);
|
|
|
|
|
virtual void DrawCurrentTabSideClip(RgnHandle inRegion);
|
|
|
|
|
|
|
|
|
|
virtual void ActivateSelf(void);
|
|
|
|
|
virtual void DeactivateSelf(void);
|
|
|
|
|
|
|
|
|
|
// <20> Control Behaviour
|
1998-04-18 02:41:09 +04:00
|
|
|
|
virtual Int16 FindHotSpot(Point inPoint) const;
|
|
|
|
|
virtual Boolean PointInHotSpot(Point inPoint, Int16 inHotSpot) const;
|
1998-03-28 05:44:41 +03:00
|
|
|
|
|
|
|
|
|
virtual void HotSpotAction(
|
|
|
|
|
Int16 inHotSpot,
|
|
|
|
|
Boolean inCurrInside,
|
|
|
|
|
Boolean inPrevInside);
|
|
|
|
|
|
|
|
|
|
virtual void HotSpotResult(Int16 inHotSpot);
|
|
|
|
|
virtual void BroadcastValueMessage();
|
|
|
|
|
|
|
|
|
|
Uint8 mOrientation;
|
|
|
|
|
Int16 mCornerPixels;
|
|
|
|
|
Int16 mBevelDepth;
|
|
|
|
|
Int16 mSpacing;
|
|
|
|
|
Int16 mLeadPixels;
|
|
|
|
|
Int16 mRisePixels;
|
|
|
|
|
ResIDT mTabDescID;
|
|
|
|
|
ResIDT mTitleTraitsID;
|
|
|
|
|
Point mMinimumSize; // The minimum size at which all tabs will be displayed
|
|
|
|
|
|
|
|
|
|
SBevelColorDesc mActiveColors;
|
|
|
|
|
SBevelColorDesc mOtherColors;
|
|
|
|
|
SBooleanRect mBevelSides;
|
|
|
|
|
Rect mSideClipFrame;
|
|
|
|
|
|
|
|
|
|
LArray mTabs;
|
|
|
|
|
CTabInstance* mCurrentTab;
|
|
|
|
|
RgnHandle mControlMask;
|
|
|
|
|
Boolean mTrackInside;
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
// <09>
|
|
|
|
|
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
|
|
|
|
|
class CTabInstance
|
|
|
|
|
{
|
|
|
|
|
friend class CTabControl;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
CTabInstance();
|
|
|
|
|
CTabInstance(const STabDescriptor&inDesc );
|
|
|
|
|
virtual ~CTabInstance();
|
|
|
|
|
virtual void DrawTitle(CTabInstance* inCurrentTab, ResIDT mTitleTraitsID) = 0;
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
MessageT mMessage;
|
|
|
|
|
RgnHandle mMask;
|
|
|
|
|
Rect mFrame;
|
|
|
|
|
Rect mShadeFrame;
|
|
|
|
|
Int16 mWidth;
|
|
|
|
|
TString<Str63> mTitle;
|
1998-06-23 01:21:28 +04:00
|
|
|
|
Boolean mEnabled;
|
1998-03-28 05:44:41 +03:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class CTextTabInstance: public CTabInstance
|
|
|
|
|
{
|
|
|
|
|
friend class CTabControl;
|
|
|
|
|
protected:
|
|
|
|
|
CTextTabInstance(const STabDescriptor&inDesc );
|
|
|
|
|
virtual void DrawTitle(CTabInstance* inTab, ResIDT mTitleTraitsID);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class CIconTabInstance: public CTabInstance
|
|
|
|
|
{
|
|
|
|
|
friend class CTabControl;
|
|
|
|
|
protected:
|
|
|
|
|
CIconTabInstance(const STabDescriptor&inDesc );
|
|
|
|
|
virtual void DrawTitle(CTabInstance* inCurrentTab, ResIDT inTitleTraitsID);
|
|
|
|
|
protected:
|
|
|
|
|
SInt32 mIconID;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|