JX Application Framework
Loading...
Searching...
No Matches
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Friends | List of all members
JXMenu Class Referenceabstract

#include <JXMenu.h>

Inheritance diagram for JXMenu:
[legend]

Classes

class  ItemSelected
 
class  NeedsUpdate
 

Public Types

enum  ItemType {
  kPlainType ,
  kCheckboxType ,
  kRadioType
}
 
enum  UpdateAction {
  kDisableNone ,
  kDisableSingles ,
  kDisableAll
}
 
enum  Style {
  kMacintoshStyle = 0 ,
  kWindowsStyle ,
  kStyleMax = kWindowsStyle
}
 
enum  ArrowPosition {
  kArrowAtLeft ,
  kArrowAtRight
}
 
enum  ArrowDirection {
  kArrowPointsUp ,
  kArrowPointsDown
}
 
- Public Types inherited from JXWidget
enum  HSizingOption {
  kFixedLeft ,
  kFixedRight ,
  kHElastic
}
 
enum  VSizingOption {
  kFixedTop ,
  kFixedBottom ,
  kVElastic
}
 

Public Member Functions

 JXMenu (const JString &title, JXContainer *enclosure, const HSizingOption hSizing, const VSizingOption vSizing, const JCoordinate x, const JCoordinate y, const JCoordinate w, const JCoordinate h)
 
 JXMenu (JXImage *image, const bool menuOwnsImage, JXContainer *enclosure, const HSizingOption hSizing, const VSizingOption vSizing, const JCoordinate x, const JCoordinate y, const JCoordinate w, const JCoordinate h)
 
 JXMenu (const JString &title, JXImage *image, const bool menuOwnsImage, JXContainer *enclosure, const HSizingOption hSizing, const VSizingOption vSizing, const JCoordinate x, const JCoordinate y, const JCoordinate w, const JCoordinate h)
 
 JXMenu (JXMenu *owner, const JIndex itemIndex, JXContainer *enclosure)
 
 ~JXMenu () override
 
bool IsOpen () const
 
const JStringGetTitleText () const
 
bool GetTitleText (const JString **text) const
 
bool GetTitleImage (const JXImage **image) const
 
void SetTitle (const JString &title, JXImage *image, const bool menuOwnsImage)
 
void SetTitleText (const JString &title)
 
void SetTitleImage (JXImage *image, const bool menuOwnsImage)
 
void SetTitleFontName (const JString &fontName)
 
void SetTitleFontSize (const JSize size)
 
void SetTitleFontStyle (const JFontStyle &style)
 
void SetTitleFont (const JFont &font)
 
const JPointGetTitlePadding () const
 
void SetTitlePadding (const JPoint &p)
 
void SetShortcuts (const JString &list)
 
template<class T >
void AttachHandler (T *target, void(T::*handler)(const JIndex i))
 
template<class T >
void AttachHandlers (T *target, void(T::*updater)(), void(T::*handler)(const JIndex i))
 
void AttachHandlers (JBroadcaster *target, const std::function< void(void)> &updater, const std::function< void(const JIndex)> &handler)
 
bool IsEmpty () const
 
JSize GetItemCount () const
 
void RemoveItem (const JIndex index)
 
void RemoveAllItems ()
 
bool GetItemShortcuts (const JIndex index, JString *shortcuts) const
 
void SetItemShortcuts (const JIndex index, const JString &shortcuts)
 
bool GetItemID (const JIndex index, const JString **id) const
 
void SetItemID (const JIndex index, const JString &id)
 
bool ItemIDToIndex (const JString &targetID, JIndex *index) const
 
bool IsEnabled (const JIndex index) const
 
void EnableItem (const JIndex index)
 
void EnableAll ()
 
void DisableItem (const JIndex index)
 
void DisableAll ()
 
void SetItemEnabled (const JIndex index, const bool enabled)
 
JXMenu::ItemType GetItemType (const JIndex index) const
 
bool IsChecked (const JIndex index) const
 
void CheckItem (const JIndex index)
 
bool GetSubmenu (const JIndex index, const JXMenu **menu) const
 
void AttachSubmenu (const JIndex index, JXMenu *submenu)
 
bool RemoveSubmenu (const JIndex index, JXMenu **theMenu)
 
