JX Application Framework
|
#include <JXHistoryMenuBase.h>
Public Types | |
enum | HistoryDirection { kNewestItemAtTop , kNewestItemAtBottom } |
![]() | |
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 } |
![]() | |
enum | HSizingOption { kFixedLeft , kFixedRight , kHElastic } |
enum | VSizingOption { kFixedTop , kFixedBottom , kVElastic } |
Public Member Functions | |
~JXHistoryMenuBase () override | |
JSize | GetHistoryLength () const |
void | SetHistoryLength (const JSize historyLength) |
void | ClearHistory () |
HistoryDirection | GetHistoryDirection () const |
void | SetHistoryDirection (const HistoryDirection direction) |
void | SetDefaultIcon (JXImage *icon, const bool menuOwnsIcon) |
JIndex | GetFirstIndex () const |
void | SetFirstIndex (const JIndex index) |
void | ReadSetup (std::istream &input) |
void | WriteSetup (std::ostream &output) const |
const JString & | GetItemText (const Message &message) const |
void | UpdateInputField (const Message &message, JXInputField *input) const |
const JString & | GetItemText (const JIndex index) const |
![]() | |
JXTextMenu (const JString &title, JXContainer *enclosure, const HSizingOption hSizing, const VSizingOption vSizing, const JCoordinate x, const JCoordinate y, const JCoordinate w, const JCoordinate h) | |
JXTextMenu (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) | |
JXTextMenu (JXMenu *owner, const JIndex itemIndex, JXContainer *enclosure) | |
~JXTextMenu () override | |
void | SetMenuItems (const JUtf8Byte *menuStr) |
void | InsertMenuItems (const JIndex index, const JUtf8Byte *menuStr) |
void | PrependMenuItems (const JUtf8Byte *menuStr) |
void | AppendMenuItems (const JUtf8Byte *menuStr) |
void | InsertItem (const JIndex index, const JString &str, const ItemType type=kPlainType, const JString &shortcuts=JString::empty, const JString &nmShortcut=JString::empty, const JString &id=JString::empty) |
void | PrependItem (const JString &str, const ItemType type=kPlainType, const JString &shortcuts=JString::empty, const JString &nmShortcut=JString::empty, const JString &id=JString::empty) |
void | AppendItem (const JString &str, const ItemType type=kPlainType, const JString &shortcuts=JString::empty, const JString &nmShortcut=JString::empty, const JString &id=JString::empty) |
const JString & | GetItemText (const JIndex index) const |
void | SetItemText (const JIndex index, const JString &str) |
JFont | GetItemFont (const JIndex index) const |
void | SetItemFontName (const JIndex index, const JString &name) |
void | SetItemFontSize (const JIndex index, const JSize size) |
void | SetItemFontStyle (const JIndex index, const JFontStyle &style) |
void | SetItemFont (const JIndex index, const JFont &font) |
const JFont & | GetDefaultFont () const |
void | SetDefaultFontName (const JString &name, const bool updateExisting) |
void | SetDefaultFontSize (const JSize size, const bool updateExisting) |
void | SetDefaultFontStyle (const JFontStyle &style, const bool updateExisting) |
void | SetDefaultFont (const JFont &font, const bool updateExisting) |
bool | GetItemImage (const JIndex index, const JXImage **image) const |
void | SetItemImage (const JIndex index, JXImage *image, const bool menuOwnsImage) |
void | SetItemImage (const JIndex index, const JXPM &data) |
void | ClearItemImage (const JIndex index) |
bool | GetItemNMShortcut (const JIndex index, JString *str) const |
void | SetItemNMShortcut (const JIndex index, const JString &str) |
bool | HasSeparatorAfter (const JIndex index) const |
void | ShowSeparatorAfter (const JIndex index, const bool show=true) |
bool | HeightCompressed () const |
void | CompressHeight (const bool compress=true) |
void | SetToPopupChoice (const bool isPopup, const JIndex initialChoice) override |
void | HandleNMShortcut (const JIndex index, const JXKeyModifiers &modifiers) |
![]() | |
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 JString & | GetTitleText () 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 JPoint & | GetTitlePadding () 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 |
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 |
JXMenu * | GetTopLevelMenu () 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 |
![]() | |
~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 |
![]() | |
~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 |
JXDisplay * | GetDisplay () const |
JXWindow * | GetWindow () const |
JXContainer * | GetEnclosure () const |
JFontManager * | GetFontManager () const |
JXFontManager * | GetXFontManager () const |
JXSelectionManager * | GetSelectionManager () const |
JXDNDManager * | GetDNDManager () const |
JXMenuManager * | GetMenuManager () 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 |
![]() | |
JBroadcaster () | |
virtual | ~JBroadcaster () |
JBroadcaster & | operator= (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 void | ReadSetup (std::istream &input, JPtrArray< JString > *itemList, JPtrArray< JString > *nmShortcutList) |
![]() | |
static Style | GetDisplayStyle () |
static void | SetDisplayStyle (const Style style) |
![]() | |
static void | DebugExpandToFitContent (const bool horiz) |
static void | DebugExpandToFitContentExtras (const bool noop, const bool overlap) |
Protected Member Functions | |
JXHistoryMenuBase (const JSize historyLength, const JString &title, JXContainer *enclosure, const HSizingOption hSizing, const VSizingOption vSizing, const JCoordinate x, const JCoordinate y, const JCoordinate w, const JCoordinate h) | |
JXHistoryMenuBase (const JSize historyLength, JXMenu *owner, const JIndex itemIndex, JXContainer *enclosure) | |
void | AddItem (const JString &text, const JString &nmShortcut) |
void | AdjustLength () |
virtual void | UpdateMenu () |
virtual void | UpdateItemImage (const JIndex index) |
void | Receive (JBroadcaster *sender, const Message &message) override |
![]() | |
JXMenuDirector * | CreateMenuWindow (JXWindowDirector *supervisor) override |
void | AdjustPopupChoiceTitle (const JIndex index) override |
JXTextMenuData * | GetTextMenuData () |
![]() | |
void | SetBaseItemData (JXMenuData *baseItemData) |
void | ClearBaseItemData () |
bool | PrepareToOpenMenu (const bool shortcut) |
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) |
![]() | |
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 |
JXDragPainter * | CreateDragInsidePainter () |
JXDragPainter * | CreateDragOutsidePainter () |
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) |
![]() | |
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) |
JXCursorAnimator * | CreateCursorAnimator () |
JXCursorAnimator * | GetCursorAnimator () 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) |
![]() | |
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) |
Additional Inherited Members | |
![]() | |
static const JUtf8Byte * | kNeedsUpdate = "NeedsUpdate::JXMenu" |
static const JUtf8Byte * | kItemSelected = "ItemSelected::JXMenu" |
![]() | |
static const JUtf8Byte * | kGotFocus = "GotFocus::JXWidget" |
static const JUtf8Byte * | kLostFocus = "LostFocus::JXWidget" |
Base class for menus that maintains a fixed-length history. New items should be prepended to the menu so the oldest ones automatically fall off the bottom (or visa versa, based on history direction). The default icon is empty. To change the icon for all items, call SetDefaultIcon(). Otherwise, you can create a derived class and override UpdateItemImage() to display different icons for different files. Since nothing on this menu is ever disabled, one only needs to listen for the ItemSelected message. We listen for NeedsUpdate and automatically call UpdateMenu(), so derived classes only need to override UpdateMenu(). If SetFirstIndex() is called, this shifts the operations down to start at the given item index. Items above this index will not be touched.
|
override |
|
protected |
|
protected |
Add the given item to the menu and remove outdated entries at the other end.
|
protected |
Remove extra items from the bottom (or top) of the menu.
|
inline |
|
inline |
|
inline |
|
inline |
Convenience function to process ItemSelected message and return item text.
void JXHistoryMenuBase::ReadSetup | ( | std::istream & | input | ) |
Reads the setup information into the menu.
We assert that the data is readable because there is no way to skip over it.
|
static |
Reads the setup information into a list.
We assert that the data is readable because there is no way to skip over it.
|
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.
|
inline |
|
inline |
void JXHistoryMenuBase::SetHistoryLength | ( | const JSize | historyLength | ) |
void JXHistoryMenuBase::UpdateInputField | ( | const Message & | message, |
JXInputField * | input | ||
) | const |
Convenience function to process ItemSelected message and place text in an input field.
We can't use JXTEBase* because of the egcs thunks bug. Why?? It isn't in a ctor!
|
protectedvirtual |
Derived classes can override this to display a different icon for each item.
|
protectedvirtual |
Reimplemented in JXFileHistoryMenu, and JXPathHistoryMenu.
void JXHistoryMenuBase::WriteSetup | ( | std::ostream & | output | ) | const |