Documentation ¶
Overview ¶
Package widget provides custom GTK+ widgets.
Index ¶
- func AppName() string
- func NewAboutDialog(windowRemover func(gtk.IWindow)) (*gtk.AboutDialog, error)
- func NewAppMenu() (*glib.MenuModel, error)
- func NewComicListScroller() (*gtk.ScrolledWindow, error)
- func NewShortcutsWindow(windowRemover func(gtk.IWindow)) (*gtk.ShortcutsWindow, error)
- type Application
- type ApplicationWindow
- func (win *ApplicationWindow) AddBookmark()
- func (win *ApplicationWindow) DarkModeChanged()
- func (win *ApplicationWindow) DisplayComic()
- func (win *ApplicationWindow) Dispose()
- func (win *ApplicationWindow) Explain()
- func (win *ApplicationWindow) FirstComic()
- func (win *ApplicationWindow) IsBookmarked() bool
- func (win *ApplicationWindow) IsVisible() bool
- func (win *ApplicationWindow) NewestComic()
- func (win *ApplicationWindow) NextComic()
- func (win *ApplicationWindow) OpenLink()
- func (win *ApplicationWindow) PreviousComic()
- func (win *ApplicationWindow) RandomComic()
- func (win *ApplicationWindow) RemoveBookmark()
- func (win *ApplicationWindow) SetBookmarked(bookmarked bool)
- func (win *ApplicationWindow) SetComic(n int)
- func (win *ApplicationWindow) ShowLoading()
- func (win *ApplicationWindow) ShowProperties()
- func (win *ApplicationWindow) StyleUpdated()
- func (win *ApplicationWindow) ZoomIn()
- func (win *ApplicationWindow) ZoomOut()
- func (win *ApplicationWindow) ZoomReset()
- type BookmarksMenu
- type CacheWindow
- func (cw *CacheWindow) Dispose()
- func (cw *CacheWindow) IsImagesStale() bool
- func (cw *CacheWindow) IsMetadataStale() bool
- func (cw *CacheWindow) IsVisible() bool
- func (cw *CacheWindow) Present()
- func (cw *CacheWindow) RefreshImages()
- func (cw *CacheWindow) RefreshImagesWith(images cache.Stat)
- func (cw *CacheWindow) RefreshMetadata()
- func (cw *CacheWindow) RefreshMetadataWith(metadata cache.Stat)
- type CheckModelButton
- type ComicListModel
- type ComicListView
- type ContextMenu
- type DarkModeSwitch
- type Grid
- type ImageViewer
- func (iv *ImageViewer) Dispose()
- func (iv *ImageViewer) DrawComic(comicId int, darkMode bool) error
- func (iv *ImageViewer) SetScale(scale float64) float64
- func (iv *ImageViewer) SetTooltipText(s string)
- func (iv *ImageViewer) ShowLoadingScreen()
- func (iv *ImageViewer) ZoomIn() float64
- func (iv *ImageViewer) ZoomOut() float64
- type NavigationBar
- func (nb *NavigationBar) Dispose()
- func (nb *NavigationBar) SetFirstButtonImage(image gtk.IWidget)
- func (nb *NavigationBar) SetLinkedButtons(linked bool) error
- func (nb *NavigationBar) SetNewestButtonImage(image gtk.IWidget)
- func (nb *NavigationBar) SetNextButtonImage(image gtk.IWidget)
- func (nb *NavigationBar) SetPreviousButtonImage(image gtk.IWidget)
- func (nb *NavigationBar) SetRandomButtonImage(image gtk.IWidget)
- func (nb *NavigationBar) UpdateButtonState(comicNumber int)
- type PopoverMenu
- func (pm *PopoverMenu) AddCheckButton(label string, stateGetter func() bool, stateSetter func(bool)) (*CheckModelButton, error)
- func (pm *PopoverMenu) AddChild(child gtk.IWidget, padding uint)
- func (pm *PopoverMenu) AddMenuEntries(labelActionPairs [][2]string) error
- func (pm *PopoverMenu) AddMenuEntry(label, action string) (*gtk.ModelButton, error)
- func (pm *PopoverMenu) AddSeparator() error
- func (pm *PopoverMenu) Dispose()
- func (pm *PopoverMenu) SetCompact(compact bool)
- func (pm *PopoverMenu) ShowAll()
- type PropertiesDialog
- type SearchMenu
- type Widget
- type WindowMenu
- type ZoomBox
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppName ¶ added in v1.5.0
func AppName() string
AppName is the user-visible name of this application.
func NewAboutDialog ¶ added in v1.4.2
func NewAboutDialog(windowRemover func(gtk.IWindow)) (*gtk.AboutDialog, error)
NewAboutDialog creates our application's about dialog.
func NewAppMenu ¶
NewAppMenu creates a glib.MenuModel populated with our application's app menu.
func NewComicListScroller ¶ added in v1.6.5
func NewComicListScroller() (*gtk.ScrolledWindow, error)
func NewShortcutsWindow ¶
func NewShortcutsWindow(windowRemover func(gtk.IWindow)) (*gtk.ShortcutsWindow, error)
NewShortcutsWindow creates a gtk.ShortcutsWindow populated with our application's keyboard shortcuts.
Types ¶
type Application ¶ added in v1.5.0
type Application interface { AddWindow(gtk.IWindow) BookmarksList() *bookmarks.List CacheWindowVR() cache.ViewRefresher CacheWindowVRW() cache.ViewRefreshWither ConnectDarkModeChanged(f any) glib.SignalHandle DarkMode() bool GtkApplication() *gtk.Application GtkTheme() (string, error) OpenURL(string) error PrefersAppMenu() bool RemoveWindow(gtk.IWindow) SetDarkMode(bool) }
Application is interface needed by github.com/rkoesters/xkcd-gtk/internal/widget and implemented by github.com/rkoesters/xkcd-gtk/internal/app.
type ApplicationWindow ¶ added in v1.5.3
type ApplicationWindow struct { *gtk.ApplicationWindow // contains filtered or unexported fields }
ApplicationWindow is the main application window.
func NewApplicationWindow ¶ added in v1.5.3
func NewApplicationWindow(app Application) (*ApplicationWindow, error)
NewApplicationWindow creates a new xkcd viewer window.
func (*ApplicationWindow) AddBookmark ¶ added in v1.7.0
func (win *ApplicationWindow) AddBookmark()
AddBookmark adds win's current comic to the user's bookmarks.
func (*ApplicationWindow) DarkModeChanged ¶ added in v1.6.3
func (win *ApplicationWindow) DarkModeChanged()
func (*ApplicationWindow) DisplayComic ¶ added in v1.5.3
func (win *ApplicationWindow) DisplayComic()
DisplayComic updates the UI to show the contents of win.comic.
func (*ApplicationWindow) Dispose ¶ added in v1.6.4
func (win *ApplicationWindow) Dispose()
Dispose releases all references in the Window struct. This is needed to mitigate a memory leak when closing windows.
func (*ApplicationWindow) Explain ¶ added in v1.5.3
func (win *ApplicationWindow) Explain()
Explain opens a link to explainxkcd.com in the user's web browser.
func (*ApplicationWindow) FirstComic ¶ added in v1.5.3
func (win *ApplicationWindow) FirstComic()
FirstComic goes to the first comic.
func (*ApplicationWindow) IsBookmarked ¶ added in v1.7.0
func (win *ApplicationWindow) IsBookmarked() bool
IsBookmarked returns whether the current comic is bookmarked. Do not call while holding a write lock on win.comicMutex.
func (*ApplicationWindow) IsVisible ¶ added in v1.6.5
func (win *ApplicationWindow) IsVisible() bool
func (*ApplicationWindow) NewestComic ¶ added in v1.5.3
func (win *ApplicationWindow) NewestComic()
NewestComic checks for a new comic and then shows the newest comic to the user.
func (*ApplicationWindow) NextComic ¶ added in v1.5.3
func (win *ApplicationWindow) NextComic()
NextComic sets the current comic to the next comic.
func (*ApplicationWindow) OpenLink ¶ added in v1.5.3
func (win *ApplicationWindow) OpenLink()
OpenLink opens the comic's Link in the user's web browser.
func (*ApplicationWindow) PreviousComic ¶ added in v1.5.3
func (win *ApplicationWindow) PreviousComic()
PreviousComic sets the current comic to the previous comic.
func (*ApplicationWindow) RandomComic ¶ added in v1.5.3
func (win *ApplicationWindow) RandomComic()
RandomComic sets the current comic to a random comic.
func (*ApplicationWindow) RemoveBookmark ¶ added in v1.7.0
func (win *ApplicationWindow) RemoveBookmark()
RemoveBookmark removes win's current comic from the user's bookmarks.
func (*ApplicationWindow) SetBookmarked ¶ added in v1.7.0
func (win *ApplicationWindow) SetBookmarked(bookmarked bool)
SetBookmarked adds win's current comic to the user's bookmarks if bookmarked is true, otherwise it removes the current comic from the user's bookmarks.
func (*ApplicationWindow) SetComic ¶ added in v1.5.3
func (win *ApplicationWindow) SetComic(n int)
SetComic sets the current comic to the given comic.
func (*ApplicationWindow) ShowLoading ¶ added in v1.5.3
func (win *ApplicationWindow) ShowLoading()
ShowLoading makes the window indicate that it is loading.
func (*ApplicationWindow) ShowProperties ¶ added in v1.5.3
func (win *ApplicationWindow) ShowProperties()
ShowProperties presents the properties dialog to the user. If the dialog doesn't exist yet, we create it.
func (*ApplicationWindow) StyleUpdated ¶ added in v1.5.3
func (win *ApplicationWindow) StyleUpdated()
StyleUpdated is called when the style of our gtk window is updated.
func (*ApplicationWindow) ZoomIn ¶ added in v1.6.0
func (win *ApplicationWindow) ZoomIn()
func (*ApplicationWindow) ZoomOut ¶ added in v1.6.0
func (win *ApplicationWindow) ZoomOut()
func (*ApplicationWindow) ZoomReset ¶ added in v1.6.0
func (win *ApplicationWindow) ZoomReset()
type BookmarksMenu ¶
func NewBookmarksMenu ¶
func NewBookmarksMenu(b *bookmarks.List, actions map[string]*glib.SimpleAction, accels *gtk.AccelGroup, comicSetter func(int), updateButtonIcons func()) (*BookmarksMenu, error)
func (*BookmarksMenu) Dispose ¶ added in v1.6.4
func (bm *BookmarksMenu) Dispose()
func (*BookmarksMenu) SetLinkedButtons ¶ added in v1.7.0
func (bm *BookmarksMenu) SetLinkedButtons(linked bool) error
func (*BookmarksMenu) Update ¶ added in v1.7.0
func (bm *BookmarksMenu) Update(comicNumber int)
type CacheWindow ¶ added in v1.7.0
type CacheWindow struct { *gtk.ApplicationWindow // contains filtered or unexported fields }
func NewCacheWindow ¶ added in v1.7.0
func NewCacheWindow(app Application) (*CacheWindow, error)
func (*CacheWindow) Dispose ¶ added in v1.7.0
func (cw *CacheWindow) Dispose()
func (*CacheWindow) IsImagesStale ¶ added in v1.7.0
func (cw *CacheWindow) IsImagesStale() bool
func (*CacheWindow) IsMetadataStale ¶ added in v1.7.0
func (cw *CacheWindow) IsMetadataStale() bool
func (*CacheWindow) IsVisible ¶ added in v1.7.0
func (cw *CacheWindow) IsVisible() bool
func (*CacheWindow) Present ¶ added in v1.7.0
func (cw *CacheWindow) Present()
func (*CacheWindow) RefreshImages ¶ added in v1.7.0
func (cw *CacheWindow) RefreshImages()
func (*CacheWindow) RefreshImagesWith ¶ added in v1.7.0
func (cw *CacheWindow) RefreshImagesWith(images cache.Stat)
func (*CacheWindow) RefreshMetadata ¶ added in v1.7.0
func (cw *CacheWindow) RefreshMetadata()
func (*CacheWindow) RefreshMetadataWith ¶ added in v1.7.0
func (cw *CacheWindow) RefreshMetadataWith(metadata cache.Stat)
type CheckModelButton ¶ added in v1.7.0
type CheckModelButton struct { *gtk.ModelButton // contains filtered or unexported fields }
func NewCheckModelButton ¶ added in v1.7.0
func NewCheckModelButton(stateGetter func() bool, stateSetter func(bool)) (*CheckModelButton, error)
func (*CheckModelButton) Clicked ¶ added in v1.7.0
func (cmb *CheckModelButton) Clicked()
func (*CheckModelButton) Dispose ¶ added in v1.7.0
func (cmb *CheckModelButton) Dispose()
func (*CheckModelButton) SyncState ¶ added in v1.7.0
func (cmb *CheckModelButton) SyncState(state bool)
type ComicListModel ¶ added in v1.6.5
func NewComicListModel ¶ added in v1.6.5
func NewComicListModel() (*ComicListModel, error)
func (*ComicListModel) AppendComic ¶ added in v1.6.5
func (clm *ComicListModel) AppendComic(comicNum int, comicTitle string) error
type ComicListView ¶ added in v1.6.5
func NewComicListView ¶ added in v1.6.5
func NewComicListView(comicSetter func(int)) (*ComicListView, error)
func (*ComicListView) Dispose ¶ added in v1.6.5
func (clv *ComicListView) Dispose()
type ContextMenu ¶ added in v1.5.0
type ContextMenu struct { *PopoverMenu // contains filtered or unexported fields }
func NewContextMenu ¶ added in v1.5.0
func NewContextMenu(relative gtk.IWidget, actionGroup glib.IActionGroup, bookmarkedGetter func() bool, bookmarkedSetter func(bool)) (*ContextMenu, error)
func (*ContextMenu) Dispose ¶ added in v1.6.4
func (cm *ContextMenu) Dispose()
func (*ContextMenu) PopupAtPointer ¶ added in v1.7.0
func (cm *ContextMenu) PopupAtPointer(event *gdk.EventButton)
func (*ContextMenu) SetCompact ¶ added in v1.7.0
func (cm *ContextMenu) SetCompact(compact bool)
type DarkModeSwitch ¶ added in v1.6.1
DarkModeSwitch is a labeled gtk.Switch intended for toggling whether the application's dark mode is enabled.
func NewDarkModeSwitch ¶ added in v1.6.1
func NewDarkModeSwitch(darkModeGetter func() bool, darkModeSetter func(bool)) (*DarkModeSwitch, error)
func (*DarkModeSwitch) Dispose ¶ added in v1.6.4
func (dms *DarkModeSwitch) Dispose()
func (*DarkModeSwitch) SetCompact ¶ added in v1.6.1
func (dms *DarkModeSwitch) SetCompact(compact bool)
func (*DarkModeSwitch) SwitchStateChanged ¶ added in v1.6.3
func (dms *DarkModeSwitch) SwitchStateChanged(swtch *gtk.Switch)
SwitchStateChanged is called when the active state of the switch changes.
func (*DarkModeSwitch) SyncDarkMode ¶ added in v1.6.1
func (dms *DarkModeSwitch) SyncDarkMode(darkMode bool)
SyncDarkMode informs the switch whether dark mode is enabled or not.
type Grid ¶ added in v1.7.0
func (*Grid) AddRowToGrid ¶ added in v1.7.0
type ImageViewer ¶
type ImageViewer struct { *gtk.ScrolledWindow // contains filtered or unexported fields }
func NewImageViewer ¶
func NewImageViewer(actionGroup glib.IActionGroup, imageScale float64, bookmarkedGetter func() bool, bookmarkedSetter func(bool)) (*ImageViewer, error)
func (*ImageViewer) Dispose ¶ added in v1.6.4
func (iv *ImageViewer) Dispose()
func (*ImageViewer) DrawComic ¶ added in v1.6.2
func (iv *ImageViewer) DrawComic(comicId int, darkMode bool) error
func (*ImageViewer) SetScale ¶ added in v1.6.0
func (iv *ImageViewer) SetScale(scale float64) float64
func (*ImageViewer) SetTooltipText ¶
func (iv *ImageViewer) SetTooltipText(s string)
func (*ImageViewer) ShowLoadingScreen ¶
func (iv *ImageViewer) ShowLoadingScreen()
func (*ImageViewer) ZoomIn ¶ added in v1.6.0
func (iv *ImageViewer) ZoomIn() float64
func (*ImageViewer) ZoomOut ¶ added in v1.6.0
func (iv *ImageViewer) ZoomOut() float64
type NavigationBar ¶
type NavigationBar struct { // contains filtered or unexported fields }
func NewNavigationBar ¶
func NewNavigationBar(accels *gtk.AccelGroup, actions map[string]*glib.SimpleAction, comicNumber func() int) (*NavigationBar, error)
func (*NavigationBar) Dispose ¶ added in v1.6.4
func (nb *NavigationBar) Dispose()
func (*NavigationBar) SetFirstButtonImage ¶
func (nb *NavigationBar) SetFirstButtonImage(image gtk.IWidget)
func (*NavigationBar) SetLinkedButtons ¶ added in v1.5.0
func (nb *NavigationBar) SetLinkedButtons(linked bool) error
func (*NavigationBar) SetNewestButtonImage ¶
func (nb *NavigationBar) SetNewestButtonImage(image gtk.IWidget)
func (*NavigationBar) SetNextButtonImage ¶
func (nb *NavigationBar) SetNextButtonImage(image gtk.IWidget)
func (*NavigationBar) SetPreviousButtonImage ¶
func (nb *NavigationBar) SetPreviousButtonImage(image gtk.IWidget)
func (*NavigationBar) SetRandomButtonImage ¶
func (nb *NavigationBar) SetRandomButtonImage(image gtk.IWidget)
func (*NavigationBar) UpdateButtonState ¶ added in v1.6.4
func (nb *NavigationBar) UpdateButtonState(comicNumber int)
type PopoverMenu ¶ added in v1.7.0
func NewPopoverMenu ¶ added in v1.7.0
func NewPopoverMenu(relative gtk.IWidget) (*PopoverMenu, error)
func (*PopoverMenu) AddCheckButton ¶ added in v1.7.0
func (pm *PopoverMenu) AddCheckButton(label string, stateGetter func() bool, stateSetter func(bool)) (*CheckModelButton, error)
func (*PopoverMenu) AddChild ¶ added in v1.7.0
func (pm *PopoverMenu) AddChild(child gtk.IWidget, padding uint)
func (*PopoverMenu) AddMenuEntries ¶ added in v1.7.0
func (pm *PopoverMenu) AddMenuEntries(labelActionPairs [][2]string) error
func (*PopoverMenu) AddMenuEntry ¶ added in v1.7.0
func (pm *PopoverMenu) AddMenuEntry(label, action string) (*gtk.ModelButton, error)
func (*PopoverMenu) AddSeparator ¶ added in v1.7.0
func (pm *PopoverMenu) AddSeparator() error
func (*PopoverMenu) Dispose ¶ added in v1.7.0
func (pm *PopoverMenu) Dispose()
func (*PopoverMenu) SetCompact ¶ added in v1.7.0
func (pm *PopoverMenu) SetCompact(compact bool)
func (*PopoverMenu) ShowAll ¶ added in v1.7.0
func (pm *PopoverMenu) ShowAll()
type PropertiesDialog ¶ added in v1.5.0
PropertiesDialog holds a gtk dialog that shows the comic information for the parent window's comic.
func NewPropertiesDialog ¶ added in v1.5.0
func NewPropertiesDialog(parent *ApplicationWindow) (*PropertiesDialog, error)
NewPropertiesDialog creates and returns a PropertiesDialog for the given parent Window.
func (*PropertiesDialog) DeleteEvent ¶ added in v1.6.4
func (pd *PropertiesDialog) DeleteEvent()
DeleteEvent is called when the dialog is closed. It tells the parent to save its window state.
func (*PropertiesDialog) Dispose ¶ added in v1.6.4
func (pd *PropertiesDialog) Dispose()
Dispose removes our references to the dialog so the garbage collector can take care of it.
func (*PropertiesDialog) IsVisible ¶ added in v1.6.5
func (pd *PropertiesDialog) IsVisible() bool
func (*PropertiesDialog) Update ¶ added in v1.5.0
func (pd *PropertiesDialog) Update()
Update changes the dialog's contents to match the parent Window's comic.
type SearchMenu ¶
type SearchMenu struct { *gtk.MenuButton // contains filtered or unexported fields }
func NewSearchMenu ¶
func NewSearchMenu(accels *gtk.AccelGroup, comicSetter func(int)) (*SearchMenu, error)
func (*SearchMenu) Dispose ¶ added in v1.6.4
func (sm *SearchMenu) Dispose()
func (*SearchMenu) Search ¶
func (sm *SearchMenu) Search()
Search preforms a search with win.searchEntry.GetText() and puts the results into win.searchResults.
type Widget ¶
type Widget interface { // Our custom widgets should embed a gtk.Widget. gtk.IWidget // Dispose performs clean up to aid garbage collection. Should break // reference cycles, if any. Must gracefully accept a nil receiver. Dispose() }
Widget is a custom GTK+ widget.
type WindowMenu ¶
type WindowMenu struct { *gtk.MenuButton // contains filtered or unexported fields }
func NewWindowMenu ¶
func NewWindowMenu(accels *gtk.AccelGroup, prefersAppMenu bool, darkModeGetter func() bool, darkModeSetter func(bool)) (*WindowMenu, error)
func (*WindowMenu) Dispose ¶ added in v1.6.4
func (wm *WindowMenu) Dispose()
func (*WindowMenu) SetCompact ¶ added in v1.6.1
func (wm *WindowMenu) SetCompact(compact bool)
type ZoomBox ¶ added in v1.6.0
func NewZoomBox ¶ added in v1.6.0
func (*ZoomBox) SetCompact ¶ added in v1.6.3
func (*ZoomBox) SetCurrentZoom ¶ added in v1.6.0
Source Files ¶
- about-dialog.go
- app-menu.go
- application-window.go
- application.go
- bookmarks-menu.go
- cache-window.go
- check-model-button.go
- comic-list-model.go
- comic-list-view.go
- context-menu.go
- dark-mode-switch.go
- grid.go
- i18n.go
- image-viewer.go
- navigation-bar.go
- popover-menu.go
- properties-dialog.go
- search-menu.go
- shortcuts-window.go
- widget.go
- window-menu.go
- zoom-box.go