void DeleteSubmenu (const JIndex index)
 
UpdateAction GetUpdateAction () const
 
void SetUpdateAction (const UpdateAction action)
 
bool IsPopupChoice () const
 
virtual void SetToPopupChoice (const bool isPopup, const JIndex initialChoice)
 
void SetPopupChoice (const JIndex index)
 
void Activate () override
 
void Deactivate () override
 
void Suspend () override
 
void Resume () override
 
bool IsHiddenPopupMenu () const
 
void SetToHiddenPopupMenu (const bool isHiddenPopup=true)
 
bool PopUp (JXContainer *mouseOwner, const JPoint &pt, const JXButtonStates &buttonStates, const JXKeyModifiers &modifiers)
 
bool GetMenuBar (JXMenuBar **menuBar) const
 
JXMenuGetTopLevelMenu () const
 
ArrowPosition GetPopupArrowPosition () const
 
void SetPopupArrowPosition (const ArrowPosition position)
 
ArrowDirection GetPopupArrowDirection () const
 
void SetPopupArrowDirection (const ArrowDirection direction)
 
bool IsMenu () const override
 
void HandleShortcut (const int key, const JXKeyModifiers &modifiers) override
 
- Public Member Functions inherited from JXWidget
 ~JXWidget () override
 
void Deactivate () override
 
void Refresh () const override
 
void RefreshRect (const JRect &rect) const
 
void Redraw () const override
 
void RedrawRect (const JRect &rect) const
 
bool Focus ()
 
bool Unfocus ()
 
bool HasFocus () const
 
bool WillAcceptFocus () const
 
void SetSingleFocusWidget ()
 
virtual bool OKToUnfocus ()
 
bool WantsTab () const
 
bool WantsModifiedTab () const
 
virtual void HandleKeyPress (const JUtf8Character &c, const int keySym, const JXKeyModifiers &modifiers)
 
bool WillAcceptShortcut () const
 
JPoint GlobalToLocal (const JCoordinate x, const JCoordinate y) const override
 
JPoint LocalToGlobal (const JCoordinate x, const JCoordinate y) const override
 
void Place (const JCoordinate enclX, const JCoordinate enclY) override
 
void Move (const JCoordinate dx, const JCoordinate dy) override
 
void SetSize (const JCoordinate w, const JCoordinate h) override
 
void AdjustSize (const JCoordinate dw, const JCoordinate dh) override
 
HSizingOption GetHSizing () const
 
VSizingOption GetVSizing () const
 
void SetSizing (const HSizingOption hSizing, const VSizingOption vSizing)
 
void CenterWithinEnclosure (const bool adjustHoriz, const bool adjustVert)
 
void FitToEnclosure (const bool fitHoriz=true, const bool fitVert=true)
 
bool Scroll (const JCoordinate dx, const JCoordinate dy)
 
bool ScrollTo (const JCoordinate x, const JCoordinate y)
 
bool ScrollTo (const JPoint &pt)
 
bool ScrollToRect (const JRect &r)
 
bool ScrollToRectCentered (const JRect &r, const bool forceScroll)
 
JRect GetBoundsGlobal () const override
 
JRect GetFrameGlobal () const override
 
JRect GetApertureGlobal () const override
 
JSize GetBorderWidth () const
 
void SetBorderWidth (const JSize width)
 
JColorID GetCurrBackColor () const
 
JColorID GetBackColor () const
 
void SetBackColor (const JColorID color)
 
JColorID GetFocusColor () const
 
void SetFocusColor (const JColorID color)
 
JString ToString () const override
 
virtual JPoint GlobalToLocal (const JCoordinate x, const JCoordinate y) const=0
 
JPoint GlobalToLocal (const JPoint &pt) const
 
JRect GlobalToLocal (const JRect &r) const
 
virtual JPoint LocalToGlobal (const JCoordinate x, const JCoordinate y) const=0
 
JPoint LocalToGlobal (const JPoint &pt) const
 
JRect LocalToGlobal (const JRect &r) const
 
- Public Member Functions inherited from JXContainer
 ~JXContainer () override
 
bool IsAncestor (JXContainer *obj) const
 
virtual void Show ()
 
virtual void Hide ()
 
bool IsVisible () const
 
void SetVisible (const bool vis)
 
