Safe Haskell | None |
---|
- type GUI m = [Window m]
- newtype Window m = Window {
- unWindow :: Tree (WindowInfo m)
- data WindowInfo m = WindowInfo {
- _windowTitle :: Text
- _windowDim :: (Int, Int)
- _menu :: [Component m]
- _popupLayer :: [Component m]
- _contentPane :: Component m
- _capture :: Nullipotent m Image
- _escape :: Sealed m
- _enter :: Sealed m
- _close :: Sealed m
- _toFront :: Sealed m
- class Windowed w => WindowLike w where
- wInfo :: w m -> WindowInfo m
- title :: (Monad m, Monad n) => w m -> n Text
- hasTitle :: MonadPlus n => (Text -> Bool) -> w m -> n (w m)
- popupLayer :: Monad m => Glance m l (w m) (Component m)
- logcapture :: Monad m => Pianola m LogEntry (w m) ()
- contentPane :: Monad m => Glance m l (w m) (ComponentW m)
- toFront :: Monad m => Glance m l (w m) (Sealed m)
- escape :: Monad m => Glance m l (w m) (Sealed m)
- enter :: Monad m => Glance m l (w m) (Sealed m)
- close :: Monad m => Glance m l (w m) (Sealed m)
- class Windowed w where
- newtype ComponentW m = ComponentW {
- unComponentW :: EnvT (Window m) Tree (ComponentInfo m)
- newtype Component m = Component {
- unComponent :: Tree (ComponentInfo m)
- data ComponentInfo m = ComponentInfo {}
- data ComponentType m
- class ComponentLike c where
- cInfo :: c m -> ComponentInfo m
- cType :: c m -> ComponentType m
- text :: MonadPlus n => c m -> n Text
- hasText :: MonadPlus n => (Text -> Bool) -> c m -> n (c m)
- tooltip :: MonadPlus n => c m -> n Text
- hasToolTip :: MonadPlus n => (Text -> Bool) -> c m -> n (c m)
- hasName :: MonadPlus n => (Text -> Bool) -> c m -> n (c m)
- toggle :: MonadPlus n => Bool -> c m -> n (Sealed m)
- click :: Monad n => c m -> n (Sealed m)
- doubleClick :: Monad n => c m -> n (Sealed m)
- rightClick :: Monad n => c m -> n (Sealed m)
- clickButton :: MonadPlus n => c m -> n (Sealed m)
- clickCombo :: MonadPlus n => c m -> n (Sealed m)
- listCellByText :: MonadPlus n => (Text -> Bool) -> c m -> n (Cell m)
- tableCellByText :: MonadPlus n => Int -> (Text -> Bool) -> c m -> n (Cell m, [Cell m])
- treeCellByText :: MonadPlus n => Int -> (Text -> Bool) -> c m -> n (Tree (Cell m))
- tab :: MonadPlus n => c m -> n (Tab m)
- setText :: MonadPlus n => Text -> c m -> n (Sealed m)
- data Cell m = Cell {
- _renderer :: Component m
- _clickCell :: Sealed m
- _doubleClickCell :: Sealed m
- _rightClickCell :: Sealed m
- _expand :: Maybe (Bool -> Sealed m)
- data Tab m = Tab {
- _tabText :: Text
- _tabToolTip :: Maybe Text
- _isTabSelected :: Bool
- _selectTab :: Sealed m
- mainWindow :: Glance m l (GUI m) (Window m)
- childWindow :: Glance m l (Window m) (Window m)
- windowTitled :: (Text -> Bool) -> Glance m l (GUI m) (Window m)
- clickButtonByText :: (Monad m, ComponentLike c, Treeish (c m)) => (Text -> Bool) -> Glance m l (c m) (Sealed m)
- clickButtonByToolTip :: (Monad m, ComponentLike c, Treeish (c m)) => (Text -> Bool) -> Glance m l (c m) (Sealed m)
- rightClickByText :: (Monad m, ComponentLike c, Treeish (c m)) => (Text -> Bool) -> Glance m l (c m) (Sealed m)
- popupItem :: Monad m => Glance m l (Window m) (Component m)
- selectInMenuBar :: Monad m => [Text -> Bool] -> Pianola m l (Window m) ()
- toggleInMenuBar :: Monad m => Bool -> [Text -> Bool] -> Pianola m l (Window m) ()
- selectInComboBox :: (Monad m, ComponentLike c, Windowed c) => (Text -> Bool) -> Pianola m l (c m) ()
- selectTabByText :: (Monad m, ComponentLike c) => (Text -> Bool) -> Glance m l (c m) (Sealed m)
- selectTabByToolTip :: (Monad m, ComponentLike c) => (Text -> Bool) -> Glance m l (c m) (Sealed m)
- expand :: Monad m => Bool -> Glance m l (Tree (Cell m)) (Sealed m)
- labeledBy :: (Monad m, ComponentLike c, Treeish (c m)) => (Text -> Bool) -> Glance m l (c m) (c m)
Documentation
A client-side representation of the state of a remote Swing GUI. Interaction with the GUI is through actions in the monad m.
Window | |
|
data WindowInfo m Source
WindowInfo | |
|
class Windowed w => WindowLike w whereSource
Typeclass which provides convenience functions to supplement the bare fields of a WindowInfo
record.
wInfo :: w m -> WindowInfo mSource
title :: (Monad m, Monad n) => w m -> n TextSource
hasTitle :: MonadPlus n => (Text -> Bool) -> w m -> n (w m)Source
If the window has a title that satisfies the predicate, returns the
window, otherwise mzero
.
popupLayer :: Monad m => Glance m l (w m) (Component m)Source
Convenience function to access the components in the popup layer. Most
of the time, clients should use popupItem
instead of this function.
logcapture :: Monad m => Pianola m LogEntry (w m) ()Source
Convenience function to log an screenshot of a window.
contentPane :: Monad m => Glance m l (w m) (ComponentW m)Source
Convenience function which returns the content pane component augmented with a reference to the containing window.
toFront :: Monad m => Glance m l (w m) (Sealed m)Source
Brings the window to the front of the screen.
escape :: Monad m => Glance m l (w m) (Sealed m)Source
Sends an escape keypress to the window.
enter :: Monad m => Glance m l (w m) (Sealed m)Source
Sends an enter keypress to the window.
Typeclass instantiated by windows and components aware of belonging to a window.
newtype ComponentW m Source
A component which carries a reference to the window to which it belongs.
See Windowed
.
ComponentW | |
|
Component | |
|
data ComponentInfo m Source
ComponentInfo | |
|
data ComponentType m Source
Represents data specific to each subclass of Swing components.
Panel | |
Toggleable Bool (Bool -> Sealed m) | A check box, either in a window or in a popup menu. The bool value is the current selection state. |
Button (Sealed m) | A button with its selection action. Menu items in popup menus are also treated as buttons. |
TextField (Maybe (Text -> Sealed m)) |
|
Label | |
ComboBox (Maybe (Component m)) (Sealed m) | A combo box which may already have a selection, and which offers a click
action which shows the drop-down list. See |
List [Cell m] | See |
Table [[Cell m]] | Tables are represented as lists of columns. See |
Treegui (Forest (Cell m)) | A list of trees of |
PopupMenu | In Swing, popup menus reside in the popup layer of a window or, if the
popup extends beyond the window, in the contents pane of a child window
created to hold the popup. See |
TabbedPane [Tab m] | See |
Other Text | The text value holds the name of the class. |
class ComponentLike c whereSource
Typeclass which provides convenience functions to supplement the bare fields of a ComponentInfo
record.
cInfo :: c m -> ComponentInfo mSource
cType :: c m -> ComponentType mSource
text :: MonadPlus n => c m -> n TextSource
Returns the component's textual content or mzero
if it doesn't have
any.
hasText :: MonadPlus n => (Text -> Bool) -> c m -> n (c m)Source
If the component has some kind of textual content and the text
satisfies the predicate, returns the component, otherwise mzero
.
tooltip :: MonadPlus n => c m -> n TextSource
Returns the component's tooltip or mzero
if it doesn't have any.
hasToolTip :: MonadPlus n => (Text -> Bool) -> c m -> n (c m)Source
If the component has a tooltip and the tooltip satisfies the
predicate, returns the component, otherwise mzero
.
hasName :: MonadPlus n => (Text -> Bool) -> c m -> n (c m)Source
If the component has a name and the name satisfies the predicate,
returns the component, otherwise mzero
.
toggle :: MonadPlus n => Bool -> c m -> n (Sealed m)Source
Toggles the component to the desired state if the component is
toggleable, mzero
otherwise.
click :: Monad n => c m -> n (Sealed m)Source
Returns the click action of a component.
doubleClick :: Monad n => c m -> n (Sealed m)Source
rightClick :: Monad n => c m -> n (Sealed m)Source
clickButton :: MonadPlus n => c m -> n (Sealed m)Source
If the component is a button returns its click action, otherwise
mzero
.
clickCombo :: MonadPlus n => c m -> n (Sealed m)Source
If the component is a combo box returns its click action, otherwise
mzero
.
listCellByText :: MonadPlus n => (Text -> Bool) -> c m -> n (Cell m)Source
If the component is a list and has a cell whose renderer's text
satisfies the predicate, returns the cell, otherwise mzero
.
tableCellByText :: MonadPlus n => Int -> (Text -> Bool) -> c m -> n (Cell m, [Cell m])Source
If the component is a table and has a cell at the specified column
whose renderer's text satisfies the predicate, returns a pair of the
cell and the row to which it belongs, otherwise mzero
.
treeCellByText :: MonadPlus n => Int -> (Text -> Bool) -> c m -> n (Tree (Cell m))Source
If the component is a tree and has a cell at the specified depth
(starting at 0 for the root) whose renderer's text satisfies the
predicate, returns the subtree which has the cell as a root, otherwise
mzero
.
tab :: MonadPlus n => c m -> n (Tab m)Source
Returns the tabs of a component if the component is a tabbed pane,
mzero
otherwise.
setText :: MonadPlus n => Text -> c m -> n (Sealed m)Source
If the component is a text field and is editable, set the text of the
text field. Otherwise mzero
.
Complex gui components like lists, tables and trees are represented as list of cells, list of lists (list of columns) of cells, and trees of cells, respectively.
Bear in mind that in Swing the renderer sub-components of a complex component do not count as children of the component. However, editor components do count as children of the component.
A common case is to double click on a table cell to activate the cell's editor, and then having to look for that editor among the descendants of the table.
Cell | |
|
Tab | |
|
mainWindow :: Glance m l (GUI m) (Window m)Source
Returns the main window of the application. Only works properly when there is only one top-level window.
childWindow :: Glance m l (Window m) (Window m)Source
Returns the children of a window.
windowTitled :: (Text -> Bool) -> Glance m l (GUI m) (Window m)Source
Returns all visible windows whose title satisfies the predicate.
clickButtonByText :: (Monad m, ComponentLike c, Treeish (c m)) => (Text -> Bool) -> Glance m l (c m) (Sealed m)Source
If the component or *any of its descendants* is a button whose text
satisfies the predicate, returns the click action. Otherwise mzero
.
clickButtonByToolTip :: (Monad m, ComponentLike c, Treeish (c m)) => (Text -> Bool) -> Glance m l (c m) (Sealed m)Source
Similar to clickButtonByText
.
rightClickByText :: (Monad m, ComponentLike c, Treeish (c m)) => (Text -> Bool) -> Glance m l (c m) (Sealed m)Source
Similar to clickButtonByText
.
popupItem :: Monad m => Glance m l (Window m) (Component m)Source
Returns all the visible popup items belonging to a window (that is, not only the popup components themselves, but all their clickable children). Clients should use this function instead of trying to access the popup layer directly.
selectInMenuBar :: Monad m => [Text -> Bool] -> Pianola m l (Window m) ()Source
Performs a sequence of selections in a window menu, based to the text of the options. Pass it something like
map (==) ["menuitem1","menuitem2',...]
To match the exact names of the options.
toggleInMenuBar :: Monad m => Bool -> [Text -> Bool] -> Pianola m l (Window m) ()Source
Like selectInMenuBar
, but for when the last item is a toggleable
component. The boolean paramenter is the desired selection state.
selectInComboBox :: (Monad m, ComponentLike c, Windowed c) => (Text -> Bool) -> Pianola m l (c m) ()Source
If the component is a combo box, clicks on it and selects an option by its text. Otherwise fails.
selectTabByText :: (Monad m, ComponentLike c) => (Text -> Bool) -> Glance m l (c m) (Sealed m)Source
If the component is a tabbed pane returns the select action of a tab whose
text matches the predicate. Returns mzero
if the component is not a tabbed
pane.
selectTabByToolTip :: (Monad m, ComponentLike c) => (Text -> Bool) -> Glance m l (c m) (Sealed m)Source
Similar to selecTabByText
.
expand :: Monad m => Bool -> Glance m l (Tree (Cell m)) (Sealed m)Source
Returns the expand/collapse action of the root node of a tree of cells, depending on a boolean parameter. Useful with gui trees.
labeledBy :: (Monad m, ComponentLike c, Treeish (c m)) => (Text -> Bool) -> Glance m l (c m) (c m)Source
Takes a component, searches its descendants to find a label whose text matches the predicate, finds the component to which the label applies, and returns it.
Useful for targeting text fields in form-like dialogs.