JX Application Framework
|
#include <JXContainer.h>
Public Member Functions | |
~JXContainer () override | |
bool | IsAncestor (JXContainer *obj) const |
virtual void | Show () |
virtual void | Hide () |
virtual void | Refresh () const =0 |
virtual void | Redraw () const =0 |
bool | IsVisible () const |
void | SetVisible (const bool vis) |
bool | WouldBeVisible () const |
virtual void | Activate () |
virtual void | Deactivate () |
bool | IsActive () const |
void | SetActive (const bool active) |
bool | WouldBeActive () const |
virtual void | Suspend () |
virtual void | Resume () |
bool | IsSuspended () const |
bool | IsDNDSource () const |
bool | IsDNDTarget () const |
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 |
virtual void | Place (const JCoordinate enclX, const JCoordinate enclY)=0 |
virtual void | Move (const JCoordinate dx, const JCoordinate dy)=0 |
virtual void | SetSize (const JCoordinate w, const JCoordinate h)=0 |
virtual void | AdjustSize (const JCoordinate dw, const JCoordinate dh)=0 |
JRect | GetBounds () const |
virtual JRect | GetBoundsGlobal () const =0 |
JCoordinate | GetBoundsWidth () const |
JCoordinate | GetBoundsHeight () const |
JRect | GetFrame () const |
JRect | GetFrameLocal () const |
virtual JRect | GetFrameGlobal () const =0 |
JCoordinate | GetFrameWidth () const |
JCoordinate | GetFrameHeight () const |
JRect | GetAperture () const |
virtual JRect | GetApertureGlobal () const =0 |
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) |
virtual void | FTCAdjustSize (const JCoordinate dw, const JCoordinate dh) |
JRect | ComputePaddingForInternalFTC () const |
bool | FindContainer (const JPoint &ptG, JXContainer **container) const |
virtual bool | IsMenu () 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 |
virtual JString | ToString () const |
template<class T > | |
void | ListenTo (const JBroadcaster *sender, const std::function< void(const T &)> &f) |
Static Public Member Functions | |
static void | DebugExpandToFitContent (const bool horiz) |
static void | DebugExpandToFitContentExtras (const bool noop, const bool overlap) |
Protected Member Functions | |
JXContainer (JXWindow *window, JXContainer *enclosure) | |
JXContainer (JXDisplay *display, JXWindow *window, JXContainer *enclosure) | |
void | TurnOnBufferedDrawing () |
void | DrawAll (JXWindowPainter &p, const JRect &frameG) |
virtual void | Draw (JXWindowPainter &p, const JRect &rect)=0 |
virtual void | DrawBorder (JXWindowPainter &p, const JRect &frame)=0 |
virtual void | DrawBackground (JXWindowPainter &p, const JRect &frame)=0 |
virtual void | HandleMouseEnter () |
virtual void | HandleMouseHere (const JPoint &pt, const JXKeyModifiers &modifiers) |
virtual void | HandleMouseLeave () |
virtual bool | AcceptDrag (const JPoint &pt, const JXMouseButton button, const JXKeyModifiers &modifiers) |
virtual void | HandleMouseDown (const JPoint &pt, const JXMouseButton button, const JSize clickCount, const JXButtonStates &buttonStates, const JXKeyModifiers &modifiers) |
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) |
virtual void | BoundsMoved (const JCoordinate dx, const JCoordinate dy)=0 |
virtual void | EnclosingBoundsMoved (const JCoordinate dx, const JCoordinate dy)=0 |
void | NotifyBoundsResized (const JCoordinate dw, const JCoordinate dh) |
virtual void | BoundsResized (const JCoordinate dw, const JCoordinate dh)=0 |
virtual void | EnclosingBoundsResized (const JCoordinate dw, const JCoordinate dh)=0 |
virtual bool | IncludeInFTC () const |
virtual bool | NeedsInternalFTC () const |
virtual JCoordinate | GetFTCMinContentSize (const bool horizontal) 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) |
virtual void | Receive (JBroadcaster *sender, const Message &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 | JXWindow |
class | JXDNDManager |
class | JXFTCCell |
Abstract base class to provide concept of enclosure. All JXContainers must be allocated on the heap. This class also implements the event dispatcher and default event handling (do nothing) so derived classes only have to implement handlers for the events that they support. Draw, DrawBorder, and DrawBackground are special cases. They are pure virtual because they always have to be provided. The default handling of multiple clicks is to always handle them. Often, however, only clicks that are "close" should be treated as multiples. To define "close," override HitSamePart. Drag-And-Drop (DND) can be supported by overriding the four HandleDND*() functions. They operate just like the corresponding HandleMouse*() functions. HandleDNDLeave() is called if the mouse leaves. HandleDNDDrop() is called if the mouse is released. The data that was dropped is accessed via the selection manager. (Get the name of the selection from JXDNDManager::GetDNDSelectionName().) Since each class will only accept certain data types, each derived class should override WillAcceptDrop() and return true if they will accept at least one of the given data types. If the function returns false, the object will not receive any DND messages. Since Widgets are the ones that actually own data, only Widgets can initiate DND (via BeginDND()). Containers can accept drops, however. This is why all the DND functions other than BeginDND() are defined by JXContainer.
|
override |
|
protected |
If enclosure is nullptr, we are a window.
|
protected |
|
protectedvirtual |
Reimplemented in JXWidget.
|
virtual |
Reimplemented in JXMenu, JXTabGroup, JXTEBase, and JXWindow.
|
protected |
|
protectedvirtual |
Derived classes can override to adjust the cursor as appropriate.
Should not be called if cursor animator is active.
Reimplemented in JXColHeaderWidget, JXHorizPartition, JXLinkText, JXRowHeaderWidget, JXScrollbar, JXTEBase, and JXVertPartition.
|
pure virtual |
|
protected |
|
protectedpure virtual |
Implemented in JXDockWidget, JXFileNameDisplay, JXFSInputBase, JXFTCCell, JXMenuTable, JXScrollableWidget, JXStaticText, JXTEBase, JXWidget, and JXWindow.
|
protectedpure virtual |
Implemented in JXDockWidget, JXFTCCell, JXMenuTable, JXScrollableWidget, JXStaticText, JXTabGroup, JXWidget, and JXWindow.
void JXContainer::ClearHint | ( | ) |
Remove the hint for this button.
JRect JXContainer::ComputePaddingForInternalFTC | ( | ) | const |
|
protected |
|
protected |
|
static |
|
protected |
|
protected |
We send the message to every object since we don't know anything about who wants. If somebody returns true, then it means that it was for them, so we stop passing it around.
|
protected |
|
protected |
Should only be called by DispatchCursor() and AdjustCursor().
|
protectedpure virtual |
Implemented in JXColorWheel, JXDecorRect, JXDocktab, JXDockWidget, JXFTCCell, JXHorizPartition, JXImageButton, JXImageCheckbox, JXImageRadioButton, JXImageWidget, JXLevelControl, JXMenu, JXMenuBar, JXMenuTable, JXNewDirButton, JXPasswordInput, JXProgressIndicator, JXRadioGroup, JXScrollbar, JXScrolltab, JXSearchTextButton, JXSlider, JXTabGroup, JXTable, JXTEBase, JXTextButton, JXTextCheckbox, JXTextMenuTable, JXTextRadioButton, JXToolBarButton, JXVertPartition, JXWidgetSet, JXWindow, and JXWindowIcon.
|
protected |
Returns false if we are a JXWindow or obj is in a different JXWindow.
Before we can implement this, we need to define pure virtual EnclosureChanged() so derived classes can update their state, e.g., JXRadioButton needs to know its JXRadioGroup. This may be very difficult if said state is application specific and can only be computed at a higher level, e.g., JXDirector or JXApplication.
|
protectedpure virtual |
Implemented in JXFTCCell, JXTextButton, JXWidget, and JXWindow.
|
protectedpure virtual |
Implemented in JXBorderRect, JXButton, JXColorWheel, JXDocktab, JXDownRect, JXEmbossedRect, JXEngravedRect, JXFlatRect, JXFTCCell, JXImageCheckbox, JXImageRadioButton, JXInputField, JXLevelControl, JXMenu, JXMenuBar, JXMenuTable, JXProgressIndicator, JXRadioGroup, JXScrollableWidget, JXScrollbar, JXScrolltab, JXSliderBase, JXTabGroup, JXTextCheckbox, JXTextRadioButton, JXToolBarButton, JXUpRect, JXWidgetSet, JXWindow, and JXWindowIcon.
|
protectedpure virtual |
|
protectedpure virtual |
void JXContainer::ExpandToFitContent | ( | ) |
Assumes that widgets are laid out in implicit, nested tables and do not overlap. Discovers and constructs these implicit tables and expands the cells and their contents so text is not cut off.
bool JXContainer::FindContainer | ( | const JPoint & | ptG, |
JXContainer ** | container | ||
) | const |
Returns the JXContainer that contains the given point.
void JXContainer::ForEach | ( | const std::function< void(const JXContainer *)> & | f, |
const bool | recurse | ||
) | const |
void JXContainer::ForEach | ( | const std::function< void(JXContainer *)> & | f, |
const bool | recurse | ||
) |
Calls the given function for each enclosed object. If recurse, also calls ForEach() on each enclosed object.
|
virtual |
Reimplemented in JXHorizPartition, JXVertPartition, JXWidget, and JXWindow.
|
inline |
Returns the aperture in local coordinates.
|
pure virtual |
|
inline |
|
inline |
|
inline |
Returns the bounds in local coordinates.
|
pure virtual |
|
inline |
|
inline |
|
inlineprotected |
|
inline |
JXDisplay * JXContainer::GetDisplay | ( | ) | const |
JXDNDManager * JXContainer::GetDNDManager | ( | ) | const |
|
protected |
Returns false if there are no enclosed objects.
Caller must jdelete the iterator.
|
inline |
JFontManager * JXContainer::GetFontManager | ( | ) | const |
|
inline |
|
protectedvirtual |
By default, returns the frame.
Reimplemented in JXButton.
|
pure virtual |
|
inline |
|
inline |
|
inline |
|
inlineprotected |
|
protectedvirtual |
Reimplemented in JXFileNameDisplay, JXInputField, JXMenu, JXMenuBar, JXStaticText, JXTextButton, JXTextCheckbox, and JXTextRadioButton.
JXMenuManager * JXContainer::GetMenuManager | ( | ) | const |
JXSelectionManager * JXContainer::GetSelectionManager | ( | ) | const |
Calculates the portion of the given rectangle that is actually visible, in global coords. Returns true if the visible rectangle is not empty.
|
inline |
JXFontManager * JXContainer::GetXFontManager | ( | ) | const |
|
pure virtual |
|
protectedvirtual |
Derived class should return true if message was only for it.
|
protectedvirtual |
This is called when the data is dropped. The data is accessed via the selection manager, just like Paste.
Reimplemented in JXDirTable, JXDockWidget, JXFileListTable, JXFSInputBase, JXInputField, JXTEBase, JXToolBarButton, and JXWindowIcon.
|
protectedvirtual |
This is called when the mouse enters the widget.
Reimplemented in JXFSInputBase, JXTEBase, and JXWindowIcon.
This is called while the mouse is inside the widget.
Reimplemented in JXFSInputBase, JXTabGroup, and JXTEBase.
|
protectedvirtual |
This is called when the mouse leaves the widget without dropping data.
Reimplemented in JXDockWidget, JXFSInputBase, JXTEBase, and JXWindowIcon.
|
protectedvirtual |
This is called while the mouse is inside the widget, even if the widget does not currently accept the drop, because it might accept it after it is scrolled.
Normally, this should only be implemented by JXScrollableWidget.
Reimplemented in JXScrollableWidget, and JXTabGroup.
|
protectedvirtual |
Reimplemented in JXButton, JXCheckbox, JXColHeaderWidget, JXColorWheel, JXDirectSaveSource, JXDirTable, JXDocktab, JXDockTabGroup, JXFileListTable, JXFSInputBase, JXHorizDockPartition, JXHorizPartition, JXInputField, JXLinkText, JXMenu, JXMenuTable, JXPasswordInput, JXRadioButton, JXRowHeaderWidget, JXScrollableWidget, JXScrollbar, JXScrolltab, JXSliderBase, JXSpellList, JXTabGroup, JXTEBase, JXToolBarEditWidget, JXTreeListWidget, JXVertDockPartition, and JXVertPartition.
|
protectedvirtual |
Reimplemented in JXButton, JXCheckbox, JXColHeaderWidget, JXColorWheel, JXDirTable, JXFileListTable, JXHorizPartition, JXMenuTable, JXPasswordInput, JXRadioButton, JXRowHeaderWidget, JXScrollbar, JXSliderBase, JXTabGroup, JXTEBase, JXTreeListWidget, and JXVertPartition.
|
protectedvirtual |
Reimplemented in JXScrolltab, JXTEBase, and JXWindowIcon.
|
protectedvirtual |
Reimplemented in JXTabGroup, and JXTEBase.
|
protectedvirtual |
Reimplemented in JXScrolltab, JXTabGroup, and JXTEBase.
|
protectedvirtual |
Reimplemented in JXButton, JXCharInput, JXCheckbox, JXColHeaderWidget, JXDirTable, JXFileListTable, JXHorizPartition, JXLinkText, JXMenuTable, JXPasswordInput, JXRadioButton, JXRowHeaderWidget, JXScrollbar, JXTabGroup, JXTEBase, JXTreeListWidget, and JXVertPartition.
|
virtual |
Reimplemented in JXWindow.
|
protected |
This default implementation always returns true.
Reimplemented in JXNamedTreeListWidget, JXTable, and JXTEBase.
|
protectedvirtual |
Return false to be ignored.
Reimplemented in JXMenu.
|
inline |
bool JXContainer::IsAncestor | ( | JXContainer * | obj | ) | const |
Returns true if we are an ancestor of the given object.
|
inline |
|
inline |
|
virtual |
Reimplemented in JXMenuTable.
|
inline |
|
inline |
|
pure virtual |
|
pure virtual |
|
protectedvirtual |
Return true if the contents are a set of widgets that need to expand.
Reimplemented in JXDecorRect, JXRadioGroup, JXTabGroup, and JXWidgetSet.
|
protected |
Tell all enclosed objects that our Bounds has moved.
|
protected |
Tell all enclosed objects that our Bounds has changed size.
|
pure virtual |
|
pure virtual |
|
pure virtual |
|
protected |
Removes the current cursor animator and sets the cursor back to normal.
|
virtual |
Expand and return new size.
Reimplemented in JXHorizPartition, and JXVertPartition.
|
inline |
|
protected |
void JXContainer::SetHint | ( | const JString & | text | ) |
Set the hint for this button.
|
pure virtual |
|
inline |
|
virtual |
Reimplemented in JXWindow.
|
protected |
|
protectedvirtual |
Derived classes can override to grab a mouse down, preventing enclosed objects from getting it.
|
protected |
|
protectedvirtual |
Derived classes that accept drops should override this function and return true if they will accept the current drop. If they return false, they will not receive any DND messages.
source is non-nullptr if the drag is between widgets in the same program. This provides a way for compound documents to identify drags between their various parts.
Reimplemented in JXCharInput, JXDirTable, JXDockWidget, JXFileListTable, JXFSInputBase, JXTabGroup, JXTEBase, JXToolBarButton, and JXWindowIcon.
bool JXContainer::WouldBeActive | ( | ) | const |
bool JXContainer::WouldBeVisible | ( | ) | const |
|
friend |
|
friend |
|
friend |