bool WouldBeVisible () const
 
bool IsActive () const
 
void SetActive (const bool active)
 
bool WouldBeActive () const
 
bool IsSuspended () const
 
bool IsDNDSource () const
 
bool IsDNDTarget () const
 
JPoint GlobalToLocal (const JPoint &pt) const
 
JRect GlobalToLocal (const JRect &r) const
 
JPoint LocalToGlobal (const JPoint &pt) const
 
JRect LocalToGlobal (const JRect &r) const
 
JRect GetBounds () const
 
JCoordinate GetBoundsWidth () const
 
JCoordinate GetBoundsHeight () const
 
JRect GetFrame () const
 
JRect GetFrameLocal () const
 
JCoordinate GetFrameWidth () const
 
JCoordinate GetFrameHeight () const
 
JRect GetAperture () const
 
JCoordinate GetApertureWidth () const
 
JCoordinate GetApertureHeight () const
 
JXDisplayGetDisplay () const
 
JXWindowGetWindow () const
 
JXContainerGetEnclosure () const
 
JFontManagerGetFontManager () const
 
JXFontManagerGetXFontManager () const
 
JXSelectionManagerGetSelectionManager () const
 
JXDNDManagerGetDNDManager () const
 
JXMenuManagerGetMenuManager () const
 
JCursorIndex GetDefaultCursor () const
 
bool GetHint (JString *text) const
 
void SetHint (const JString &text)
 
void ClearHint ()
 
bool GetVisibleRectGlobal (const JRect &origRectG, JRect *visRectG) const
 
void ForEach (const std::function< void(JXContainer *)> &f, const bool recurse)
 
void ForEach (const std::function< void(const JXContainer *)> &f, const bool recurse) const
 
void ExpandToFitContent ()
 
virtual bool RunInternalFTC (const bool horizontal, JCoordinate *newSize)
 
JRect ComputePaddingForInternalFTC () const
 
bool FindContainer (const JPoint &ptG, JXContainer **container) const
 
virtual bool IsMenuTable () const
 
- Public Member Functions inherited from JBroadcaster
 JBroadcaster ()
 
virtual ~JBroadcaster ()
 
JBroadcasteroperator= (const JBroadcaster &source)
 
bool HasSenders () const
 
JSize GetSenderCount () const
 
bool HasRecipients () const
 
JSize GetRecipientCount () const
 
template<class T >
void ListenTo (const JBroadcaster *sender, const std::function< void(const T &)> &f)
 

Static Public Member Functions

static Style GetDisplayStyle ()
 
static void SetDisplayStyle (const Style style)
 
- Static Public Member Functions inherited from JXContainer
static void DebugExpandToFitContent (const bool horiz)
 
static void DebugExpandToFitContentExtras (const bool noop, const bool overlap)
 

Static Public Attributes

static const JUtf8BytekNeedsUpdate = "NeedsUpdate::JXMenu"
 
static const JUtf8BytekItemSelected = "ItemSelected::JXMenu"
 
- Static Public Attributes inherited from JXWidget
static const JUtf8BytekGotFocus = "GotFocus::JXWidget"
 
static const JUtf8BytekLostFocus = "LostFocus::JXWidget"
 

Protected Member Functions

void SetBaseItemData (JXMenuData *baseItemData)
 
void ClearBaseItemData ()
 
bool PrepareToOpenMenu (const bool shortcut)
 
virtual JXMenuDirectorCreateMenuWindow (JXWindowDirector *supervisor)=0
 
virtual void AdjustPopupChoiceTitle (const JIndex index)=0
 
void Draw (JXWindowPainter &p, const JRect &rect) override
 
void DrawBorder (JXWindowPainter &p, const JRect &frame) override
 
void HandleMouseDown (const JPoint &pt, const JXMouseButton button, const JSize clickCount, const JXButtonStates &buttonStates, const JXKeyModifiers &modifiers) override
 
bool IncludeInFTC () const override
 
JCoordinate GetFTCMinContentSize (const bool horizontal) const override
 
void Receive (JBroadcaster *sender, const Message &message) override
 
void BroadcastSelection (const JIndex itemIndex, const bool fromShortcut)
 
