mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-21 09:49:14 +00:00
More appearance manager changes. Support for toolbar buttons being AM savvy. (appr sdagley).
This commit is contained in:
parent
382dfd7c13
commit
57f608c962
@ -52,20 +52,23 @@
|
||||
#include <LProgressBar.h>
|
||||
#include <LPushButton.h>
|
||||
#include <LAMPushButtonImp.h>
|
||||
|
||||
#include <LBevelButton.h>
|
||||
#include <LCmdBevelButton.h>
|
||||
|
||||
// ¥¥¥ Things that will go away after appearance conversion complete
|
||||
#include "CProgressBar.h"
|
||||
#include "CPatternBevelView.h"
|
||||
|
||||
#include "CBevelButton.h"
|
||||
#include "CPatternButtonPopup.h"
|
||||
|
||||
// ¥¥¥ PowerPlant Grayscale Classes
|
||||
#include <UGALibRegistry.h>
|
||||
|
||||
// ¥¥¥ General Purpose UI Classes
|
||||
#include "CBevelButton.h"
|
||||
#include "CToolbarBevelButton.h"
|
||||
#include "CPatternButton.h"
|
||||
#include "CAMSavvyBevelView.h"
|
||||
#include "CPatternButtonPopup.h"
|
||||
#include "CGuidePopupMenu.h"
|
||||
|
||||
#include "CNavigationButtonPopup.h"
|
||||
#include "CCloseAllAttachment.h"
|
||||
#include "CColorEraseAttachment.h"
|
||||
@ -233,18 +236,20 @@ void RegisterAllBrowserClasses(void)
|
||||
RegisterClassID_(LAMPushButtonImp, LPushButton::imp_class_ID);
|
||||
// RegisterClass_(LBevelButton);
|
||||
// RegisterClassID_(LAMControlImp, LBevelButton::imp_class_ID);
|
||||
RegisterClass_(LCmdBevelButton);
|
||||
RegisterClassID_(LAMControlImp, LCmdBevelButton::imp_class_ID);
|
||||
|
||||
// ¥¥¥ Things that will go away after appearance port complete
|
||||
RegisterClass_(CProgressBar);
|
||||
RegisterClass_(CPatternBevelView);
|
||||
|
||||
// ¥¥¥ General Purpose UI Classes
|
||||
RegisterClass_(CBevelButton);
|
||||
RegisterClass_(CDeluxeBevelButton);
|
||||
RegisterClass_(CPatternButton);
|
||||
RegisterClass_(CPatternButtonPopup);
|
||||
RegisterClass_(CAMSavvyBevelView);
|
||||
|
||||
|
||||
// ¥¥¥ General Purpose UI Classes
|
||||
RegisterClass_(CToolbarBevelButton);
|
||||
RegisterClass_(CAMSavvyBevelView);
|
||||
|
||||
RegisterClass_(CIncludeView);
|
||||
RegisterClass_(CPlaceHolderView);
|
||||
@ -283,7 +288,6 @@ void RegisterAllBrowserClasses(void)
|
||||
RegisterClass_(CTextEdit);
|
||||
RegisterClass_(CEditBroadcaster);
|
||||
|
||||
RegisterClass_(CGuidePopupMenu);
|
||||
RegisterClass_(CNavigationButtonPopup);
|
||||
|
||||
// *** Browser Specific UI Classes
|
||||
|
@ -506,6 +506,13 @@ void CBrowserWindow::FindCommandStatus(
|
||||
//
|
||||
switch (inCommand)
|
||||
{
|
||||
// the bevel button for the branding icon asks us if this command should be enabled
|
||||
// so that the button can be enabled. We always want this button enabled, so return
|
||||
// true.
|
||||
case LOGO_BUTTON:
|
||||
outEnabled = true;
|
||||
break;
|
||||
|
||||
case cmd_DocumentInfo:
|
||||
case cmd_ViewSource:
|
||||
if (mContext && (mIsRootDocInfo || mIsViewSource || mIsHTMLHelp))
|
||||
|
@ -71,30 +71,26 @@ CNavigationButtonPopup::~CNavigationButtonPopup()
|
||||
void
|
||||
CNavigationButtonPopup::AdjustMenuContents()
|
||||
{
|
||||
if (!GetMenu() || !GetMenu()->GetMacMenuH())
|
||||
{
|
||||
if (!GetMenuHandle())
|
||||
return;
|
||||
}
|
||||
|
||||
if (!AssertPreconditions())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Purge the menu
|
||||
|
||||
UMenuUtils::PurgeMenuItems(GetMenu()->GetMacMenuH());
|
||||
UMenuUtils::PurgeMenuItems(GetMenuHandle());
|
||||
|
||||
// Fill the menu
|
||||
|
||||
if (GetQuickClickValueOrCommand() == cmd_GoBack)
|
||||
if (GetCommandNumber() == cmd_GoBack)
|
||||
{
|
||||
for (int insertAfterItem = 0, i = mCurrentEntryIndex - 1; i >= 1; i--, insertAfterItem++)
|
||||
{
|
||||
InsertHistoryItemIntoMenu(i, insertAfterItem);
|
||||
}
|
||||
}
|
||||
else if (GetQuickClickValueOrCommand() == cmd_GoForward)
|
||||
else if (GetCommandNumber() == cmd_GoForward)
|
||||
{
|
||||
for (int insertAfterItem = 0, i = mCurrentEntryIndex + 1; i <= mNumItemsInHistory; i++, insertAfterItem++)
|
||||
{
|
||||
@ -104,7 +100,7 @@ CNavigationButtonPopup::AdjustMenuContents()
|
||||
|
||||
// Set the min/max values of the control since we populated the menu
|
||||
|
||||
SetPopupMinMaxValues();
|
||||
// SetPopupMinMaxValues();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@ -116,7 +112,7 @@ CNavigationButtonPopup::InsertHistoryItemIntoMenu(
|
||||
Int32 inHistoryItemIndex,
|
||||
Int16 inAfterItem)
|
||||
{
|
||||
Assert_(GetMenu() && GetMenu()->GetMacMenuH());
|
||||
Assert_(GetMenuHandle());
|
||||
Assert_(mBrowserContext);
|
||||
|
||||
CAutoPtr<cstring> theTitle = mBrowserContext->GetHistoryEntryTitleByIndex(inHistoryItemIndex);
|
||||
@ -133,11 +129,11 @@ CNavigationButtonPopup::InsertHistoryItemIntoMenu(
|
||||
|
||||
// Insert a "blank" item first...
|
||||
|
||||
::InsertMenuItem(GetMenu()->GetMacMenuH(), "\p ", inAfterItem + 1);
|
||||
::InsertMenuItem(GetMenuHandle(), "\p ", inAfterItem + 1);
|
||||
|
||||
// Then change it. We do this so that no interpretation of metacharacters will occur.
|
||||
|
||||
::SetMenuItemText(GetMenu()->GetMacMenuH(), inAfterItem + 1, thePString);
|
||||
::SetMenuItemText(GetMenuHandle(), inAfterItem + 1, thePString);
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
@ -154,19 +150,13 @@ CNavigationButtonPopup::HandleNewValue(
|
||||
{
|
||||
Int32 historyIndex = 0;
|
||||
|
||||
if (GetQuickClickValueOrCommand() == cmd_GoBack)
|
||||
{
|
||||
if (GetCommandNumber() == cmd_GoBack)
|
||||
historyIndex = SHIST_GetIndex(mHistory, mCurrentEntry) - inNewValue;
|
||||
}
|
||||
else if (GetQuickClickValueOrCommand() == cmd_GoForward)
|
||||
{
|
||||
else if (GetCommandNumber() == cmd_GoForward)
|
||||
historyIndex = SHIST_GetIndex(mHistory, mCurrentEntry) + inNewValue;
|
||||
}
|
||||
|
||||
if (historyIndex)
|
||||
{
|
||||
mBrowserContext->LoadHistoryEntry(historyIndex);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -183,31 +173,21 @@ CNavigationButtonPopup::AssertPreconditions()
|
||||
CMediatedWindow* topWindow = CWindowMediator::GetWindowMediator()->FetchTopWindow(WindowType_Any, regularLayerType);
|
||||
|
||||
if (!topWindow || topWindow->GetWindowType() != WindowType_Browser)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
CBrowserWindow* browserWindow = dynamic_cast<CBrowserWindow*>(topWindow);
|
||||
|
||||
if (!browserWindow)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(mBrowserContext = (CBrowserContext*)browserWindow->GetWindowContext()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(mHistory = &((MWContext*)(*mBrowserContext))->hist))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(mCurrentEntry = mBrowserContext->GetCurrentHistoryEntry()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
mCurrentEntryIndex = SHIST_GetIndex(mHistory, mCurrentEntry);
|
||||
|
||||
@ -215,3 +195,16 @@ CNavigationButtonPopup::AssertPreconditions()
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// ClickSelf
|
||||
//
|
||||
// Override to fixup the menus before we show them
|
||||
//
|
||||
void
|
||||
CNavigationButtonPopup :: ClickSelf ( const SMouseDownEvent & inEvent )
|
||||
{
|
||||
AdjustMenuContents();
|
||||
super::ClickSelf(inEvent);
|
||||
}
|
@ -27,7 +27,7 @@
|
||||
|
||||
// Includes
|
||||
|
||||
#include "CPatternButtonPopup.h"
|
||||
#include "CToolbarBevelButton.h"
|
||||
#include "shist.h"
|
||||
|
||||
// Forward declarations
|
||||
@ -36,19 +36,21 @@ class CBrowserContext;
|
||||
|
||||
// Class declaration
|
||||
|
||||
class CNavigationButtonPopup : public CPatternButtonPopup
|
||||
class CNavigationButtonPopup : public CToolbarBevelButton
|
||||
{
|
||||
public:
|
||||
enum { class_ID = 'PbNv' };
|
||||
enum { class_ID = 'TbNv' };
|
||||
|
||||
typedef CPatternButtonPopup super;
|
||||
typedef CToolbarBevelButton super;
|
||||
|
||||
CNavigationButtonPopup(LStream* inStream);
|
||||
virtual ~CNavigationButtonPopup();
|
||||
|
||||
protected:
|
||||
virtual void AdjustMenuContents();
|
||||
virtual void ClickSelf ( const SMouseDownEvent & inEvent );
|
||||
|
||||
virtual void AdjustMenuContents();
|
||||
|
||||
virtual void InsertHistoryItemIntoMenu(
|
||||
Int32 inHistoryItemIndex,
|
||||
Int16 inAfterItem);
|
||||
|
@ -23,8 +23,6 @@
|
||||
#include <UResourceMgr.h>
|
||||
#include "CSpinningN.h"
|
||||
#include "UGraphicGizmos.h"
|
||||
#include "UGAAppearance.h"
|
||||
#include "CSharedPatternWorld.h"
|
||||
#include "macutil.h"
|
||||
#include "CNSContext.h" // for the broadcast messages
|
||||
#include "uapp.h"
|
||||
@ -52,10 +50,7 @@ const Int16 cButtonBevelBorderSize = 8;
|
||||
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
|
||||
|
||||
CSpinningN::CSpinningN(LStream *inStream)
|
||||
: mAdornment(nil),
|
||||
mFill(nil),
|
||||
|
||||
CPatternButton(inStream)
|
||||
: CToolbarBevelButton(inStream)
|
||||
{
|
||||
mSpinCounter = 0; // 0 indicates the icon is not spinning
|
||||
mIsCoBranded = false;
|
||||
@ -75,18 +70,13 @@ CSpinningN::CSpinningN(LStream *inStream)
|
||||
|
||||
void CSpinningN::FinishCreateSelf(void)
|
||||
{
|
||||
CPatternButton::FinishCreateSelf();
|
||||
CToolbarBevelButton::FinishCreateSelf();
|
||||
|
||||
CalcAnimationMode();
|
||||
RepositionSelf();
|
||||
mFinishedCreatingSelf = true;
|
||||
|
||||
LView* theSuperView = GetSuperView();
|
||||
if (theSuperView)
|
||||
{
|
||||
mAdornment = theSuperView->FindPaneByID(kAdornmentPaneID);
|
||||
mFill = theSuperView->FindPaneByID(kFillPaneID);
|
||||
}
|
||||
StopSpinningNow();
|
||||
}
|
||||
|
||||
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
|
||||
@ -131,35 +121,35 @@ void CSpinningN::AdaptToSuperFrameSize(
|
||||
// not be positionned correctly at that time.
|
||||
}
|
||||
|
||||
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
|
||||
// ¥
|
||||
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
|
||||
|
||||
//
|
||||
// StartRepeating
|
||||
//
|
||||
void CSpinningN::StartRepeating(void)
|
||||
{
|
||||
if (mRefCount == 0)
|
||||
{
|
||||
mSpinCounter = 1; // > 0 means that we're spinning
|
||||
mLastSpinTicks = ::TickCount();
|
||||
|
||||
|
||||
LPeriodical::StartRepeating();
|
||||
}
|
||||
++mRefCount;
|
||||
}
|
||||
|
||||
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
|
||||
// ¥
|
||||
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
|
||||
|
||||
//
|
||||
// StopRepeating
|
||||
//
|
||||
void CSpinningN::StopRepeating()
|
||||
{
|
||||
if (mRefCount <= 1)
|
||||
{
|
||||
LPeriodical::StopRepeating();
|
||||
|
||||
{
|
||||
mSpinCounter = 0; // 0 indicates the icon is not spinning
|
||||
mLastSpinTicks = ::TickCount();
|
||||
|
||||
LPeriodical::StopRepeating();
|
||||
|
||||
if (IsVisible() && FocusDraw())
|
||||
Draw(NULL);
|
||||
}
|
||||
@ -167,6 +157,16 @@ void CSpinningN::StopRepeating()
|
||||
--mRefCount;
|
||||
if (mRefCount < 0)
|
||||
mRefCount = 0;
|
||||
|
||||
// get back to std icon
|
||||
ControlButtonContentInfo newInfo;
|
||||
newInfo.u.resID = mGraphicID;
|
||||
if (mIsCoBranded)
|
||||
newInfo.contentType = kControlContentCIconRes;
|
||||
else
|
||||
newInfo.contentType = kControlContentIconSuiteRes;
|
||||
SetContentInfo ( newInfo );
|
||||
|
||||
}
|
||||
|
||||
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
|
||||
@ -186,7 +186,7 @@ void CSpinningN::StopSpinningNow()
|
||||
// ¥
|
||||
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
|
||||
|
||||
void CSpinningN::SpendTime(const EventRecord& /* inMacEvent */)
|
||||
void CSpinningN::SpendTime(const EventRecord& inMacEvent )
|
||||
{
|
||||
if ((::TickCount() - mLastSpinTicks) < kSpinInterval)
|
||||
return;
|
||||
@ -196,106 +196,14 @@ void CSpinningN::SpendTime(const EventRecord& /* inMacEvent */)
|
||||
mSpinCounter = (mSpinCounter + 1) % mIconCount;
|
||||
if (mSpinCounter == 0) // skip zero
|
||||
mSpinCounter++;
|
||||
|
||||
if (IsVisible() && FocusDraw())
|
||||
Draw(NULL);
|
||||
}
|
||||
|
||||
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
|
||||
// ¥
|
||||
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
|
||||
|
||||
void CSpinningN::DrawSelf(void)
|
||||
{
|
||||
PrepareDrawButton();
|
||||
|
||||
DrawButtonContent();
|
||||
|
||||
DrawButtonGraphic();
|
||||
|
||||
FinalizeDrawButton();
|
||||
}
|
||||
|
||||
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
|
||||
// ¥ DrawButtonContent
|
||||
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
|
||||
|
||||
void CSpinningN::DrawButtonContent(void)
|
||||
{
|
||||
CGrafPtr thePort;
|
||||
::GetPort(&(GrafPtr)thePort);
|
||||
|
||||
Rect theFrame = mCachedButtonFrame;
|
||||
Point theAlignment;
|
||||
|
||||
CalcOrientationPoint(theAlignment);
|
||||
mPatternWorld->Fill(thePort, theFrame, theAlignment);
|
||||
|
||||
::InsetRect(&theFrame, 2, 2);
|
||||
|
||||
if (IsActive() && IsEnabled())
|
||||
{
|
||||
if (IsTrackInside() || (!IsBehaviourButton() && (mValue == Button_On)))
|
||||
{
|
||||
DrawButtonHilited();
|
||||
}
|
||||
else
|
||||
{
|
||||
DrawButtonNormal();
|
||||
}
|
||||
}
|
||||
ControlButtonContentInfo newInfo;
|
||||
newInfo.u.resID = mGraphicID + mSpinCounter;
|
||||
if (mIsCoBranded)
|
||||
newInfo.contentType = kControlContentCIconRes;
|
||||
else
|
||||
{
|
||||
DrawSelfDisabled();
|
||||
}
|
||||
}
|
||||
|
||||
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
|
||||
// ¥ DrawSelfDisabled
|
||||
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
|
||||
|
||||
void CSpinningN::DrawSelfDisabled(void)
|
||||
{
|
||||
UGAAppearance::DrawGAButtonDimmedBevelTint(mCachedButtonFrame);
|
||||
}
|
||||
|
||||
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
|
||||
// ¥ DrawButtonGraphic
|
||||
//
|
||||
// the first cicn's or icl8's in each of the large and small sequences should
|
||||
// be preloaded and locked.
|
||||
// ÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑÑ
|
||||
|
||||
void CSpinningN::DrawButtonGraphic(void)
|
||||
{
|
||||
Rect theFrame;
|
||||
CalcLocalFrameRect(theFrame);
|
||||
|
||||
UGraphicGizmos::CenterRectOnRect(mCachedIconFrame, theFrame);
|
||||
|
||||
if (IsTrackInside() || (GetValue() == Button_On))
|
||||
::OffsetRect(&mCachedIconFrame, 1, 1);
|
||||
|
||||
if (mIsCoBranded)
|
||||
{
|
||||
StUseResFile rf(mAnimResFile);
|
||||
CIconHandle theHandle = ::GetCIcon(mGraphicID + mSpinCounter);
|
||||
if (theHandle == NULL)
|
||||
theHandle = ::GetCIcon(mGraphicID);
|
||||
|
||||
if (theHandle != NULL)
|
||||
{
|
||||
::PlotCIcon(&mCachedIconFrame, theHandle);
|
||||
::DisposeCIcon(theHandle);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// UGraphicGizmos::CenterRectOnRect(mCachedIconFrame, theFrame);
|
||||
OSErr theErr = ::PlotIconID(&mCachedIconFrame, atNone, ttNone, mGraphicID + mSpinCounter);
|
||||
if (theErr != noErr)
|
||||
::PlotIconID(&mCachedIconFrame, atNone, ttNone, mGraphicID);
|
||||
}
|
||||
newInfo.contentType = kControlContentIconSuiteRes;
|
||||
SetContentInfo ( newInfo );
|
||||
}
|
||||
|
||||
|
||||
@ -453,11 +361,6 @@ void CSpinningN::RepositionSelf(SDimension16* inNewToolbarSize)
|
||||
// SDimension16 frameSize;
|
||||
GetFrameSize(frameSize);
|
||||
|
||||
// v = (theSuperFrameSize.height - theHeight) / 2;
|
||||
// h = theSuperFrameSize.width - theWidth - v - 1;
|
||||
// PlaceInSuperFrameAt(h, v, false);
|
||||
// ResizeFrameTo(theWidth, theHeight, true);
|
||||
|
||||
// Adjust theWidth and theHeight to take into account
|
||||
// button bevel
|
||||
|
||||
@ -468,34 +371,6 @@ void CSpinningN::RepositionSelf(SDimension16* inNewToolbarSize)
|
||||
h = theSuperFrameSize.width - theWidth - v - 1;
|
||||
PlaceInSuperFrameAt(h, v, false);
|
||||
ResizeFrameTo(theWidth, theHeight, true);
|
||||
|
||||
/*
|
||||
// Adjust the adornment pane
|
||||
|
||||
if (theSuperFrameSize.height <= theHeight || theHeight < 40)
|
||||
{
|
||||
if (mAdornment)
|
||||
mAdornment->Hide();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (mAdornment)
|
||||
{
|
||||
mAdornment->PlaceInSuperFrameAt(h - 1, v - 1, false);
|
||||
mAdornment->ResizeFrameTo(theWidth + 2, theHeight + 2, true);
|
||||
mAdornment->Show();
|
||||
}
|
||||
}
|
||||
|
||||
// Adjust the position and size of the fill pane
|
||||
|
||||
if (mFill)
|
||||
{
|
||||
h = theSuperFrameSize.width - theWidth - v - 1;
|
||||
mFill->PlaceInSuperFrameAt(h, 1, false);
|
||||
mFill->ResizeFrameTo(theSuperFrameSize.width - h, theSuperFrameSize.height - 2, true);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void CSpinningN::GetLargeIconFrameSize(SDimension16& outFrameSize)
|
||||
|
@ -24,16 +24,15 @@
|
||||
|
||||
#include <LPane.h>
|
||||
#include <LListener.h>
|
||||
#include <LPeriodical.h>
|
||||
|
||||
#include "CPatternButton.h"
|
||||
|
||||
#include "CToolbarBevelButton.h"
|
||||
|
||||
const Int16 kMaxSpinStages = 40;
|
||||
|
||||
class CSpinningN :
|
||||
public CPatternButton,
|
||||
public LListener,
|
||||
protected LPeriodical
|
||||
public CToolbarBevelButton,
|
||||
public LListener
|
||||
{
|
||||
public:
|
||||
enum {
|
||||
@ -68,19 +67,7 @@ class CSpinningN :
|
||||
|
||||
|
||||
virtual void FinishCreateSelf(void);
|
||||
virtual void DrawSelf(void);
|
||||
|
||||
virtual void DrawButtonGraphic(void);
|
||||
virtual void DrawButtonContent(void);
|
||||
virtual void DrawSelfDisabled(void);
|
||||
|
||||
// We redraw on Activate/Deactivate/Enable/Disable in order to play well
|
||||
// with the darn CBevelView stuff.
|
||||
virtual void ActivateSelf() { Draw(nil); }
|
||||
virtual void DeactivateSelf() { Draw(nil); }
|
||||
virtual void EnableSelf() { Draw(nil); }
|
||||
virtual void DisableSelf() { Draw(nil); }
|
||||
|
||||
virtual void CalcAnimationMode(void);
|
||||
virtual void RepositionSelf(SDimension16* inNewToolbarSize = NULL);
|
||||
|
||||
@ -108,6 +95,4 @@ class CSpinningN :
|
||||
|
||||
Boolean mFinishedCreatingSelf;
|
||||
|
||||
LPane* mAdornment;
|
||||
LPane* mFill;
|
||||
};
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include <LArrayIterator.h>
|
||||
|
||||
#include "CToolbarPatternBevelView.h"
|
||||
#include "CToolbarButton.h"
|
||||
#include "CToolbarBevelButton.h"
|
||||
#include "StRegionHandle.h"
|
||||
|
||||
#include <stddef.h>
|
||||
@ -72,7 +72,7 @@ void CToolbarPatternBevelView::CalcArrangement( Boolean inRotateArrangement, Int
|
||||
// ...once to calculate the old and new grid cell-size, and change the mode of each button;
|
||||
LPane* current_subview_ptr = 0;
|
||||
for ( LArrayIterator iter(mSubPanes); iter.Next(¤t_subview_ptr); )
|
||||
if ( CToolbarButton* button = dynamic_cast<CToolbarButton*>(current_subview_ptr) )
|
||||
if ( CToolbarBevelButton* button = dynamic_cast<CToolbarBevelButton*>(current_subview_ptr) )
|
||||
{
|
||||
++number_of_buttons;
|
||||
|
||||
@ -133,7 +133,7 @@ void CToolbarPatternBevelView::CalcArrangement( Boolean inRotateArrangement, Int
|
||||
if ( number_of_buttons > 0 )
|
||||
{
|
||||
for ( LArrayIterator iter(mSubPanes); (number_of_buttons > 0) && iter.Next(¤t_subview_ptr); )
|
||||
if ( CToolbarButton* button = dynamic_cast<CToolbarButton*>(current_subview_ptr) )
|
||||
if ( CToolbarBevelButton* button = dynamic_cast<CToolbarBevelButton*>(current_subview_ptr) )
|
||||
{
|
||||
--number_of_buttons;
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user