gecko-dev/lib/mac/UserInterface/CPatternButtonPopup.h

291 строка
8.1 KiB
C
Исходник Обычный вид История

1998-03-28 05:44:41 +03:00
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* 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-03-28 05:44:41 +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-03-28 05:44:41 +03:00
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
1998-03-28 05:44:41 +03:00
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
1998-03-28 05:44:41 +03:00
*/
#ifndef CPatternButtonPopup_H
#define CPatternButtonPopup_H
#pragma once
// Includes
#include "CPatternButton.h"
#include "MPaneEnablerPolicy.h"
// Forward declarations
class LMenu;
// Class declaration
class CPatternButtonPopup : public CPatternButton
{
public:
enum { class_ID = 'PbPu' };
typedef CPatternButton super;
class CValueRangeException { };
class CAttemptToSetDisabledValueException { };
// <20> Construction/destruction
CPatternButtonPopup(LStream* inStream);
virtual ~CPatternButtonPopup();
// <20> Menu factory methods
virtual LMenu* GetMenu() const;
virtual void SetMenu(LMenu* inMenu);
virtual void AdoptMenu(LMenu* inMenuToAdopt);
virtual Boolean OwnsMenu() const;
// <20> Value mutators
virtual void SetValue(Int32 inValue);
virtual void SetPopupMinMaxValues();
// <20> Property accessors
UInt32 GetTicksBeforeDisplayingPopup() const;
void SetTicksBeforeDisplayingPopup(UInt32 inTicksBeforeDisplayingPopup);
Int32 GetQuickClickValueOrCommand() const;
void SetQuickClickValueOrCommand(Int32 inQuickClickValueOrCommand);
Boolean QuickClickIsCommandBased() const;
void SetQuickClickIsCommandBased(Boolean inQuickClickIsCommandBase);
Boolean MenuIsResourceBased() const;
void SetMenuIsResourceBased(Boolean inResourceBasedMenu);
Boolean MarkCurrentItem() const;
void SetMarkCurrentItem(Boolean inMarkCurrentItem);
Uint8 GetMarkCharacter() const;
void SetMarkCharacter(Uint8 inMarkCharacter);
Boolean PopdownBehavior() const;
void SetPopdownBehavior(Boolean inPopdownBehavior);
protected:
virtual void FinishCreateSelf();
// <20> Menu factory methods
virtual void MakeNewMenu();
virtual void EliminatePreviousMenu();
// <20> Tracking
virtual Boolean TrackHotSpot(
Int16 inHotSpot,
Point inPoint,
Int16 inModifiers);
virtual void HandlePopupMenuSelect(
Point inPopupLoc,
Int16 inCurrentItem,
Int16& outMenuID,
Int16& outMenuItem);
virtual void HotSpotResult(Int16 inHotSpot);
// <20> Miscellaneous
virtual Boolean OKToSendCommand(Int32 inCommand);
virtual void BroadcastValueMessage();
virtual void AdjustMenuContents();
virtual void SetupCurrentMenuItem(
MenuHandle inMenuH,
Int16 inCurrentItem);
virtual void GetPopupMenuPosition(Point& outPopupLoc);
// <20> "Template" methods (or hooks)
virtual void HandleQuickClick();
virtual Boolean HandleNewValue(Int32 inNewValue);
virtual void HandleEnablingPolicy();
private:
LMenu* mMenu;
ResIDT mPopupMenuID;
ResIDT mPopupTextTraitsID;
Int32 mInitialCurrentItem;
Uint32 mTicksBeforeDisplayingPopup;
Int32 mQuickClickValueOrCommand;
Boolean mQuickClickIsCommandBased;
Boolean mResourceBasedMenu;
Boolean mPopdownBehavior;
Boolean mMarkCurrentItem;
Uint8 mMarkCharacter;
Boolean mDetachResource;
Boolean mOwnsMenu;
Boolean mPopUpMenuSelectWasCalled;
};
// Inline methods
// ---------------------------------------------------------------------------
// <09> GetTicksBeforeDisplayingPopup
// ---------------------------------------------------------------------------
inline UInt32
CPatternButtonPopup::GetTicksBeforeDisplayingPopup() const
{
return mTicksBeforeDisplayingPopup;
}
// ---------------------------------------------------------------------------
// <09> SetTicksBeforeDisplayingPopup
// ---------------------------------------------------------------------------
inline void
CPatternButtonPopup::SetTicksBeforeDisplayingPopup(UInt32 inTicksBeforeDisplayingPopup)
{
mTicksBeforeDisplayingPopup = inTicksBeforeDisplayingPopup;
}
// ---------------------------------------------------------------------------
// <09> GetQuickClickValueOrCommand
// ---------------------------------------------------------------------------
inline Int32
CPatternButtonPopup::GetQuickClickValueOrCommand() const
{
return mQuickClickValueOrCommand;
}
// ---------------------------------------------------------------------------
// <09> SetQuickClickValueOrCommand
// ---------------------------------------------------------------------------
inline void
CPatternButtonPopup::SetQuickClickValueOrCommand(Int32 inQuickClickValueOrCommand)
{
mQuickClickValueOrCommand = inQuickClickValueOrCommand;
}
// ---------------------------------------------------------------------------
// <09> QuickClickIsCommandBased
// ---------------------------------------------------------------------------
inline Boolean
CPatternButtonPopup::QuickClickIsCommandBased() const
{
return mQuickClickIsCommandBased;
}
// ---------------------------------------------------------------------------
// <09> SetQuickClickIsCommandBased
// ---------------------------------------------------------------------------
inline void
CPatternButtonPopup::SetQuickClickIsCommandBased(Boolean inQuickClickIsCommandBase)
{
mQuickClickIsCommandBased = inQuickClickIsCommandBase;
}
// ---------------------------------------------------------------------------
// <09> MenuIsResourceBased
// ---------------------------------------------------------------------------
inline Boolean
CPatternButtonPopup::MenuIsResourceBased() const
{
return mResourceBasedMenu;
}
// ---------------------------------------------------------------------------
// <09> SetMenuIsResourceBased
// ---------------------------------------------------------------------------
inline void
CPatternButtonPopup::SetMenuIsResourceBased(Boolean inResourceBasedMenu)
{
mResourceBasedMenu = inResourceBasedMenu;
}
// ---------------------------------------------------------------------------
// <09> MarkCurrentItem
// ---------------------------------------------------------------------------
inline Boolean
CPatternButtonPopup::MarkCurrentItem() const
{
return mMarkCurrentItem;
}
// ---------------------------------------------------------------------------
// <09> SetMarkCurrentItem
// ---------------------------------------------------------------------------
inline void
CPatternButtonPopup::SetMarkCurrentItem(Boolean inMarkCurrentItem)
{
mMarkCurrentItem = inMarkCurrentItem;
}
// ---------------------------------------------------------------------------
// <09> PopdownBehavior
// ---------------------------------------------------------------------------
inline Boolean
CPatternButtonPopup::PopdownBehavior() const
{
return mPopdownBehavior;
}
// ---------------------------------------------------------------------------
// <09> SetPopdownBehavior
// ---------------------------------------------------------------------------
inline void
CPatternButtonPopup::SetPopdownBehavior(
Boolean inPopdownBehavior)
{
mPopdownBehavior = inPopdownBehavior;
}
// ---------------------------------------------------------------------------
// <09> GetMarkCharacter
// ---------------------------------------------------------------------------
inline Uint8
CPatternButtonPopup::GetMarkCharacter() const
{
return mMarkCharacter;
}
// ---------------------------------------------------------------------------
// <09> SetMarkCharacter
// ---------------------------------------------------------------------------
inline void
CPatternButtonPopup::SetMarkCharacter(Uint8 inMarkCharacter)
{
mMarkCharacter = inMarkCharacter;
}
#endif