- Protected Member Functions inherited from JXWidget
 JXWidget (JXContainer *enclosure, const HSizingOption hSizing, const VSizingOption vSizing, const JCoordinate x, const JCoordinate y, const JCoordinate w, const JCoordinate h)
 
void WantInput (const bool wantInput, const bool wantTab=false, const bool wantModifiedTab=false)
 
virtual void HandleFocusEvent ()
 
virtual void HandleUnfocusEvent ()
 
virtual void HandleWindowFocusEvent ()
 
virtual void HandleWindowUnfocusEvent ()
 
void UnlockBounds ()
 
void SetBounds (const JCoordinate w, const JCoordinate h)
 
void AdjustBounds (const JCoordinate dw, const JCoordinate dh)
 
void DrawBackground (JXWindowPainter &p, const JRect &frame) override
 
bool AcceptDrag (const JPoint &pt, const JXMouseButton button, const JXKeyModifiers &modifiers) override
 
JXDragPainterCreateDragInsidePainter ()
 
JXDragPainterCreateDragOutsidePainter ()
 
bool GetDragPainter (JXDragPainter **p) const
 
bool GetDragPainter (JPainter **p) const
 
void DeleteDragPainter ()
 
void BoundsMoved (const JCoordinate dx, const JCoordinate dy) override
 
void EnclosingBoundsMoved (const JCoordinate dx, const JCoordinate dy) override
 
void BoundsResized (const JCoordinate dw, const JCoordinate dh) override
 
void EnclosingBoundsResized (const JCoordinate dw, const JCoordinate dh) override
 
virtual void ApertureMoved (const JCoordinate dx, const JCoordinate dy)
 
virtual void ApertureResized (const JCoordinate dw, const JCoordinate dh)
 
void FTCAdjustSize (const JCoordinate dw, const JCoordinate dh) override
 
bool BeginDND (const JPoint &pt, const JXButtonStates &buttonStates, const JXKeyModifiers &modifiers, JXSelectionData *data, JXDNDManager::TargetFinder *targetFinder=nullptr)
 
virtual void DNDInit (const JPoint &pt, const JXButtonStates &buttonStates, const JXKeyModifiers &modifiers)
 
virtual void GetSelectionData (JXSelectionData *data, const JString &id)
 
virtual void DNDFinish (const bool isDrop, const JXContainer *target)
 
virtual void DNDCompletelyFinished ()
 
virtual Atom GetDNDAction (const JXContainer *target, const JXButtonStates &buttonStates, const JXKeyModifiers &modifiers)
 
virtual void GetDNDAskActions (const JXButtonStates &buttonStates, const JXKeyModifiers &modifiers, JArray< Atom > *askActionList, JPtrArray< JString > *askDescriptionList)
 
virtual void HandleDNDResponse (const JXContainer *target, const bool dropAccepted, const Atom action)
 
bool WillAllowUnboundedScrolling () const
 
void ShouldAllowUnboundedScrolling (const bool allow)
 
- Protected Member Functions inherited from JXContainer
 JXContainer (JXWindow *window, JXContainer *enclosure)
 
 JXContainer (JXDisplay *display, JXWindow *window, JXContainer *enclosure)
 
void TurnOnBufferedDrawing ()
 
void DrawAll (JXWindowPainter &p, const JRect &frameG)
 
virtual void HandleMouseEnter ()
 
virtual void HandleMouseHere (const JPoint &pt, const JXKeyModifiers &modifiers)
 
virtual void HandleMouseLeave ()
 
virtual void HandleMouseDrag (const JPoint &pt, const JXButtonStates &buttonStates, const JXKeyModifiers &modifiers)
 
virtual void HandleMouseUp (const JPoint &pt, const JXMouseButton button, const JXButtonStates &buttonStates, const JXKeyModifiers &modifiers)
 
virtual bool HitSamePart (const JPoint &pt1, const JPoint &pt2) const
 
virtual bool WillAcceptDrop (const JArray< Atom > &typeList, Atom *action, const JPoint &pt, const Time time, const JXWidget *source)
 
virtual void HandleDNDEnter ()
 
virtual void HandleDNDHere (const JPoint &pt, const JXWidget *source)
 
virtual void HandleDNDLeave ()
 
virtual void HandleDNDDrop (const JPoint &pt, const JArray< Atom > &typeList, const Atom action, const Time time, const JXWidget *source)
 
