-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Move gtk.nim into bindings dir * Refactor adwaita bindings into a binding module * Re export bound enums * Add bindings and first basic broken example for preferences page * Fix example * Add docs * Remove preferences page from github CI examples * Fix example being borked * Fix nimble file * Fix stuff * Build example in CI * Compile example without adwaita 1.2 --------- Co-authored-by: Can Lehmann <can.l@posteo.de>
- Loading branch information
1 parent
bdc343f
commit 968784a
Showing
7 changed files
with
166 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# MIT License | ||
# | ||
# Copyright (c) 2022 Can Joshua Lehmann | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included in all | ||
# copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
# SOFTWARE. | ||
|
||
import owlkettle, owlkettle/[playground, adw] | ||
|
||
viewable App: | ||
iconName: string = "weather-clear-symbolic" | ||
title: string = "Some Title" | ||
name: string = "A name" | ||
description: string = "An example of a Preferences Page" | ||
useUnderline: bool = false | ||
|
||
likeLevel: int | ||
reason: string | ||
|
||
likeOptions: seq[string] = @["A bit", "A lot", "very much", "Fantastic!", "I love it!"] | ||
|
||
method view(app: AppState): Widget = | ||
result = gui: | ||
Window: | ||
defaultSize = (800, 600) | ||
title = "Preferences Page Example" | ||
|
||
HeaderBar {.addTitlebar.}: | ||
insert(app.toAutoFormMenu(sizeRequest = (400, 250))) {.addRight.} | ||
|
||
PreferencesPage: | ||
iconName = app.iconName | ||
title = app.title | ||
name = app.name | ||
description = app.description | ||
useUnderline = app.useUnderline | ||
|
||
PreferencesGroup: | ||
title = "First Preferences Group" | ||
description = "Description" | ||
|
||
ComboRow: | ||
title = "How much do you like this example?" | ||
items = app.likeOptions | ||
selected = app.likeLevel | ||
|
||
proc select(selectedIndex: int) = | ||
app.likeLevel = selectedIndex | ||
|
||
PreferencesGroup: | ||
title = "Second Preferences Group" | ||
|
||
ActionRow: | ||
title = "Why do you like the example?" | ||
|
||
Entry {.addSuffix.}: | ||
text = app.reason | ||
|
||
proc changed(text: string) = | ||
app.reason = text | ||
|
||
adw.brew(gui(App())) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters