home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-06-30 | 5.3 KB | 149 lines | [TEXT/CWIE] |
- // ===========================================================================
- // LAGAIndexTab.h
- // ===========================================================================
- // “Apple Grayscale Appearance” compliant Index Tabs
- // Copyright © 1996 Chrisoft (Christophe ANDRES) All rights reserved.
- //
- // You may use this source code in any application (commercial, shareware, freeware,
- // postcardware, etc), but not remove this notice (no need to acknowledge the use of
- // this class in the about box)
- // You may not sell this source code in any form. This source code may be placed on
- // publicly accessable archive sites and source code disks. It may not be placed on
- // profit archive sites and source code disks without the permission of the author,
- // Christophe ANDRES.
- //
- // 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.
- //
- // If you make any change or improvement on this class, please send the improved/changed
- // version to : chrisoft@calva.net or Christophe ANDRES
- // 20, rue Prosper Mérimée
- // 67100 STRASBOURG
- // FRANCE
- //
- // ===========================================================================
- // LAGAIndexTab.cp <- double-click + Command-D to see classes implementation
- //
- // LAGAIndexTab is my implementation of the “Apple Grayscale Appearance for System 7.5”
- // Index Tabs. Index Tabs where not defined in this document, but some pictures where
- // found in the March 1996 issue of “Apple Directions” pages 16 and 18.
- // LAGAIndexTab relies on view scrolling to perform its switch between differents tabs.
- // mTabbedViewID is a reference to a view that is embeddedin the LAGAIndexTab.
- // This tabbed view has to be placed at least at 21 pixels from the top of LAGAIndexTab,
- // and must leave at least 1 pixel on each side (left, right and bottom).
- // the LAGAIndexTab will use the vertical scroll unit of the tabbed view to perform its
- // tab switch (adapt also the image size height accordingly).
- // This means that all tab elements are always present (although only one is visible)
- // and the switch between tabs is very fast.
- //
- // Index Tabs are not suitable for large number of tabs, so LAGAIndexTab will display only
- // the Index Tabs fitting in the view size.
- //
- // An alternate way of using the index tabs is by NOT setting mTabbedViewID (nil) and to
- // override LAGAIndexTab::AdaptTab to perform whatever is needed
- //
- // LSTRxAGAIndexTab is a subclass of LAGAIndexTab, which reads the name of its tabs from a
- // 'STR#' resource
- //
- // This class requires AGAColors.cp to be present in your project
- //
- // Version : 1.2
- //
- // Change History (most recent first, date in US form : mm/dd/yy):
- //
- // 06/30/96 ca Public release of version 1.2
- // 06/04/96 ca Added RegisterClass method to ease registry
- // Added guard macros in header files
- // Increased version to 1.2
- // 05/16/96 ca Increased version to 1.1
- // Added change history
- // 04/22/96 ca class made available by Christophe ANDRES <chrisoft@calva.net>
- // (version 1.0)
- //
- // To Do:
- // Remove hardcoded maximum tabs and use some sort of dynamic list
- //
-
- #ifndef _H_LAGAIndexTab
- #define _H_LAGAIndexTab
- #pragma once
-
- #include <LView.h>
- #include <LString.h>
-
- void RegisterAGAIndexTab ();
-
- // Maximum number of index tabs in a view
- #define kMaxTabs 10
-
-
- class LAGAIndexTab : public LView
- {
- public :
- enum { class_ID = 'AGAi' };
- static void RegisterClass (); // <06/04/96 ca>
- static LAGAIndexTab* CreateAGAIndexTabStream (LStream *inStream);
-
- LAGAIndexTab ();
-
- LAGAIndexTab (LStream *inStream);
-
- virtual Boolean SetTabCount (short inCount);
-
- virtual void SetTabTitle (short inTab, LStr255& inTitle);
-
- virtual void GetTabTitle (short inTab, LStr255& outTitle);
-
- virtual void SetSelectedTab (short inTab);
-
- virtual short GetSelectedTab ();
-
- virtual void EventMouseUp (const EventRecord &inMouseUp);
-
- protected :
- virtual void FinishCreateSelf ();
-
- virtual void DrawSelf ();
-
- virtual void DrawText (LStr255 &inText, short inLeftBorder, short inTagWidth, short inTextPos);
-
- virtual void CalculateTitleWidths ();
-
- // scroll the view referenced in mUserCon to the appropriate position
- virtual void AdaptTab (Boolean inRefresh = true);
-
- // number of index tabs
- short mTabNumber;
- // selected index tab (0 based)
- short mSelectedTab;
- short mWasSelectedTab;
- // titles of the index tabs
- LStr255 mTabTitle[kMaxTabs];
- // with of titles of the index tabs
- short mTabTitleWidth[kMaxTabs];
- short mTabLeftPositions[kMaxTabs];
- //
- ResIDT mTextTraitsID;
- // ID of the view that contains the tag panels
- UInt32 mTabbedViewID;
-
- private :
- void InitIndexTab ();
- };
-
- class LSTRxAGAIndexTab : public LAGAIndexTab
- {
- public :
- enum { class_ID = 'AGAx' };
- static void RegisterClass (); // <06/04/96 ca>
- static LSTRxAGAIndexTab* CreateSTRxAGAIndexTabStream (LStream *inStream);
-
- LSTRxAGAIndexTab (LStream *inStream);
-
- private :
- void InitSTRxIndexTab (short inSTRxID);
- };
-
- #endif
-