virtual void HandleDNDScroll (const JPoint &pt, const JXMouseButton scrollButton, const JXKeyModifiers &modifiers)
 
bool DispatchClientMessage (const XClientMessageEvent &clientMessage)
 
virtual bool HandleClientMessage (const XClientMessageEvent &clientMessage)
 
void NotifyBoundsMoved (const JCoordinate dx, const JCoordinate dy)
 
void NotifyBoundsResized (const JCoordinate dw, const JCoordinate dh)
 
virtual bool NeedsInternalFTC () const
 
virtual JRect GetFrameForFTC () const
 
bool GetEnclosedObjects (JPtrArrayIterator< JXContainer > **iter) const
 
void DeleteEnclosedObjects ()
 
void ShowCursor ()
 
void HideCursor ()
 
void SetDefaultCursor (const JCursorIndex index)
 
void DispatchCursor (const JPoint &ptG, const JXKeyModifiers &modifiers)
 
virtual void AdjustCursor (const JPoint &pt, const JXKeyModifiers &modifiers)
 
void DisplayCursor (const JCursorIndex index)
 
JXCursorAnimatorCreateCursorAnimator ()
 
JXCursorAnimatorGetCursorAnimator () const
 
void AnimateCursor () const
 
void RemoveCursorAnimator ()
 
void ActivateCursor (const JPoint &ptG, const JXKeyModifiers &modifiers)
 
void DeactivateCursor ()
 
std::ostream & GetFTCLog () const
 
virtual bool StealMouse (const int eventType, const JPoint &ptG, const JXMouseButton button, const unsigned int state)
 
- Protected Member Functions inherited from JBroadcaster
 JBroadcaster (const JBroadcaster &source)
 
void ListenTo (const JBroadcaster *sender)
 
void StopListening (const JBroadcaster *sender)
 
void ClearWhenGoingAway (const JBroadcaster *sender, void *pointerToMember)
 
void StopListening (const JBroadcaster *sender, const std::type_info &messageType)
 
template<class T >
void Send (JBroadcaster *recipient, const T &message)
 
template<class T >
void Broadcast (const T &message)
 
void SendWithFeedback (JBroadcaster *recipient, Message *message)
 
void BroadcastWithFeedback (Message *message)
 
virtual void ReceiveWithFeedback (JBroadcaster *sender, Message *message)
 
virtual void ReceiveGoingAway (JBroadcaster *sender)
 

Friends

class JXMenuData
 
class JXMenuTable
 
class JXMenuBar
 
class JXMenuManager
 
class JXToolBar
 

Detailed Description

When the menu is pulled down, the requested items are initially disabled
(see UpdateAction).  The default action is to disable all items that do
not have submenus (kDisableSingles).

All items are unchecked because the menu's owner should store this
information anyway, and it saves a lot of work to not have to enforce
one selection per radio group.  The client should be storing only a single
value for each radio group anyway, so it will be taken care of automatically.

If the menu is a PopupChoice, then it assumes that the entire menu is a
radio group so that only one item can be selected at a time.  The owner
of the menu remains responsible for tracking the selection.  We simply
include the text of the selected item in the menu title as a convenience.
Note that SetPopupChoice() does not need to be called when ItemSelected
is broadcast because we take care of it automatically in this case.

Items are not required to have ID's, but if they do, they should be
unique (like JBroadcaster messages) so each object can find its own
items.  The exception is an item that performs a standard action like
Copy and can therefore be shared by all objects.  The standard ID's
are stored in jXActions.h

Member Enumeration Documentation

◆ ArrowDirection

Enumerator
kArrowPointsUp 
kArrowPointsDown 

◆ ArrowPosition

Enumerator
kArrowAtLeft 
kArrowAtRight 

◆ ItemType

Enumerator
kPlainType 
kCheckboxType 
kRadioType 

◆ Style

Enumerator
kMacintoshStyle 
kWindowsStyle 
kStyleMax 

◆ UpdateAction

Enumerator
kDisableNone 
kDisableSingles 
kDisableAll 

Constructor & Destructor Documentation

◆ JXMenu() [1/4]

