diff --git a/mozilla/cmd/macfe/gui/CProgressCaption.cp b/mozilla/cmd/macfe/gui/CProgressCaption.cp index 4c8c8c48653..65762374029 100644 --- a/mozilla/cmd/macfe/gui/CProgressCaption.cp +++ b/mozilla/cmd/macfe/gui/CProgressCaption.cp @@ -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(FindPaneByID(kProgressBar)); + mStatusText = dynamic_cast(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 \ No newline at end of file diff --git a/mozilla/cmd/macfe/gui/CProgressCaption.h b/mozilla/cmd/macfe/gui/CProgressCaption.h index 8a6154c93fa..d530cf3c95c 100644 --- a/mozilla/cmd/macfe/gui/CProgressCaption.h +++ b/mozilla/cmd/macfe/gui/CProgressCaption.h @@ -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 +#include -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 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; };