home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-11-07 | 39.1 KB | 1,178 lines | [TEXT/CWIE] |
- //
- // The Gray Council MacApp Adapter
- // Copyright ©1996 by Trygve Isaacson. All Rights Reserved.
- //
- // MacApp adapter classes for The Gray Council core classes.
- //
- // Before using any of the Gray Council source code, read and
- // follow the licensing info in the accompanying documentation
- // or contact:
- // <trygve@bombaydigital.com>
- // <http://www.bombaydigital.com>
- //
- // Also check the web site above to make sure you have the latest version!
- //
- // The Gray Council provides a set of standard C++ classes that implement
- // the standard Apple Grayscale Appearance. The core classes do not
- // require any other code such as a particular class framework.
- //
- // This file defines a set of helper classes that derive from standard
- // MacApp view classes, and interface with the core Gray Council code.
- // There are also a couple of adorner subclasses for attaching to windows
- // and list boxes to get the correct background color or target border.
- //
- // Normally, to use a Gray Council MacApp class, you can simply change the
- // class name of the subview in your resource file or AdLib view to the
- // class name of the appropriate Gray Council MacApp adapter class. For
- // example, to use the GC pushbutton, create a normal TButton subview,
- // and set its class name to AGAPushButtonMA. Voila.
- //
- // A couple of the classes use the userData field of the subview to specify
- // additional information such as icon IDs, string resource IDs, etc.
- //
- // To statically instantiate one of these MacApp subclasses at runtime,
- // not via a view resource, use the class' supplied "I" method.
- //
- // Each class here that interfaces to a core AGAObject has a public
- // member variable called mAGAObject that points to the actual AGAObject
- // subclass object. Certain extended object settings (such as mixed-state
- // buttons, proportional and live scrolling, etc.) require you to call
- // the AGAObject to set it. The member variable is made public to keep
- // these MacApp classes as lightweight as possible; you make the call,
- // rather than using myriad new functions of the MacApp AGA subclasses.
- //
- // Classes defined below:
- // AGAPushButtonMA -- TButton subclass for AGAPushButton
- // AGACheckBoxMA -- TCheckBox subclass for AGACheckBox
- // AGARadioButtonMA -- TRadio subclass for AGARadioButton
- // AGAIconPushButtonMA -- AGAPushButtonMA (TButton) subclass for AGAIconPushButton
- // AGAIconCheckBoxMA -- AGACheckBoxMA (TCheckBox) subclass for AGAIconCheckBox
- // AGAIconRadioButtonMA -- AGARadioButtonMA (TRadio) subclass for AGAIconRadioButton
- // AGAScrollBarMA -- TScrollBar subclass for AGAScrollBar
- // AGAScrollerScrollBarMA -- TScrollerScrollBar subclass for AGAScrollBar
- // Remember the difference between TScrollBar and TScrollerScrollBar!
- // AGASliderMA -- TControl subclass for AGASlider
- // AGABackgroundAdornerMA -- TAdorner subclass that you should attach to
- // typical modeless windows; gives it the proper modeless gray background
- // AGAModalBackgroundAdornerMA -- AGABackgroundAdornerMA (TAdorner) subclass
- // that you should attach to modal windows (i.e., things you PoseModally);
- // gives it the proper modal gray background; however, for dBoxProc and
- // moveableDBoxProc windows, leaves window structure region white, so
- // you may prefer to use AGAFlatBackgroundBehaviorMA in these cases
- // AGAFlatBackgroundBehaviorMA -- TBehavior subclass that you should attach
- // to modal windows (i.e., things you PoseModally); gives it the proper
- // gray background, including the window structure region, but without
- // raised edges
- // AGAWhiteBackgroundAdornerMA -- TAdorner subclass you should attach to any
- // view that needs a white background but lives in a gray background window
- // (e.g., TEditText, TScroller containing grid, etc.)
- // AGANotchedWhiteBackgroundAdornerMA -- AGAWhiteBackgroundAdornerMA (TAdorner)
- // subclass that leaves a notch in the bottom right corner, such as the
- // notch left by a pair of scroll bars
- // AGABorderFrameAdornerMA -- TAdorner subclass that you can attach to any
- // view that needs a "3D" sunken frame around it (e.g., the same things
- // that need a white background adorner)
- // AGANotchedBorderFrameAdornerMA -- AGABorderFrameAdornerMA (TAdorner) subclass
- // that leaves a notch in the bottom right corner, such as the notch left by
- // a pair of scroll bars
- // AGAPopupMA -- TPopup subclass for AGAPopupMenu
- // AGAStaticTextMA -- TStaticText subclass for AGAStaticText
- // AGALittleArrowsMA -- TControl subclass for AGALittleArrows
- // AGADisclosureTriangleMA -- TControl subclass for AGADisclosureTriangle
- // AGAProgressIndicatorMA -- TControl subclass for AGAProgressIndicator
- // AGASeparatorMA -- TView subclass for AGASeparator
- // AGATargetBorderViewMA -- TTargetBorderView subclass that draws AGA-style
- // target border frame
- // AGANotchedTargetBorderViewMA -- AGATargetBorderViewMA (TTargetBorderView) subclass
- // that leaves a notch in the bottom right corner, such as the notch left by a
- // pair of scroll bars
- // AGATargetBorderFrameViewMA -- AGATargetBorderViewMA (TTargetBorderView)
- // subclass that draws a "3D" sunken frame just like an AGABorderFrameAdornerMA
- // in addition to the AGA-compatible TTargetBorderView.
- // AGATargetBorderFrameViewMA -- AGATargetBorderFrameViewMA (TTargetBorderView)
- // subclass that leaves a notch in the bottom right corner, such as the notch
- // left by a pair of scroll bars
- // AGAGroupBoxMA -- TCluster subclass for AGAGroupBox
- // AGASecondaryGroupBoxMA -- AGAClusterMA (TCluster) subclass for AGAGroupBox
- // with secondary box style set
- // AGATabPanelMA -- TControl subclass for AGATabPanel set for large tabs.
- // AGASmallTabPanelMA -- AGATabPanelMA (TControl) subclass for AGATabPanel
- // set for small tabs.
- //
-
- #pragma once
-
- #ifndef __GRAYCOUNCILMA__
- #define __GRAYCOUNCILMA__
-
- #include "GrayCouncil.h"
- #include "UDialog.h"
-
- //
- // You must call InitGrayCouncilMA after initializing the MacApp and the
- // Toolbox and before instantiating any GrayCouncil objects. This routine
- // registers the MacApp classes and then calls the core InitGrayCouncil
- // function for you. If it returns an error, you should quit. The only
- // current error situation of this is an out-of-memory condition
- // during initialization.
- // Alternatively, you can manually register just the adapter classes that
- // you will use, and then call InitGrayCouncil.
- //
-
- extern OSErr InitGrayCouncilMA();
-
- #pragma mark AGAPushButtonMA
-
- //
- // AGAPushButtonMA ----------------------------------------------------
- //
- // TButton replacement subclass. Automatically detects presence of a
- // TRRectAdorner to make the AGAPushButton take on the default button
- // appearance. You could also set kIsDefault state manually.
- //
-
- class AGAPushButtonMA : public TButton
- {
- MA_DECLARE_CLASS;
-
- public:
-
- AGAPushButtonMA();
- virtual ~AGAPushButtonMA();
-
- // TButton-compatible I method
- void IAGAPushButtonMA(TView* itsSuperView, const VPoint& itsLocation, const VPoint& itsSize, SizeDeterminer itsHSizeDet, SizeDeterminer itsVSizeDet, const CStr255& itsLabel);
-
- // MacApp overrides
- virtual void DoPostCreate(TDocument* itsDocument);
- virtual void Draw(const VRect& area);
- virtual void SetFrame(const VRect& newFrame, Boolean invalidate);
- virtual void DoMouseCommand(VPoint& theMouse, TToolboxEvent* event, CPoint hysteresis);
- virtual void HiliteState(Boolean state, Boolean redraw);
- virtual void Hilite();
- virtual void DimState(Boolean state, Boolean redraw);
- virtual void Dim();
- virtual void SetEnable(Boolean state);
- virtual void SetText(const CStr255& itsText, Boolean redraw);
-
- AGAPushButton* mAGAObject;
-
- protected:
-
- virtual void CreateAGAObject();
-
- TAdorner* FindRRectAdorner();
- };
-
- #pragma mark AGACheckBoxMA
-
- //
- // AGACheckBoxMA ----------------------------------------------------
- //
- // TCheckBox replacement subclass. To use mixed-state capability,
- // set/get the AGACheckBox state directly.
- //
-
- class AGACheckBoxMA : public TCheckBox
- {
- MA_DECLARE_CLASS;
-
- public:
-
- AGACheckBoxMA();
- virtual ~AGACheckBoxMA();
-
- // TCheckBox-compatible I method
- void IAGACheckBoxMA(TView* itsSuperView, const VPoint& itsLocation, const VPoint& itsSize, SizeDeterminer itsHSizeDet, SizeDeterminer itsVSizeDet, const CStr255& itsLabel, Boolean isTurnedOn);
-
- // MacApp overrides
- virtual void DoPostCreate(TDocument* itsDocument);
- virtual void Draw(const VRect& area);
- virtual void SetFrame(const VRect& newFrame, Boolean invalidate);
- virtual void DoMouseCommand(VPoint& theMouse, TToolboxEvent* event, CPoint hysteresis);
- virtual void HiliteState(Boolean state, Boolean redraw);
- virtual void Hilite();
- virtual void DimState(Boolean state, Boolean redraw);
- virtual void Dim();
- virtual void SetEnable(Boolean state);
- virtual void SetText(const CStr255& itsText, Boolean redraw);
- virtual Boolean IsOn();
- virtual void SetState(Boolean state, Boolean redraw);
- virtual void Toggle(Boolean redraw);
- virtual void ToggleIf(Boolean matchState, Boolean redraw);
-
- AGACheckBox* mAGAObject;
-
- protected:
-
- virtual void CreateAGAObject();
- };
-
- #pragma mark AGARadioButtonMA
-
- //
- // AGARadioButtonMA ----------------------------------------------------
- //
- // TRadio replacement subclass. To use mixed-state capability,
- // set/get the AGARadioButton state directly.
- //
-
- class AGARadioButtonMA : public TRadio
- {
- MA_DECLARE_CLASS;
-
- public:
-
- AGARadioButtonMA();
- virtual ~AGARadioButtonMA();
-
- // TRadio-compatible I method
- void IAGARadioButtonMA(TView* itsSuperView, const VPoint& itsLocation, const VPoint& itsSize, SizeDeterminer itsHSizeDet, SizeDeterminer itsVSizeDet, const CStr255& itsLabel, Boolean isTurnedOn);
-
- // MacApp overrides
- virtual void DoPostCreate(TDocument* itsDocument);
- virtual void Draw(const VRect& area);
- virtual void SetFrame(const VRect& newFrame, Boolean invalidate);
- virtual void DoMouseCommand(VPoint& theMouse, TToolboxEvent* event, CPoint hysteresis);
- virtual void HiliteState(Boolean state, Boolean redraw);
- virtual void Hilite();
- virtual void DimState(Boolean state, Boolean redraw);
- virtual void Dim();
- virtual void SetEnable(Boolean state);
- virtual void SetText(const CStr255& itsText, Boolean redraw);
- virtual Boolean IsOn();
- virtual void SetState(Boolean state, Boolean redraw);
- virtual void Toggle(Boolean redraw);
- virtual void ToggleIf(Boolean matchState, Boolean redraw);
-
- AGARadioButton* mAGAObject;
-
- protected:
-
- virtual void CreateAGAObject();
- };
-
- #pragma mark AGAIconPushButtonMA
-
- //
- // AGAIconPushButtonMA ----------------------------------------------------
- //
- // TButton replacement subclass that implements an icon button that behaves
- // like a TButton -- you click it and it sends its fEventNumber. When
- // instantiated from a view resource, the fUserArea is used to obtain the
- // button's icon ID. You can also set the icon ID of the AGAIconPushButton
- // directly (cast the mAGAObject to AGAIconPushButton*).
- //
-
- class AGAIconPushButtonMA : public AGAPushButtonMA
- {
- MA_DECLARE_CLASS;
-
- // TButton-compatible I method
- void IAGAIconPushButtonMA(TView* itsSuperView, const VPoint& itsLocation, const VPoint& itsSize, SizeDeterminer itsHSizeDet, SizeDeterminer itsVSizeDet, const CStr255& itsLabel);
-
- protected:
-
- // AGAPushButtonMA override
- virtual void CreateAGAObject();
- };
-
- #pragma mark AGAIconCheckBoxMA
-
- //
- // AGAIconCheckBoxMA ----------------------------------------------------
- //
- // TCheckBox replacement subclass that implements an icon button that behaves
- // like a check box -- you click it and it toggles its on/off state. When
- // instantiated from a view resource, the fUserArea is used to obtain the
- // button's icon ID. You can also set the icon ID of the AGAIconCheckBox
- // directly (cast the mAGAObject to AGAIconCheckBox*). If you want the on/off
- // states to have different icons, you can specify different icon IDs.
- //
-
- class AGAIconCheckBoxMA : public AGACheckBoxMA
- {
- MA_DECLARE_CLASS;
-
- // TCheckBox-compatible I method
- void IAGAIconCheckBoxMA(TView* itsSuperView, const VPoint& itsLocation, const VPoint& itsSize, SizeDeterminer itsHSizeDet, SizeDeterminer itsVSizeDet, const CStr255& itsLabel, Boolean isTurnedOn);
-
- protected:
-
- // AGACheckBoxMA override
- virtual void CreateAGAObject();
- };
-
- #pragma mark AGAIconRadioButtonMA
-
- //
- // AGAIconRadioButtonMA ----------------------------------------------------
- //
- // TRadio replacement subclass that implements an icon button that behaves
- // like a radio button -- you click it and it turns on, and notifies its
- // cluster so that the others in its group are turned off. When
- // instantiated from a view resource, the fUserArea is used to obtain the
- // button's icon ID. You can also set the icon ID of the AGAIconRadioButton
- // directly (cast the mAGAObject to AGAIconRadioButton*). If you want the on/off
- // states to have different icons, you can specify different icon IDs.
- //
-
- class AGAIconRadioButtonMA : public AGARadioButtonMA
- {
- MA_DECLARE_CLASS;
-
- // TRadio-compatible I method
- void IAGAIconRadioButtonMA(TView* itsSuperView, const VPoint& itsLocation, const VPoint& itsSize, SizeDeterminer itsHSizeDet, SizeDeterminer itsVSizeDet, const CStr255& itsLabel, Boolean isTurnedOn);
-
- protected:
-
- // AGARadioButtonMA override
- virtual void CreateAGAObject();
- };
-
- #pragma mark AGAScrollBarMA
-
- //
- // AGAScrollBarMA ----------------------------------------------------
- //
- // TScrollBar replacement subclass. To use live scrolling, set the
- // AGAScrollBar state directly and either install a notification routine
- // or handle the scroll bar's fEventNumber by checking the current value.
- // To use proportional indicator, set the AGAScrollBar state directly.
- //
- // Please note that TScrollBar and TScrollerScrollBar are different!
- //
-
- typedef void (*AGANotifyMAPtr)(TView* theIndicator, SInt32 dataValue, void* userData);
-
- class AGAScrollBarMA : public TScrollBar
- {
- MA_DECLARE_CLASS;
-
- public:
-
- AGAScrollBarMA();
- virtual ~AGAScrollBarMA();
-
- // TScrollBar-compatible I method
- void IAGAScrollBarMA(TView* itsSuperView, const VPoint& itsLocation, const VPoint& itsSize, SizeDeterminer itsHSizeDet, SizeDeterminer itsVSizeDet, VHSelect itsDirection, long itsVal, long itsMin, long itsMax);
-
- // MacApp overrides
- virtual void DoPostCreate(TDocument* itsDocument);
- virtual void Draw(const VRect& area);
- virtual void SetFrame(const VRect& newFrame, Boolean invalidate);
- virtual void SetLongVal(VCoordinate itsVal, Boolean redraw);
- virtual void DoMouseCommand(VPoint& theMouse, TToolboxEvent* event, CPoint hysteresis);
- virtual void HiliteState(Boolean state, Boolean redraw);
- virtual void Hilite();
- virtual void DimState(Boolean state, Boolean redraw);
- virtual void Dim();
- virtual void SetEnable(Boolean state);
- virtual void Activate(Boolean entering);
- virtual void SetLongMax(VCoordinate itsMax, Boolean redraw);
-
- virtual void InstallNotificationRoutine(AGANotifyMAPtr notificationRoutine, void* userData);
- virtual void HandleNotification(SInt32 dataValue);
-
- AGANotifyMAPtr mNotificationRoutine;
- void* mUserData;
-
- AGAScrollBar* mAGAObject;
-
- protected:
-
- virtual void CreateAGAObject();
-
- static void RealAGANotifier(AGATrackingIndicator* theIndicator, SInt32 dataValue, void* userData);
- };
-
- #pragma mark AGAScrollerScrollBarMA
-
- //
- // AGAScrollerScrollBarMA ----------------------------------------------------
- //
- // TScrollerScrollBar replacement subclass. To use live scrolling, just set
- // the AGAScrollBar state directly; the scroller will get the live scroll
- // nofication messages automatically. To use proportional indicator,
- // set the AGAScrollBar state directly.
- //
- // Please note that TScrollBar and TScrollerScrollBar are different!
- //
-
- class AGAScrollerScrollBarMA : public TScrollerScrollBar
- {
- MA_DECLARE_CLASS;
-
- public:
-
- AGAScrollerScrollBarMA();
- virtual ~AGAScrollerScrollBarMA();
-
- // TScrollerScrollBar-compatible I method
- void IAGAScrollerScrollBarMA(TView* itsSuperView, const VPoint& itsLocation, const VPoint& itsSize, SizeDeterminer itsHSizeDet, SizeDeterminer itsVSizeDet, VHSelect itsDirection, long itsMax, TScroller* itsScroller);
-
- // MacApp overrides
- virtual void DoPostCreate(TDocument* itsDocument);
- virtual void Draw(const VRect& area);
- virtual void SetFrame(const VRect& newFrame, Boolean invalidate);
- virtual void AttachScroller(TScroller* itsScroller);
- virtual void SetLongVal(VCoordinate itsVal, Boolean redraw);
- virtual void DoMouseCommand(VPoint& theMouse, TToolboxEvent* event, CPoint hysteresis);
- virtual void HiliteState(Boolean state, Boolean redraw);
- virtual void Hilite();
- virtual void DimState(Boolean state, Boolean redraw);
- virtual void Dim();
- virtual void SetEnable(Boolean state);
- virtual void Activate(Boolean entering);
- virtual void SetLongMax(VCoordinate itsMax, Boolean redraw);
-
- virtual void InstallNotificationRoutine(AGANotifyMAPtr notificationRoutine, void* userData);
- virtual void HandleNotification(SInt32 dataValue);
- virtual void UpdateScrollAmounts();
-
- AGANotifyMAPtr mNotificationRoutine;
- void* mUserData;
-
- AGAScrollBar* mAGAObject;
-
- protected:
-
- virtual void CreateAGAObject();
-
- static void RealAGANotifier(AGATrackingIndicator* theIndicator, SInt32 dataValue, void* userData);
- };
-
- #pragma mark AGASliderMA
-
- //
- // AGASliderMA ----------------------------------------------------
- //
- // TControl subclass. To set/get the value, access the AGASlider
- // directly. When instantiated from a view resource, the fUserArea,
- // if non-zero, is used as the resource ID of an 'STR#' resource
- // that contains the slider labels; in this case, the range is
- // automatically set to match the number of labels, and the slider
- // will have a pointy indicator. If the ID is zero or invalid, the
- // slider will be rectangular.
- //
-
- class AGASliderMA : public TControl
- {
- MA_DECLARE_CLASS;
-
- public:
-
- AGASliderMA();
- virtual ~AGASliderMA();
-
- // TControl-compatible I method
- void IAGASliderMA(TView* itsSuperView, const VPoint& itsLocation, const VPoint& itsSize, SizeDeterminer itsHSizeDet, SizeDeterminer itsVSizeDet, const TextStyle& itsTextStyle = gSystemStyle);
-
- // MacApp overrides
- virtual void DoPostCreate(TDocument* itsDocument);
- virtual void Draw(const VRect& area);
- virtual void SetFrame(const VRect& newFrame, Boolean invalidate);
- virtual void DoMouseCommand(VPoint& theMouse, TToolboxEvent* event, CPoint hysteresis);
- virtual void DimState(Boolean state, Boolean redraw);
- virtual void Dim();
- virtual void SetEnable(Boolean state);
-
- virtual void InstallNotificationRoutine(AGANotifyMAPtr notificationRoutine, void* userData);
- virtual void HandleNotification(SInt32 dataValue);
-
- AGANotifyMAPtr mNotificationRoutine;
- void* mUserData;
-
- AGASlider* mAGAObject;
-
- protected:
-
- virtual void CreateAGAObject();
-
- static void RealAGANotifier(AGATrackingIndicator* theIndicator, SInt32 dataValue, void* userData);
- };
-
- #pragma mark AGABackgroundAdornerMA
-
- //
- // AGABackgroundAdornerMA ----------------------------------------------------
- //
- // An adorner that you should attach to typical modeless windows if you
- // want the standard AGA gray background. It should be placed BEFORE the
- // "Draw Adorner".
- //
-
- class AGABackgroundAdornerMA : public TAdorner
- {
- MA_DECLARE_CLASS;
-
- public:
-
- AGABackgroundAdornerMA();
-
- // MacApp overrides
- virtual void DoHighlightSelection(TView* itsView, const VRect& area, HLState fromHL, HLState toHL);
- virtual void Draw(TView* itsView, const VRect& area);
- virtual void ViewChangedFrame(TView* itsView, const VRect& oldFrame, const VRect& newFrame, Boolean invalidate);
- virtual void AddedToView(TView* itsView);
-
- protected:
-
- virtual void DrawBackground(TView* itsView, const VRect& area, Boolean fill, Boolean active);
- virtual Boolean HasGrowBox(TView* itsView);
-
- AGABackgroundKind mBackgroundKind;
- };
-
- #pragma mark AGAModalBackgroundAdornerMA
-
- //
- // AGAModalBackgroundAdornerMA ----------------------------------------------------
- //
- // An adorner that you should attach to typical modal windows (dialogs)
- // in order to get the standard AGA modal gray background. It should be placed
- // BEFORE the "Draw Adorner".
- //
- // Usage note: This adorner draws the raised gray background in the window
- // content region. Some window kinds (notably dBoxProc and movableDBoxProc
- // for modal dialogs) pad the window frame with a few pixels around the edge
- // of the content area. This adorner will leave a white ring around the usable
- // content area, because you can't draw outside it.
- // If you want a solid gray background with these kinds of windows, use an
- // AGAFlatBackgroundBehaviorMA attached to the window. It will install the
- // gray background into the window's color table, so that gray is drawn in
- // the area outside the content region.
- //
-
- class AGAModalBackgroundAdornerMA : public AGABackgroundAdornerMA
- {
- MA_DECLARE_CLASS;
-
- public:
-
- AGAModalBackgroundAdornerMA();
- };
-
- #pragma mark AGAFlatBackgroundBehaviorMA
-
- //
- // AGAFlatBackgroundBehaviorMA ----------------------------------------------------
- //
- // TBehavior subclass that handles DoPostCreate by installing a gray
- // background color in the owner's window color table.
- // This MUST be only attached to a TWindow or TView in a window.
- // The reason we use a behavior rather than an adorner, is that adorners
- // don't get notified in a timely fashion when they are attached to the
- // host view, while behaviors get a DoPostCreate call, which is at the
- // right time to install the color.
- //
-
- class AGAFlatBackgroundBehaviorMA : public TBehavior
- {
- MA_DECLARE_CLASS;
-
- public:
-
- AGAFlatBackgroundBehaviorMA();
- virtual ~AGAFlatBackgroundBehaviorMA();
-
- // MacApp overrides
- virtual void DoPostCreate(TDocument* itsDocument);
- };
-
- #pragma mark AGAWhiteBackgroundAdornerMA
-
- //
- // AGAWhiteBackgroundAdornerMA ----------------------------------------------------
- //
- // An adorner that you should attach to any subview where the window has
- // a gray background but the particular subview needs a white background.
- // Editable text fields and list boxes are the most common examples. It should
- // be placed BEFORE the "Draw Adorner".
- //
-
- class AGAWhiteBackgroundAdornerMA : public TAdorner
- {
- MA_DECLARE_CLASS;
-
- public:
-
- // MacApp overrides
- virtual void Draw(TView* itsView, const VRect& area);
- };
-
- #pragma mark AGANotchedWhiteBackgroundAdornerMA
-
- //
- // AGANotchedWhiteBackgroundAdornerMA ----------------------------------------------------
- //
- // Same as AGAWhiteBackgroundAdornerMA, but leaves a "notch" in bottom
- // right corner for area created by a pair of scroll bars.
- //
-
- class AGANotchedWhiteBackgroundAdornerMA : public TAdorner
- {
- MA_DECLARE_CLASS;
-
- public:
-
- // MacApp overrides
- virtual void Draw(TView* itsView, const VRect& area);
- };
-
- #pragma mark AGABorderFrameAdornerMA
-
- //
- // AGABorderFrameAdornerMA ----------------------------------------------------
- //
- // An adorner that you should attach to any subview where the subview
- // needs a "3D" sunken frame around it. Editable text fields and list
- // boxes are the most common examples. It should be placed AFTER the
- // "Draw Adorner".
- //
-
- class AGABorderFrameAdornerMA : public TAdorner
- {
- MA_DECLARE_CLASS;
-
- public:
-
- // MacApp overrides
- virtual void Draw(TView* itsView, const VRect& area);
- };
-
- #pragma mark AGANotchedBorderFrameAdornerMA
-
- //
- // AGANotchedBorderFrameAdornerMA ----------------------------------------------------
- //
- // An adorner that you should attach to any subview where you want a
- // "3D" sunken frame around it, contoured to fit the "notch" at the
- // bottom right of a pair of scroll bars.
- //
-
- class AGANotchedBorderFrameAdornerMA : public TAdorner
- {
- MA_DECLARE_CLASS;
-
- public:
-
- // MacApp overrides
- virtual void Draw(TView* itsView, const VRect& area);
- };
-
- #pragma mark AGAPopupMA
-
- //
- // AGAPopupMA ----------------------------------------------------
- //
- // TPopup replacement subclass.
- //
-
- class AGAPopupMA : public TPopup
- {
- MA_DECLARE_CLASS;
-
- public:
-
- AGAPopupMA();
- virtual ~AGAPopupMA();
-
- // TPopup-compatible I method
- void IAGAPopupMA(TView* itsSuperView, const VPoint& itsLocation, const VPoint& itsSize, SizeDeterminer itsHSizeDet, SizeDeterminer itsVSizeDet, short itsMenuID, short itsCurrentItem, short itsItemOffset, short itsStrListID, short itsIndex, short itsStyle, short itsJust, Boolean useAddResMenu, ResType useAddResMenuResType, const TextStyle& itsTextStyle = gSystemStyle);
-
- // MacApp overrides
- virtual void DoPostCreate(TDocument* itsDocument);
- virtual void Draw(const VRect& area);
- virtual void SetFrame(const VRect& newFrame, Boolean invalidate);
- virtual void DoMouseCommand(VPoint& theMouse, TToolboxEvent* event, CPoint hysteresis);
- virtual void DimState(Boolean state, Boolean redraw);
- virtual void Dim();
- virtual void SetEnable(Boolean state);
-
- // TPopup and TControl overrides
- virtual void AttachMenuRef(MenuRef itsMenuRef); // installs the menu
- virtual void SetText(const CStr255& title, Boolean redraw); // sets the popup title
- virtual void SetLongVal(VCoordinate itsVal, Boolean redraw);// sets cur item no
- virtual SInt16 GetVal(); // gets cur item no
-
- AGAPopupMenu* mAGAObject;
-
- protected:
-
- virtual void CreateAGAObject();
- };
-
- #pragma mark AGAStaticTextMA
-
- //
- // AGAStaticTextMA ----------------------------------------------------
- //
- // TStaticText replacement subclass. Dims with gray text instead of
- // patBic gray pattern erasing; suppresses erasing background to white
- // when text is changed.
- //
-
- class AGAStaticTextMA : public TStaticText
- {
- MA_DECLARE_CLASS;
-
- public:
-
- AGAStaticTextMA();
- virtual ~AGAStaticTextMA();
-
- // TStaticText-compatible I method
- void IAGAStaticTextMA(TView* itsSuperView, const VPoint& itsLocation, const VPoint& itsSize, SizeDeterminer itsHSizeDet, SizeDeterminer itsVSizeDet, ResNumber itsRsrcID, short itsIndex);
-
- // MacApp overrides
- virtual void DoPostCreate(TDocument* itsDocument);
- virtual void Draw(const VRect& area);
- virtual void SetFrame(const VRect& newFrame, Boolean invalidate);
- virtual void DimState(Boolean state, Boolean redraw);
- virtual void Dim();
- virtual void SetText(const CStr255& theText, Boolean redraw);
-
- AGAStaticText* mAGAObject;
-
- protected:
-
- virtual void CreateAGAObject();
- };
-
- #pragma mark AGALittleArrowsMA
-
- //
- // AGALittleArrowsMA ----------------------------------------------------
- //
- // TControl subclass. You will need to either install a notification
- // routine to respond to arrow tracking, or subclass and override
- // the HandleNotification member function. However:
- //
- // If you simply want to link the little arrows to a TNumberText
- // field, just put the TNumberText's view ID the little arrows view's
- // fUserArea, and the arrows will automatically increment/decrement
- // the TNumberText view's value.
- //
-
- class AGALittleArrowsMA : public TControl
- {
- MA_DECLARE_CLASS;
-
- public:
-
- AGALittleArrowsMA();
- virtual ~AGALittleArrowsMA();
-
- // TControl-compatible I method
- void IAGALittleArrowsMA(TView* itsSuperView, const VPoint& itsLocation, const VPoint& itsSize, SizeDeterminer itsHSizeDet, SizeDeterminer itsVSizeDet, const TextStyle& itsTextStyle = gSystemStyle);
-
- // MacApp overrides
- virtual void DoPostCreate(TDocument* itsDocument);
- virtual void Draw(const VRect& area);
- virtual void SetFrame(const VRect& newFrame, Boolean invalidate);
- virtual void DoMouseCommand(VPoint& theMouse, TToolboxEvent* event, CPoint hysteresis);
- virtual void DimState(Boolean state, Boolean redraw);
- virtual void Dim();
- virtual void SetEnable(Boolean state);
-
- virtual void InstallNotificationRoutine(AGANotifyMAPtr notificationRoutine, void* userData);
- virtual void HandleNotification(SInt32 deltaValue);
-
- AGANotifyMAPtr mNotificationRoutine;
- void* mUserData;
-
- AGALittleArrows* mAGAObject;
-
- protected:
-
- virtual void CreateAGAObject();
-
- static void RealAGANotifier(AGALittleArrows* theAGAObject, SInt32 deltaValue, void* userData);
-
- TNumberText* mLinkedNumberText;
- };
-
- #pragma mark AGADisclosureTriangleMA
-
- //
- // AGADisclosureTriangleMA ----------------------------------------------------
- //
- // TControl subclass. Set/get the AGADisclosureTriangle state
- // directly. Think of it as a check box -- it's either on or off.
- //
-
- class AGADisclosureTriangleMA : public TControl
- {
- MA_DECLARE_CLASS;
-
- public:
-
- AGADisclosureTriangleMA();
- virtual ~AGADisclosureTriangleMA();
-
- // TControl-compatible I method
- void IAGADisclosureTriangleMA(TView* itsSuperView, const VPoint& itsLocation, const VPoint& itsSize, SizeDeterminer itsHSizeDet, SizeDeterminer itsVSizeDet, const TextStyle& itsTextStyle = gSystemStyle);
-
- // MacApp overrides
- virtual void DoPostCreate(TDocument* itsDocument);
- virtual void Draw(const VRect& area);
- virtual void SetFrame(const VRect& newFrame, Boolean invalidate);
- virtual void DoMouseCommand(VPoint& theMouse, TToolboxEvent* event, CPoint hysteresis);
- virtual void DimState(Boolean state, Boolean redraw);
- virtual void Dim();
- virtual void SetEnable(Boolean state);
-
- AGADisclosureTriangle* mAGAObject;
-
- protected:
-
- virtual void CreateAGAObject();
- };
-
- #pragma mark AGAProgressIndicatorMA
-
- //
- // AGAProgressIndicatorMA ----------------------------------------------------
- //
- // TControl subclass. Access the AGAProgressIndicator directly. For
- // determinate progress, set the min/max range, and then call SetValue
- // or Increment repeatedly; you can also update the origin value if
- // desired. For indeterminate progress, set min=max and then call Animate
- // repeatedly.
- //
-
- class AGAProgressIndicatorMA : public TControl
- {
- MA_DECLARE_CLASS;
-
- public:
-
- AGAProgressIndicatorMA();
- virtual ~AGAProgressIndicatorMA();
-
- // TControl-compatible I method
- void IAGAProgressIndicatorMA(TView* itsSuperView, const VPoint& itsLocation, const VPoint& itsSize, SizeDeterminer itsHSizeDet, SizeDeterminer itsVSizeDet, const TextStyle& itsTextStyle = gSystemStyle);
-
- // MacApp overrides
- virtual void DoPostCreate(TDocument* itsDocument);
- virtual void Draw(const VRect& area);
- virtual void SetFrame(const VRect& newFrame, Boolean invalidate);
- virtual Boolean DoIdle(IdlePhase phase);
-
- // For an indeterminate progress indicator, you can use these functions
- // to set it running or stop it. It will place itself on the cohandler
- // chain and do a quantized animate at idle time.
- void StartAutoAnimate();
- void StopAutoAnimate();
-
- AGAProgressIndicator* mAGAObject;
-
- protected:
-
- virtual void CreateAGAObject();
- };
-
- #pragma mark AGASeparatorMA
-
- //
- // AGASeparatorMA ----------------------------------------------------
- //
- // TView subclass. The precise width or height is irrelevant; the
- // longer of the two dimensions determines the separator direction,
- // and the separator is drawn along the top or left edge.
- //
-
- class AGASeparatorMA : public TView
- {
- MA_DECLARE_CLASS;
-
- public:
-
- AGASeparatorMA();
- virtual ~AGASeparatorMA();
-
- // TView-compatible I method
- void IAGASeparatorMA(TDocument* itsDocument, TView* itsSuperView, const VPoint& itsLocation, const VPoint& itsSize, SizeDeterminer itsHSizeDet, SizeDeterminer itsVSizeDet);
-
- // MacApp overrides
- virtual void DoPostCreate(TDocument* itsDocument);
- virtual void Draw(const VRect& area);
- virtual void SetFrame(const VRect& newFrame, Boolean invalidate);
-
- AGASeparator* mAGAObject;
-
- protected:
-
- virtual void CreateAGAObject();
- };
-
- #pragma mark AGATargetBorderViewMA
-
- //
- // AGATargetBorderViewMA ----------------------------------------------------
- //
- // TTargetBorderView replacement subclass.
- //
-
- class AGATargetBorderViewMA : public TTargetBorderView
- {
- MA_DECLARE_CLASS;
-
- public:
-
- // TTargetBorderView-compatible I method
- void IAGATargetBorderViewMA(TDocument* itsDocument, TView* itsSuperView, const VPoint& itsLocation, const VPoint& itsSize, SizeDeterminer itsHSizeDet, SizeDeterminer itsVSizeDet, IDType itsTargetView);
-
- // MacApp overrides
- virtual void DoPostCreate(TDocument* itsDocument);
- virtual void Draw(const VRect& area);
- virtual void ComputeBorderRegion(RgnHandle borderRegion);
-
- protected:
-
- RGBColor mEnabledBackgroundColor;
- RGBColor mDisabledBackgroundColor;
- };
-
- #pragma mark AGANotchedTargetBorderViewMA
-
- //
- // AGANotchedTargetBorderViewMA ----------------------------------------------------
- //
- // Same as AGATargetBorderViewMA, but with a "notched" bottom right corner.
- //
-
- class AGANotchedTargetBorderViewMA : public AGATargetBorderViewMA
- {
- MA_DECLARE_CLASS;
-
- public:
-
- // TTargetBorderView-compatible I method
- void IAGANotchedTargetBorderViewMA(TDocument* itsDocument, TView* itsSuperView, const VPoint& itsLocation, const VPoint& itsSize, SizeDeterminer itsHSizeDet, SizeDeterminer itsVSizeDet, IDType itsTargetView);
-
- // MacApp overrides
- virtual void ComputeBorderRegion(RgnHandle borderRegion);
- };
-
- #pragma mark AGATargetBorderFrameViewMA
-
- //
- // AGATargetBorderFrameViewMA ----------------------------------------------------
- //
- // TTargetBorderView replacement subclass that also draws a
- // AGABorderFrameAdornerMA-type "3D" sunken frame. Provided
- // for convenience: makes it unnecessary to attach an
- // AGABorderFrameAdornerMA to the subview that this target
- // border view surrounds.
- //
-
- class AGATargetBorderFrameViewMA : public AGATargetBorderViewMA
- {
- MA_DECLARE_CLASS;
-
- public:
-
- // TTargetBorderView-compatible I method
- void IAGATargetBorderFrameViewMA(TDocument* itsDocument, TView* itsSuperView, const VPoint& itsLocation, const VPoint& itsSize, SizeDeterminer itsHSizeDet, SizeDeterminer itsVSizeDet, IDType itsTargetView);
-
- // MacApp overrides
- virtual void Draw(const VRect& area);
- virtual void Dim();
- virtual void SetEnable(Boolean state);
- };
-
- #pragma mark AGANotchedTargetBorderFrameViewMA
-
- //
- // AGANotchedTargetBorderFrameViewMA ----------------------------------------------------
- //
- // Same as AGATargetBorderFrameViewMA, but with a "notched" bottom right corner.
- //
-
- class AGANotchedTargetBorderFrameViewMA : public AGATargetBorderViewMA
- {
- MA_DECLARE_CLASS;
-
- public:
-
- // TTargetBorderView-compatible I method
- void IAGANotchedTargetBorderFrameViewMA(TDocument* itsDocument, TView* itsSuperView, const VPoint& itsLocation, const VPoint& itsSize, SizeDeterminer itsHSizeDet, SizeDeterminer itsVSizeDet, IDType itsTargetView);
-
- // MacApp overrides
- virtual void Draw(const VRect& area);
- virtual void Dim();
- virtual void ComputeBorderRegion(RgnHandle borderRegion);
- };
-
- #pragma mark AGAGroupBoxMA
-
- //
- // AGAGroupBoxMA ----------------------------------------------------
- //
- // TCluster replacement subclass. Defaults to primary group box
- // type.
- //
-
- class AGAGroupBoxMA : public TCluster
- {
- MA_DECLARE_CLASS;
-
- public:
-
- AGAGroupBoxMA();
- virtual ~AGAGroupBoxMA();
-
- // TCluster-compatible I method
- void IAGAGroupBoxMA(TView* itsSuperView, const VPoint& itsLocation, const VPoint& itsSize, SizeDeterminer itsHSizeDet, SizeDeterminer itsVSizeDet, ResNumber itsRsrcID, short itsIndex);
-
- // MacApp overrides
- virtual void DoPostCreate(TDocument* itsDocument);
- virtual void Draw(const VRect& area);
- virtual void SetFrame(const VRect& newFrame, Boolean invalidate);
- virtual void DoMouseCommand(VPoint& theMouse, TToolboxEvent* event, CPoint hysteresis);
- virtual void DimState(Boolean state, Boolean redraw);
- virtual void Dim();
- virtual void SetLabel(const CStr255& theLabel, Boolean redraw);
-
- AGAGroupBox* mAGAObject;
-
- protected:
-
- virtual void CreateAGAObject();
-
- Boolean mIsPrimaryType; // used by CreateAGAObject to instantiate desired type
- };
-
- #pragma mark AGASecondaryGroupBoxMA
-
- //
- // AGASecondaryGroupBoxMA ----------------------------------------------------
- //
- // TCluster replacement subclass that overrides AGAGroupBoxMA to
- // use secondary group box appearance.
- //
-
- class AGASecondaryGroupBoxMA : public AGAGroupBoxMA
- {
- MA_DECLARE_CLASS;
-
- AGASecondaryGroupBoxMA();
- virtual ~AGASecondaryGroupBoxMA();
-
- // TCluster-compatible I method
- void IAGASecondaryGroupBoxMA(TView* itsSuperView, const VPoint& itsLocation, const VPoint& itsSize, SizeDeterminer itsHSizeDet, SizeDeterminer itsVSizeDet, ResNumber itsRsrcID, short itsIndex);
- };
-
- #pragma mark AGATabPanelMA
-
- //
- // AGATabPanelMA ----------------------------------------------------
- //
- // TControl subclass for AGATabPanel set for large tabs. When instantiated
- // from a view resource, the fUserArea, if non-zero, is used as the resource
- // ID of an 'STR#' resource that contains the tab labels; the number of
- // tabs will be the number of strings in the 'STR#' resource. If you have
- // existing tabs, such as via the 'STR#', use InstallPanel to assign a
- // panel to a tab. If you have no tabs yet, use AddPanel to create a new
- // tab for a panel. Note that the panel views must be non-window 'View'
- // resources, i.e. view hierarchies with a TView at the root, not a TWindow.
- //
-
- class AGATabPanelMA : public TControl
- {
- MA_DECLARE_CLASS;
-
- public:
-
- AGATabPanelMA();
- virtual ~AGATabPanelMA();
-
- // TControl-compatible I method
- void IAGATabPanelMA(TView* itsSuperView, const VPoint& itsLocation, const VPoint& itsSize, SizeDeterminer itsHSizeDet, SizeDeterminer itsVSizeDet, const TextStyle& itsTextStyle = gSystemStyle);
-
- // MacApp overrides
- virtual void DoPostCreate(TDocument* itsDocument);
- virtual void Draw(const VRect& area);
- virtual void SetFrame(const VRect& newFrame, Boolean invalidate);
- virtual void DoMouseCommand(VPoint& theMouse, TToolboxEvent* event, CPoint hysteresis);
- virtual void DimState(Boolean state, Boolean redraw);
- virtual void Dim();
- virtual void SetEnable(Boolean state);
-
- // HandleTabSwitch can be used to switch to the specified panel,
- // but it will call ValidatePanel before allowing the switch.
- // This is what ClickSelf does to handle a click in a tab.
- // To switch directly without validation, just call SetValue.
- virtual void HandleTabSwitch(SInt32 newTabIndex);
-
- // AddPanel adds another tab, and assigns it the specified 'View' view.
- // If the specified label StringPtr is NULL, the 'View' rsrc name is used.
- virtual void AddPanel(SInt16 panelResourceID,
- StringPtr tabLabel);
-
- // InstallPanel assigns the specified 'View' view to the specified
- // existing tab. If the specified label StringPtr is NULL, the existing
- // tab label is left untouched.
- virtual void InstallPanel(SInt32 tabIndex,
- SInt16 panelResourceID,
- StringPtr tabLabel);
-
- // GetPanelView returns the LView pointer to the root of the
- // pane hierarchy of the specified tab.
- virtual TView* GetPanelView(SInt32 tabIndex);
-
- // SetSubviewsEnable is called by the SetEnable override
- // to walk all subviews of the currently installed panel
- // and set their enable state. Made public in case you
- // need to customize panel enabling behavior.
- virtual void SetSubviewsEnable(Boolean state);
-
- AGATabPanel* mAGAObject;
-
- protected:
-
- virtual void CreateAGAObject();
- virtual void CreateContainerView();
-
- virtual Boolean ValidatePanel(SInt32 currentTabIndex);
-
- virtual void SwitchPanels(SInt32 newTabIndex);
- virtual Boolean SwitchPanelOut(); // returns true if panel contained target
- virtual void SwitchPanelIn(SInt32 newTabIndex, Boolean targetInPanel);
-
- virtual void DoSubviewsEnable(TView* aSuperView, Boolean state);
-
- TView* mPanelContainerView;
- TView* mActivePanelView;
- };
-
- #pragma mark AGASmallTabPanelMA
-
- //
- // AGASmallTabPanelMA ----------------------------------------------------
- //
- // AGATabPanelMA (TControl) subclass for AGATabPanel set for small tabs.
- //
-
- class AGASmallTabPanelMA : public AGATabPanelMA
- {
- MA_DECLARE_CLASS;
-
- public:
-
- AGASmallTabPanelMA();
- virtual ~AGASmallTabPanelMA();
-
- // TControl-compatible I method
- void IAGASmallTabPanelMA(TView* itsSuperView, const VPoint& itsLocation, const VPoint& itsSize, SizeDeterminer itsHSizeDet, SizeDeterminer itsVSizeDet, const TextStyle& itsTextStyle = gSystemStyle);
-
- protected:
-
- virtual void CreateAGAObject();
- };
-
- #endif // __GRAYCOUNCILMA__
-
-