JXMenu::JXMenu ( const JString title,
JXContainer enclosure,
const HSizingOption  hSizing,
const VSizingOption  vSizing,
const JCoordinate  x,
const JCoordinate  y,
const JCoordinate  w,
const JCoordinate  h 
)

derived class must call SetItemData()

◆ JXMenu() [2/4]

JXMenu::JXMenu ( JXImage image,
const bool  menuOwnsImage,
JXContainer enclosure,
const HSizingOption  hSizing,
const VSizingOption  vSizing,
const JCoordinate  x,
const JCoordinate  y,
const JCoordinate  w,
const JCoordinate  h 
)

◆ JXMenu() [3/4]

JXMenu::JXMenu ( const JString title,
JXImage image,
const bool  menuOwnsImage,
JXContainer enclosure,
const HSizingOption  hSizing,
const VSizingOption  vSizing,
const JCoordinate  x,
const JCoordinate  y,
const JCoordinate  w,
const JCoordinate  h 
)

◆ JXMenu() [4/4]

JXMenu::JXMenu ( JXMenu owner,
const JIndex  itemIndex,
JXContainer enclosure 
)

◆ ~JXMenu()

JXMenu::~JXMenu ( )
override

Member Function Documentation

◆ Activate()

void JXMenu::Activate ( )
overridevirtual

Reimplemented from JXContainer.

◆ AdjustPopupChoiceTitle()

virtual void JXMenu::AdjustPopupChoiceTitle ( const JIndex  index)
protectedpure virtual

Implemented in JXImageMenu, and JXTextMenu.

◆ AttachHandler()

