1998-04-15 04:06:11 +04: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-04-15 04:06:11 +04: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-04-15 04:06:11 +04: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-04-15 04:06:11 +04: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-04-15 04:06:11 +04:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
// CScrollerWithArrows
|
|
|
|
|
// Mike Pinkerton, Netscape Communications
|
|
|
|
|
//
|
|
|
|
|
// Contains:
|
|
|
|
|
//
|
|
|
|
|
// <20> CScrollerWithArrows
|
|
|
|
|
// A class which provides scrolling in one direction, vertical or
|
|
|
|
|
// horizontal, by using directional arrows at either end of the
|
|
|
|
|
// bar. If the height is longer than the width, we assume vertical
|
|
|
|
|
// scrolling (and vice versa).
|
|
|
|
|
//
|
|
|
|
|
// <20> CScrollArrowControl
|
|
|
|
|
// The arrow control which sends a message to scroll in a particular
|
|
|
|
|
// direction. Used by above class.
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
|
1998-06-03 01:39:14 +04:00
|
|
|
|
#include <LGAIconButton.h>
|
1998-04-15 04:06:11 +04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CScrollerWithArrows : public LView,
|
|
|
|
|
public LListener {
|
|
|
|
|
public:
|
|
|
|
|
enum { class_ID = 'CSWA' };
|
|
|
|
|
|
|
|
|
|
CScrollerWithArrows ( );
|
|
|
|
|
CScrollerWithArrows ( LStream *inStream );
|
|
|
|
|
virtual ~CScrollerWithArrows ( );
|
|
|
|
|
|
|
|
|
|
bool IsVertical ( ) const { return mIsVertical; }
|
|
|
|
|
|
|
|
|
|
virtual void InstallView ( LView *inScrollingView );
|
|
|
|
|
virtual void ExpandSubPane ( LPane *inSub, Boolean inExpandHoriz, Boolean inExpandVert );
|
|
|
|
|
|
|
|
|
|
virtual void AdjustScrollArrows ( );
|
|
|
|
|
virtual void ResizeFrameBy ( Int16 inWidthDelta, Int16 inHeightDelta, Boolean inRefresh );
|
|
|
|
|
|
|
|
|
|
virtual void SubImageChanged ( LView *inSubView );
|
|
|
|
|
virtual void ListenToMessage ( MessageT inMessage, void *ioParam );
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
|
|
enum ScrollDir { kUpLeft, kDownRight } ;
|
|
|
|
|
|
|
|
|
|
typedef struct { // read in from constructor stream
|
|
|
|
|
Int16 leftIndent;
|
|
|
|
|
Int16 rightIndent;
|
|
|
|
|
Int16 topIndent;
|
|
|
|
|
Int16 bottomIndent;
|
|
|
|
|
PaneIDT scrollingViewID;
|
|
|
|
|
} SScrollerArrowInfo;
|
|
|
|
|
|
|
|
|
|
LView* mScrollingView; // the view that is scrolled
|
|
|
|
|
PaneIDT mScrollingViewID; // pane id of view that scrolls
|
|
|
|
|
LControl* mUpLeftArrow; // our two scroll arrows
|
|
|
|
|
LControl* mDownRightArrow;
|
|
|
|
|
bool mIsVertical; // true if we scroll up/down, false if left/right
|
|
|
|
|
|
|
|
|
|
// Standard PowerPlant overrides for drawing/activation
|
|
|
|
|
virtual void FinishCreateSelf();
|
|
|
|
|
virtual void ActivateSelf();
|
|
|
|
|
virtual void DeactivateSelf();
|
|
|
|
|
|
|
|
|
|
// Override this to create a different kind of scroll arrow
|
|
|
|
|
virtual LControl* MakeOneScrollArrow ( const SPaneInfo &inPaneInfo,
|
|
|
|
|
ScrollDir inScrollWhichWay ) ;
|
|
|
|
|
|
|
|
|
|
void MakeScrollArrows ( Int16 inLeftIndent, Int16 inRightIndent, Int16 inTopIndent,
|
|
|
|
|
Int16 inBottomIndent);
|
|
|
|
|
|
|
|
|
|
}; // class CScrollerWithArrows
|
|
|
|
|
|
|
|
|
|
|
1998-06-03 01:39:14 +04:00
|
|
|
|
class CScrollArrowControl : public LGAIconButton
|
1998-04-15 04:06:11 +04:00
|
|
|
|
{
|
|
|
|
|
public:
|
1998-06-03 01:39:14 +04:00
|
|
|
|
enum { class_ID = 'CSAC' } ;
|
|
|
|
|
enum { kIconUp = 14504, kIconDown = 14505, kIconLeft = 14504, kIconRight = 14505 } ;
|
1998-04-15 04:06:11 +04:00
|
|
|
|
|
1998-06-03 01:39:14 +04:00
|
|
|
|
CScrollArrowControl ( const SPaneInfo &inPaneInfo, const SControlInfo &inControlInfo,
|
|
|
|
|
ResIDT inIconResID );
|
|
|
|
|
CScrollArrowControl ( LStream* inStream ) ;
|
1998-04-15 04:06:11 +04:00
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
1998-06-03 01:39:14 +04:00
|
|
|
|
virtual void DrawSelf ( ) ;
|
1998-04-15 04:06:11 +04:00
|
|
|
|
virtual void HotSpotAction ( Int16 inHotSpot, Boolean inCurrInside, Boolean inPrevInside );
|
|
|
|
|
|
|
|
|
|
}; // class CScrollArrowControl
|