Copyright | (c) 2018 Francisco Vallarino |
---|---|
License | BSD-3-Clause (see the LICENSE file) |
Maintainer | fjvallarino@gmail.com |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Helper functions for Core types.
Synopsis
- pathFromKey :: WidgetEnv s e -> WidgetKey -> Maybe Path
- widgetIdFromKey :: WidgetEnv s e -> WidgetKey -> Maybe WidgetId
- findWidgetByPath :: WidgetEnv s e -> WidgetNode s e -> Path -> Maybe WidgetNodeInfo
- getLayoutDirection :: Bool -> LayoutDirection
- eventsFromReqs :: Seq (WidgetRequest s e) -> Seq e
- isIgnoreParentEvents :: WidgetRequest s e -> Bool
- isIgnoreChildrenEvents :: WidgetRequest s e -> Bool
- isResizeWidgets :: WidgetRequest s e -> Bool
- isResizeWidgetsImmediate :: WidgetRequest s e -> Bool
- isMoveFocus :: WidgetRequest s e -> Bool
- isSetFocus :: WidgetRequest s e -> Bool
- isGetClipboard :: WidgetRequest s e -> Bool
- isSetClipboard :: WidgetRequest s e -> Bool
- isStartTextInput :: WidgetRequest s e -> Bool
- isStopTextInput :: WidgetRequest s e -> Bool
- isSetOverlay :: WidgetRequest s e -> Bool
- isResetOverlay :: WidgetRequest s e -> Bool
- isSetCursorIcon :: WidgetRequest s e -> Bool
- isResetCursorIcon :: WidgetRequest s e -> Bool
- isStartDrag :: WidgetRequest s e -> Bool
- isStopDrag :: WidgetRequest s e -> Bool
- isRenderOnce :: WidgetRequest s e -> Bool
- isRenderEvery :: WidgetRequest s e -> Bool
- isRenderStop :: WidgetRequest s e -> Bool
- isRemoveRendererImage :: WidgetRequest s e -> Bool
- isExitApplication :: WidgetRequest s e -> Bool
- isUpdateWindow :: WidgetRequest s e -> Bool
- isUpdateModel :: WidgetRequest s e -> Bool
- isSetWidgetPath :: WidgetRequest s e -> Bool
- isResetWidgetPath :: WidgetRequest s e -> Bool
- isRaiseEvent :: WidgetRequest s e -> Bool
- isSendMessage :: WidgetRequest s e -> Bool
- isRunTask :: WidgetRequest s e -> Bool
- isRunProducer :: WidgetRequest s e -> Bool
- isFocusRequest :: WidgetRequest s e -> Bool
- isResizeResult :: Maybe (WidgetResult s e) -> Bool
- isResizeImmediateResult :: Maybe (WidgetResult s e) -> Bool
- isResizeAnyResult :: Maybe (WidgetResult s e) -> Bool
- isMacOS :: WidgetEnv s e -> Bool
- widgetTreeDesc :: Int -> WidgetNode s e -> String
- nodeDesc :: Int -> WidgetNode s e -> String
- widgetInstTreeDesc :: Int -> WidgetInstanceNode -> String
- nodeInstDesc :: Int -> WidgetInstanceNode -> String
- treeInstDescFromNode :: WidgetEnv s e -> Int -> WidgetNode s e -> String
Documentation
pathFromKey :: WidgetEnv s e -> WidgetKey -> Maybe Path Source #
Returns the path associated to a given key, if any.
widgetIdFromKey :: WidgetEnv s e -> WidgetKey -> Maybe WidgetId Source #
Returns the widgetId associated to a given key, if any.
findWidgetByPath :: WidgetEnv s e -> WidgetNode s e -> Path -> Maybe WidgetNodeInfo Source #
Returns the node info associated to a given path.
getLayoutDirection :: Bool -> LayoutDirection Source #
Helper functions that associates False to Vertical and True to Horizontal.
eventsFromReqs :: Seq (WidgetRequest s e) -> Seq e Source #
Filters user events from a list of WidgetRequests.
isIgnoreParentEvents :: WidgetRequest s e -> Bool Source #
Ignore events generated by the parent. Could be used to consume the tab key and avoid having the focus move to the next widget.
isIgnoreChildrenEvents :: WidgetRequest s e -> Bool Source #
Ignore children events. Scroll relies on this to handle click/wheel.
isResizeWidgets :: WidgetRequest s e -> Bool Source #
The widget content changed and requires a different size. Processed at the end of the cycle, since several widgets may request it.
isResizeWidgetsImmediate :: WidgetRequest s e -> Bool Source #
The widget content changed and requires a different size. Processed immediately. Avoid if possible, since it can affect performance.
isMoveFocus :: WidgetRequest s e -> Bool Source #
Moves the focus, optionally indicating a starting widgetId.
isSetFocus :: WidgetRequest s e -> Bool Source #
Sets the focus to the given widgetId.
isGetClipboard :: WidgetRequest s e -> Bool Source #
Requests the clipboard contents. It will be received as a SystemEvent.
isSetClipboard :: WidgetRequest s e -> Bool Source #
Sets the clipboard to the given ClipboardData.
isStartTextInput :: WidgetRequest s e -> Bool Source #
Sets the viewport which should be remain visible when an on-screen keyboard is displayed. Required for mobile.
isStopTextInput :: WidgetRequest s e -> Bool Source #
Resets the keyboard viewport,
isSetOverlay :: WidgetRequest s e -> Bool Source #
Sets a widget as the base target of future events. This is used by the dropdown component to handle list events (which is on top of everything).
isResetOverlay :: WidgetRequest s e -> Bool Source #
Removes the existing overlay.
isSetCursorIcon :: WidgetRequest s e -> Bool Source #
Sets the current active cursor icon. This acts as a stack, so removing means going back a step to the cursor set by a parent widget.
isResetCursorIcon :: WidgetRequest s e -> Bool Source #
Removes a cursor icon setting from the stack.
isStartDrag :: WidgetRequest s e -> Bool Source #
Sets the current item being dragged and the message it carries. This message is used by targets to check if they accept it or not.
isStopDrag :: WidgetRequest s e -> Bool Source #
Cancels the current dragging process.
isRenderOnce :: WidgetRequest s e -> Bool Source #
Requests rendering a single frame. Rendering is not done at a fixed rate, in order to reduce CPU usage. Widgets are responsible of requesting rendering at points of interest. Mouse and keyboard events automatically generate render requests, but the result of a WidgetTask does not.
isRenderEvery :: WidgetRequest s e -> Bool Source #
Useful if a widget requires periodic rendering. An optional maximum number of frames can be provided.
isRenderStop :: WidgetRequest s e -> Bool Source #
Stops a previous periodic rendering request.
isRemoveRendererImage :: WidgetRequest s e -> Bool Source #
Requests to have an image removed from the renderer.
isExitApplication :: WidgetRequest s e -> Bool Source #
Requests to exit the application. Can also be used to cancel a previous request (or a window close).
isUpdateWindow :: WidgetRequest s e -> Bool Source #
Performs a WindowRequest.
isUpdateModel :: WidgetRequest s e -> Bool Source #
Request a model update. This usually involves lenses and "widgetDataSet".
isSetWidgetPath :: WidgetRequest s e -> Bool Source #
Updates the path of a given widget. Both Monomer.Widgets.Single and Monomer.Widgets.Container handle this automatically.
isResetWidgetPath :: WidgetRequest s e -> Bool Source #
Clears an association between widgetId and path.
isRaiseEvent :: WidgetRequest s e -> Bool Source #
Raises a user event, which usually will be processed in handleEvent in a Monomer.Widgets.Composite instance.
isSendMessage :: WidgetRequest s e -> Bool Source #
Sends a message to the given widgetId. If the target does not expect the message's type, it will be ignored.
isRunTask :: WidgetRequest s e -> Bool Source #
Runs an asynchronous tasks. It is mandatory to return a message that will be sent to the task owner (this is the only way to feed data back).
isRunProducer :: WidgetRequest s e -> Bool Source #
Similar to RunTask, but can generate unlimited messages. This is useful for WebSockets and similar data sources. It receives a function that with which to send messagess to the producer owner.
isFocusRequest :: WidgetRequest s e -> Bool Source #
Checks if the request is either MoveFocus or SetFocus.
isResizeResult :: Maybe (WidgetResult s e) -> Bool Source #
Checks if the result contains a Resize request.
isResizeImmediateResult :: Maybe (WidgetResult s e) -> Bool Source #
Checks if the result contains a ResizeImmediate request.
isResizeAnyResult :: Maybe (WidgetResult s e) -> Bool Source #
Checks if the result contains any kind of resize request.
widgetTreeDesc :: Int -> WidgetNode s e -> String Source #
Returns a string description of a node and its children.
widgetInstTreeDesc :: Int -> WidgetInstanceNode -> String Source #
Returns a string description of a node info and its children.
nodeInstDesc :: Int -> WidgetInstanceNode -> String Source #
Returns a string description of a node info.
treeInstDescFromNode :: WidgetEnv s e -> Int -> WidgetNode s e -> String Source #
Returns a string description of a node info and its children, from a node.