1998-03-28 05:44:41 +03:00
|
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
|
*
|
2004-04-25 20:36:22 +04:00
|
|
|
|
* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
1998-03-28 05:44:41 +03:00
|
|
|
|
*
|
2004-04-25 20:36:22 +04:00
|
|
|
|
* The contents of this file are subject to the Mozilla 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/MPL/
|
|
|
|
|
*
|
|
|
|
|
* 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
|
|
|
|
*
|
1999-11-06 06:43:54 +03:00
|
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
|
*
|
2004-04-25 20:36:22 +04:00
|
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
|
* Netscape Communications Corporation.
|
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Contributor(s):
|
|
|
|
|
*
|
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
1999-11-06 06:43:54 +03:00
|
|
|
|
*
|
2004-04-25 20:36:22 +04:00
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
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
|