back to the AM version.

git-svn-id: svn://10.0.0.236/trunk@9030 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
pinkerton%netscape.com
1998-09-01 20:30:55 +00:00
parent 9a65fa5b1b
commit 593aba4abe
2 changed files with 98 additions and 58 deletions

View File

@@ -38,17 +38,12 @@ enum {eNoColorSet = -1};
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
CProgressCaption::CProgressCaption(LStream* inStream)
: CProgressBar(inStream)
: LView(inStream),
mBar(NULL), mStatusText(NULL)
{
inStream->ReadPString(mText);
// *inStream >> mText;
*inStream >> mBoundedTraitsID;
*inStream >> mIndefiniteTraitsID;
*inStream >> mHiddenTraitsID;
*inStream >> mEraseColor;
SetHidden();
}
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
// ¥
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
@@ -57,47 +52,94 @@ CProgressCaption::~CProgressCaption()
{
}
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
// ¥
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
StringPtr CProgressCaption::GetDescriptor(
void
CProgressCaption :: FinishCreateSelf ( )
{
mBar = dynamic_cast<LProgressBar*>(FindPaneByID(kProgressBar));
mStatusText = dynamic_cast<LCaption*>(FindPaneByID(kStatusText));
Assert_(mBar != NULL);
Assert_(mStatusText != NULL);
} // FinishCreateSelf
//
// GetDescriptor
// SetDescriptor
//
// Pass-through's to the caption object.
//
StringPtr
CProgressCaption::GetDescriptor(
Str255 outDescriptor) const
{
return LString::CopyPStr(mText, outDescriptor);
return mStatusText->GetDescriptor ( outDescriptor );
}
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
// ¥
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
void CProgressCaption::SetDescriptor(ConstStringPtr inDescriptor)
void
CProgressCaption::SetDescriptor(ConstStringPtr inDescriptor)
{
if (inDescriptor == NULL)
mText = "\p";
else
mText = inDescriptor;
mStatusText->SetDescriptor ( inDescriptor );
if (FocusExposed())
Draw(NULL);
}
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
// ¥
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
void CProgressCaption::SetDescriptor(const char* inCDescriptor)
void
CProgressCaption::SetDescriptor(const char* inCDescriptor)
{
if (inCDescriptor == NULL)
mText = "\p";
else
mText = inCDescriptor;
mStatusText->SetDescriptor ( LStr255(inCDescriptor) );
if (FocusExposed())
Draw(NULL);
}
//
// SetMaxValue
//
// Sets the max value of the progress bar control.
//
void
CProgressCaption :: SetMaxValue ( Int32 inNewMaxValue )
{
mBar->SetMaxValue ( inNewMaxValue ) ;
} // SetMaxValue
//
// GetValue
// SetValue
//
// Pass-throughs to the progress bar object. The value (-1) from layout means set the
// bar to an indefinite state (barber pole).
//
void
CProgressCaption :: SetValue ( Int32 inValue )
{
if ( inValue == eIndefinite ) {
EventRecord ignored; // SpendTime() really doesn't use this. Only needed
// because there is no API to spin barber pole (idle).
mBar->SetIndeterminateFlag ( true );
mBar->SpendTime(ignored);
}
else {
mBar->SetIndeterminateFlag ( false );
mBar->SetValue ( inValue );
}
}
Int32
CProgressCaption :: GetValue ( ) const
{
return mBar->GetValue ( );
}
#if 0
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
// ¥
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
@@ -204,3 +246,4 @@ void CProgressCaption::DrawSelf(void)
UGraphicGizmos::PlaceStringInRect(mText, theFrame, just);
}
#endif

View File

@@ -16,46 +16,43 @@
* Reserved.
*/
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
// CProgressCaption.h
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
//
// CProgressCaption
//
// Manages a progress bar and a text area to show loading status messages.
// Rewritten to use standard toolbox controls instead of drawing our own.
//
#pragma once
#include "CProgressBar.h"
#include <LProgressBar.h>
#include <LCaption.h>
class CProgressCaption : public CProgressBar
class CProgressCaption : public LView
{
public:
enum { class_ID = 'PgCp' };
enum { eBarHidden = -2 };
enum { class_ID = 'PgCp', kProgressBar = 'prog', kStatusText = 'capt' };
enum { eBarHidden = -2, eIndefinite = -1 };
CProgressCaption(LStream* inStream);
virtual ~CProgressCaption();
virtual void SetHidden() {SetValue(eBarHidden);}
virtual void SetDescriptor(ConstStringPtr inDescriptor);
virtual void SetDescriptor(const char* inCDescriptor);
virtual StringPtr GetDescriptor(Str255 outDescriptor) const;
virtual void Draw(RgnHandle inSuperDrawRgnH);
virtual void SetValue(Int32 inValue);
virtual Int32 GetValue() const;
virtual void SetMaxValue ( Int32 inMax ) ;
virtual void SetEraseColor(Int16 inPaletteIndex)
{ mEraseColor = inPaletteIndex; }
protected:
virtual void GetActiveColors(
RGBColor& bodyColor,
RGBColor& barColor,
RGBColor& FrameColor) const;
//DATA:
protected:
virtual void DrawSelf(void);
TString<Str255> mText;
ResIDT mBoundedTraitsID; // normal progress bar
ResIDT mIndefiniteTraitsID; // indefinite progress bar
ResIDT mHiddenTraitsID; // hidden progress bar
Int16 mEraseColor;
virtual void FinishCreateSelf ( ) ;
LProgressBar* mBar;
LCaption* mStatusText;
};