{-# OPTIONS_HADDOCK hide #-} module CanBeCasted ( CanBeCasted (glibCast) ) where import Graphics.UI.Gtk -- | 'CanBeCasted' class allows casting between some -- 'System.Glib.GObject.GObjectClass' instances. class (GObjectClass g) => CanBeCasted g where -- | 'glibCast' casts between types,if possible. glibCast :: (GObjectClass o) => o -> Maybe g glibCast a = if isA a t then Just (c a) else Nothing where { (t,c) = castData } -- | 'castData' provides data for casting,using @gtk2hs@ -- map of similar @gtk+@ data. This is the only class -- member that instances shall redefine. castData :: (GObjectClass g1) => (GType,g1 -> g) instance CanBeCasted Adjustment where castData = (gTypeAdjustment,castToAdjustment) instance CanBeCasted Alignment where castData = (gTypeAlignment,castToAlignment) instance CanBeCasted Arrow where castData = (gTypeArrow,castToArrow) instance CanBeCasted AspectFrame where castData = (gTypeAspectFrame,castToAspectFrame) instance CanBeCasted Bin where castData = (gTypeBin,castToBin) instance CanBeCasted Box where castData = (gTypeBox,castToBox) instance CanBeCasted Button where castData = (gTypeButton,castToButton) instance CanBeCasted ButtonBox where castData = (gTypeButtonBox,castToButtonBox) instance CanBeCasted Calendar where castData = (gTypeCalendar,castToCalendar) instance CanBeCasted CheckButton where castData = (gTypeCheckButton,castToCheckButton) instance CanBeCasted CheckMenuItem where castData = (gTypeCheckMenuItem,castToCheckMenuItem) instance CanBeCasted Clipboard where castData = (gTypeClipboard,castToClipboard) instance CanBeCasted ColorButton where castData = (gTypeColorButton,castToColorButton) instance CanBeCasted ColorSelection where castData = (gTypeColorSelection,castToColorSelection) instance CanBeCasted ColorSelectionDialog where castData = (gTypeColorSelectionDialog,castToColorSelectionDialog) instance CanBeCasted Container where castData = (gTypeContainer,castToContainer) instance CanBeCasted Dialog where castData = (gTypeDialog,castToDialog) instance CanBeCasted DragContext where castData = (gTypeDragContext,castToDragContext) instance CanBeCasted DrawWindow where castData = (gTypeDrawWindow,castToDrawWindow) instance CanBeCasted Drawable where castData = (gTypeDrawable,castToDrawable) instance CanBeCasted DrawingArea where castData = (gTypeDrawingArea,castToDrawingArea) instance CanBeCasted Editable where castData = (gTypeEditable,castToEditable) instance CanBeCasted Entry where castData = (gTypeEntry,castToEntry) instance CanBeCasted EntryCompletion where castData = (gTypeEntryCompletion,castToEntryCompletion) instance CanBeCasted EventBox where castData = (gTypeEventBox,castToEventBox) instance CanBeCasted Expander where castData = (gTypeExpander,castToExpander) instance CanBeCasted FileChooser where castData = (gTypeFileChooser,castToFileChooser) instance CanBeCasted FileChooserButton where castData = (gTypeFileChooserButton,castToFileChooserButton) instance CanBeCasted FileChooserDialog where castData = (gTypeFileChooserDialog,castToFileChooserDialog) instance CanBeCasted FileChooserWidget where castData = (gTypeFileChooserWidget,castToFileChooserWidget) instance CanBeCasted FileFilter where castData = (gTypeFileFilter,castToFileFilter) instance CanBeCasted FileSelection where castData = (gTypeFileSelection,castToFileSelection) instance CanBeCasted Fixed where castData = (gTypeFixed,castToFixed) instance CanBeCasted FontButton where castData = (gTypeFontButton,castToFontButton) instance CanBeCasted FontSelection where castData = (gTypeFontSelection,castToFontSelection) instance CanBeCasted FontSelectionDialog where castData = (gTypeFontSelectionDialog,castToFontSelectionDialog) instance CanBeCasted Frame where castData = (gTypeFrame,castToFrame) instance CanBeCasted HBox where castData = (gTypeHBox,castToHBox) instance CanBeCasted HButtonBox where castData = (gTypeHButtonBox,castToHButtonBox) instance CanBeCasted HPaned where castData = (gTypeHPaned,castToHPaned) instance CanBeCasted HScale where castData = (gTypeHScale,castToHScale) instance CanBeCasted HScrollbar where castData = (gTypeHScrollbar,castToHScrollbar) instance CanBeCasted HSeparator where castData = (gTypeHSeparator,castToHSeparator) instance CanBeCasted HandleBox where castData = (gTypeHandleBox,castToHandleBox) instance CanBeCasted IconView where castData = (gTypeIconView,castToIconView) instance CanBeCasted Image where castData = (gTypeImage,castToImage) instance CanBeCasted ImageMenuItem where castData = (gTypeImageMenuItem,castToImageMenuItem) instance CanBeCasted Label where castData = (gTypeLabel,castToLabel) instance CanBeCasted Layout where castData = (gTypeLayout,castToLayout) instance CanBeCasted Misc where castData = (gTypeMisc,castToMisc) instance CanBeCasted Notebook where castData = (gTypeNotebook,castToNotebook) instance CanBeCasted Object where castData = (gTypeObject,castToObject) instance CanBeCasted OptionMenu where castData = (gTypeOptionMenu,castToOptionMenu) instance CanBeCasted Paned where castData = (gTypePaned,castToPaned) instance CanBeCasted Pixbuf where castData = (gTypePixbuf,castToPixbuf) instance CanBeCasted Range where castData = (gTypeRange,castToRange) instance CanBeCasted Scale where castData = (gTypeScale,castToScale) instance CanBeCasted Screen where castData = (gTypeScreen,castToScreen) instance CanBeCasted Scrollbar where castData = (gTypeScrollbar,castToScrollbar) instance CanBeCasted ScrolledWindow where castData = (gTypeScrolledWindow,castToScrolledWindow) instance CanBeCasted Separator where castData = (gTypeSeparator,castToSeparator) instance CanBeCasted Socket where castData = (gTypeSocket,castToSocket) instance CanBeCasted SpinButton where castData = (gTypeSpinButton,castToSpinButton) instance CanBeCasted Table where castData = (gTypeTable,castToTable) instance CanBeCasted TearoffMenuItem where castData = (gTypeTearoffMenuItem,castToTearoffMenuItem) instance CanBeCasted TextBuffer where castData = (gTypeTextBuffer,castToTextBuffer) instance CanBeCasted TextMark where castData = (gTypeTextMark,castToTextMark) instance CanBeCasted TextTag where castData = (gTypeTextTag,castToTextTag) instance CanBeCasted TextTagTable where castData = (gTypeTextTagTable,castToTextTagTable) instance CanBeCasted TextView where castData = (gTypeTextView,castToTextView) instance CanBeCasted ToggleButton where castData = (gTypeToggleButton,castToToggleButton) instance CanBeCasted ToggleToolButton where castData = (gTypeToggleToolButton,castToToggleToolButton) instance CanBeCasted ToolButton where castData = (gTypeToolButton,castToToolButton) instance CanBeCasted ToolItem where castData = (gTypeToolItem,castToToolItem) instance CanBeCasted Toolbar where castData = (gTypeToolbar,castToToolbar) instance CanBeCasted Tooltips where castData = (gTypeTooltips,castToTooltips) instance CanBeCasted TreeModel where castData = (gTypeTreeModel,castToTreeModel) instance CanBeCasted TreeModelSort where castData = (gTypeTreeModelSort,castToTreeModelSort) instance CanBeCasted TreeSelection where castData = (gTypeTreeSelection,castToTreeSelection) instance CanBeCasted TreeSortable where castData = (gTypeTreeSortable,castToTreeSortable) instance CanBeCasted TreeView where castData = (gTypeTreeView,castToTreeView) instance CanBeCasted TreeViewColumn where castData = (gTypeTreeViewColumn,castToTreeViewColumn) instance CanBeCasted UIManager where castData = (gTypeUIManager,castToUIManager) instance CanBeCasted VBox where castData = (gTypeVBox,castToVBox) instance CanBeCasted VButtonBox where castData = (gTypeVButtonBox,castToVButtonBox) instance CanBeCasted VPaned where castData = (gTypeVPaned,castToVPaned) instance CanBeCasted VScale where castData = (gTypeVScale,castToVScale) instance CanBeCasted VScrollbar where castData = (gTypeVScrollbar,castToVScrollbar) instance CanBeCasted VSeparator where castData = (gTypeVSeparator,castToVSeparator) instance CanBeCasted Viewport where castData = (gTypeViewport,castToViewport) instance CanBeCasted Widget where castData = (gTypeWidget,castToWidget) instance CanBeCasted Window where castData = (gTypeWindow,castToWindow) instance CanBeCasted WindowGroup where castData = (gTypeWindowGroup,castToWindowGroup)