template<class T >
void JXMenu::AttachHandler ( T *  target,
void(T::*)(const JIndex i handler 
)
inline

◆ AttachHandlers() [1/2]

void JXMenu::AttachHandlers ( JBroadcaster target,
const std::function< void(void)> &  updater,
const std::function< void(const JIndex)> &  handler 
)

◆ AttachHandlers() [2/2]

template<class T >
void JXMenu::AttachHandlers ( T *  target,
void(T::*)()  updater,
void(T::*)(const JIndex i handler 
)
inline

◆ AttachSubmenu()

void JXMenu::AttachSubmenu ( const JIndex  index,
JXMenu submenu 
)

Deletes any old menu that was attached and attaches the new one.

◆ BroadcastSelection()

void JXMenu::BroadcastSelection ( const JIndex  itemIndex,
const bool  fromShortcut 
)
protected

◆ CheckItem()

void JXMenu::CheckItem ( const JIndex  index)

◆ ClearBaseItemData()

void JXMenu::ClearBaseItemData ( )
protected

This must be called in the derived class destructor before the JXMenuData object is deleted.

◆ CreateMenuWindow()

virtual JXMenuDirector * JXMenu::CreateMenuWindow ( JXWindowDirector supervisor)
protectedpure virtual

◆ Deactivate()

void JXMenu::Deactivate ( )
overridevirtual

Reimplemented from JXContainer.

◆ DeleteSubmenu()

void JXMenu::DeleteSubmenu ( const JIndex  index)

◆ DisableAll()

void JXMenu::DisableAll ( )

◆ DisableItem()

void JXMenu::DisableItem ( const JIndex  index)

◆ Draw()

void JXMenu::Draw ( JXWindowPainter p,
const JRect rect 
)
overrideprotectedvirtual

Implements JXContainer.

◆ DrawBorder()

void JXMenu::DrawBorder ( JXWindowPainter p,
const JRect frame 
)
overrideprotectedvirtual

Implements JXContainer.

◆ EnableAll()

void JXMenu::EnableAll ( )

◆ EnableItem()

void JXMenu::EnableItem ( const JIndex  index)

◆ GetDisplayStyle()

JXMenu::Style JXMenu::GetDisplayStyle ( )
inlinestatic

This controls the style that is displayed in the menus.

◆ GetFTCMinContentSize()

JCoordinate JXMenu::GetFTCMinContentSize ( const bool  horizontal) const
overrideprotectedvirtual

Reimplemented from JXContainer.

◆ GetItemCount()

JSize JXMenu::GetItemCount ( ) const

◆ GetItemID()

bool JXMenu::GetItemID ( const JIndex  index,
const JString **  id 
) const

Returns true if the item has an id.

◆ GetItemShortcuts()

bool JXMenu::GetItemShortcuts ( const JIndex  index,
JString shortcuts 
) const

◆ GetItemType()

JXMenu::ItemType JXMenu::GetItemType ( const JIndex  index) const

◆ GetMenuBar()

bool JXMenu::GetMenuBar ( JXMenuBar **  menuBar) const

Returns true if we are part of a menu bar.

◆ GetPopupArrowDirection()

JXMenu::ArrowDirection JXMenu::GetPopupArrowDirection ( ) const
inline

◆ GetPopupArrowPosition()

JXMenu::ArrowPosition JXMenu::GetPopupArrowPosition ( ) const
inline

Control the position and direction of the arrow when the menu is not in a menu bar.

◆ GetSubmenu()

bool JXMenu::GetSubmenu ( const JIndex  index,
const JXMenu **  menu 
) const

◆ GetTitleImage()

bool JXMenu::GetTitleImage ( const JXImage **  image) const
inline

◆ GetTitlePadding()

const JPoint & JXMenu::GetTitlePadding ( ) const
inline

◆ GetTitleText() [1/2]

const JString & JXMenu::GetTitleText ( ) const
inline

◆ GetTitleText() [2/2]

bool JXMenu::GetTitleText ( const JString **  text) const
inline

◆ GetTopLevelMenu()

JXMenu * JXMenu::GetTopLevelMenu ( ) const

Return the top level menu in our tree.

◆ GetUpdateAction()

JXMenu::UpdateAction JXMenu::GetUpdateAction ( ) const
inline

◆ HandleMouseDown()

void JXMenu::HandleMouseDown ( const JPoint pt,
const JXMouseButton  button,
const JSize  clickCount,
const JXButtonStates buttonStates,
const JXKeyModifiers modifiers 
)
overrideprotectedvirtual

Reimplemented from JXContainer.

◆ HandleShortcut()

void JXMenu::HandleShortcut ( const int  key,
const JXKeyModifiers modifiers 
)
overridevirtual

All shortcuts open the menu.

Reimplemented from JXWidget.

◆ IncludeInFTC()

bool JXMenu::IncludeInFTC ( ) const
overrideprotectedvirtual

Return false to be ignored.

Reimplemented from JXContainer.

◆ IsChecked()

bool JXMenu::IsChecked ( const JIndex  index) const

◆ IsEmpty()

bool JXMenu::IsEmpty ( ) const

◆ IsEnabled()

bool JXMenu::IsEnabled ( const JIndex  index) const

◆ IsHiddenPopupMenu()

bool JXMenu::IsHiddenPopupMenu ( ) const
inline

You must explicitly tell us if the menu is an invisible popup menu, because invisible menus are normally disabled.

◆ IsMenu()

bool JXMenu::IsMenu ( ) const
overridevirtual

Reimplemented from JXContainer.

◆ IsOpen()

bool JXMenu::IsOpen ( ) const
inline

◆ IsPopupChoice()

bool JXMenu::IsPopupChoice ( ) const
inline

◆ ItemIDToIndex()

bool JXMenu::ItemIDToIndex ( const JString targetID,
JIndex index 
) const

◆ PopUp()

bool JXMenu::PopUp ( JXContainer mouseOwner,
const JPoint pt,
const JXButtonStates buttonStates,
const JXKeyModifiers modifiers 
)

Call this to make the menu pop open at the specified point inside mouseOwner. This must only be called from mouseOwner's HandleMouseDown() or HandleMouseDrag(). If this function is successful, you will already have received HandleMouseUp() by the time it returns. It will return true so you know that it succeeded and that you should return immediately.

pt must be in the bounds coordinates of mouseOwner. In addition, the menu must not be visible, because this would confuse the user. We also require that the menu is not in a menu bar and is not a sub-menu.

Try to avoid using this feature since it will usually not be obvious to the user that a menu can be popped up at all.

◆ PrepareToOpenMenu()

bool JXMenu::PrepareToOpenMenu ( const bool  shortcut)
protected

Returns false if the menu is completely disabled.

◆ Receive()

void JXMenu::Receive ( JBroadcaster sender,
const Message message 
)
overrideprotectedvirtual

Process the given message from the given sender. This function is not pure virtual because not all classes will want to implement it.

Reimplemented from JBroadcaster.

Reimplemented in JXStringCompletionMenu, JXStyleMenu, and JXWDMenu.

◆ RemoveAllItems()

void JXMenu::RemoveAllItems ( )

◆ RemoveItem()

void JXMenu::RemoveItem ( const JIndex  index)

◆ RemoveSubmenu()

bool JXMenu::RemoveSubmenu ( const JIndex  index,
JXMenu **  theMenu 
)

Returns true if there was a submenu at the given index. The caller now owns the menu and is responsible for deleting it.

◆ Resume()

void JXMenu::Resume ( )
overridevirtual

We have to process resume because if a window is created while the application is suspended, the menu will initially be disabled.

Reimplemented from JXContainer.

◆ SetBaseItemData()

void JXMenu::SetBaseItemData ( JXMenuData baseItemData)
protected

This must be called in the derived class constructor after the derived class of JXMenuData has been created.

◆ SetDisplayStyle()

void JXMenu::SetDisplayStyle ( const Style  style)
inlinestatic

◆ SetItemEnabled()

void JXMenu::SetItemEnabled ( const JIndex  index,
const bool  enabled 
)

◆ SetItemID()

void JXMenu::SetItemID ( const JIndex  index,
const JString id 
)

◆ SetItemShortcuts()

void JXMenu::SetItemShortcuts ( const JIndex  index,
const JString shortcuts 
)

◆ SetPopupArrowDirection()

void JXMenu::SetPopupArrowDirection ( const ArrowDirection  direction)
inline

◆ SetPopupArrowPosition()

void JXMenu::SetPopupArrowPosition ( const ArrowPosition  position)
inline

◆ SetPopupChoice()

void JXMenu::SetPopupChoice ( const JIndex  index)
inline

◆ SetShortcuts()

void JXMenu::SetShortcuts ( const JString list)

◆ SetTitle()

void JXMenu::SetTitle ( const JString title,
JXImage image,
const bool  menuOwnsImage 
)

If title includes "%h", everything following this is passed to SetShortcuts().

It is generally a bad idea to use both text and an image in the title of a menu in a menu bar, because it will look like two separate menus. Having both text and an image is most appropriate for popup menus elsewhere in a window.

◆ SetTitleFont()

void JXMenu::SetTitleFont ( const JFont font)

◆ SetTitleFontName()

void JXMenu::SetTitleFontName ( const JString fontName)

◆ SetTitleFontSize()

void JXMenu::SetTitleFontSize ( const JSize  size)

◆ SetTitleFontStyle()

void JXMenu::SetTitleFontStyle ( const JFontStyle style)

◆ SetTitleImage()

void JXMenu::SetTitleImage ( JXImage image,
const bool  menuOwnsImage 
)

◆ SetTitlePadding()

void JXMenu::SetTitlePadding ( const JPoint p)
inline

◆ SetTitleText()

void JXMenu::SetTitleText ( const JString title)

Convenience functions.

◆ SetToHiddenPopupMenu()

void JXMenu::SetToHiddenPopupMenu ( const bool  isHiddenPopup = true)
inline

◆ SetToPopupChoice()

void JXMenu::SetToPopupChoice ( const bool  isPopup,
const JIndex  initialChoice 
)
virtual

◆ SetUpdateAction()

void JXMenu::SetUpdateAction ( const UpdateAction  action)
inline

◆ Suspend()

void JXMenu::Suspend ( )
overridevirtual

We do not support suspending submenus. If we suspend a submenu, it deactivates the menu, so Resume() will still think the menu is not active.

Reimplemented from JXContainer.

Friends And Related Symbol Documentation

◆ JXMenuBar

friend class JXMenuBar
friend

◆ JXMenuData

friend class JXMenuData
friend

◆ JXMenuManager

friend class JXMenuManager
friend

◆ JXMenuTable

friend class JXMenuTable
friend

◆ JXToolBar

friend class JXToolBar
friend

Member Data Documentation

◆ kItemSelected

const JUtf8Byte * JXMenu::kItemSelected = "ItemSelected::JXMenu"
static

◆ kNeedsUpdate

const JUtf8Byte * JXMenu::kNeedsUpdate = "NeedsUpdate::JXMenu"
static

The documentation for this class was generated from the following files: