glimmer-dsl-tk 0.0.37 → 0.0.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2454b5a3d7bd7159328cab0c0c82a4ebcdb54066bec28a1549e3cbca61d1bd8d
4
- data.tar.gz: 7535984b2838617c7a40ee336c653e6c5c9029c7e49b3a4a13f1815897ecec8d
3
+ metadata.gz: a6ce065d32aa469d1e55999bdcd730d0837110d6fb7cda8fd8992e297c9ed600
4
+ data.tar.gz: 48c7e0517d0135656c36698cee1d2ccf65c342aed1793c135766e860572dec6a
5
5
  SHA512:
6
- metadata.gz: d377872669979a76bf149aec8683ade86fadd7efa50817abe4f8e582a0f3b53ac354759f3e7e6aa4e683fcd6296308eb7339c049718fcd7c673e4452f1052614
7
- data.tar.gz: b321a3e34b16f9a1719797c51f25521a48c4c12ba39f92a730618dedc54f564754f24e73f60118023213583e3629c188643684cc7d326628613c982c0a87e7d0
6
+ metadata.gz: 4f06cb1144383c64b489f58016c880c4fb82d506ce63f8dd1953448748017b9f3910c0d7792d926d5479bc89564a503639b406e3d62728a690e11ef8e81e3126
7
+ data.tar.gz: 2d6fa5b4cede272fd2aeec4a83a58cfd2dc8d59157692052b179d4ec91a1a7925061f20bf0dcc06160fb9d375ac493c5f75169106ea61878a011a8c5fec022f9
data/CHANGELOG.md CHANGED
@@ -1,7 +1,46 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.0.41
4
+
5
+ - Support `scrollbar_frame` Glimmer custom widget as a frame that automatically provides scrollbars when its content's size exceeds its size
6
+ - Support `scrollbar_frame` `xscrollbar` and `yscrollbar` attributes (to enable/disable via boolean or set to a custom externally instantiated scrollbar if needed)
7
+ - Hello, Scrollbar Frame!
8
+
9
+ ## 0.0.40
10
+
11
+ - Hello, Scrollbar!
12
+ - Default to 'alt' Tk theme on Linux
13
+ - Added Windows/Linux accelerators to Hello, Menu Bar!
14
+ - Fix issue with extra junk character added to beginning of Hello, Checkbutton! by mistake
15
+ - Fix issue with Hello, Menu Bar! help menu item crashing in Linux (it is restricted to Mac only)
16
+ - Fix issue with Hello, Text! focus losing selection in Linux upon setting background/foreground/font/font-size
17
+
18
+ ## 0.0.39
19
+
20
+ - Add Language and Language Name menus to Hello, Menu Bar! sample
21
+ - Update Hello, Button! sample to indicate compound option value on image text buttons
22
+ - Support Mac `menu_item(:about, label: ) { on('command') {} }`
23
+ - Support Mac `menu_item(:preferences) { on('command') {} }`
24
+ - Support Mac `menu_item(:help) { on('command') {} }`
25
+ - Support Mac `menu_item(:quit) { on('command') {} }`
26
+ - Support Mac/X11 `'Help'` menu
27
+ - Support Mac `'Window'` menu
28
+ - Support Windows `'System'` menu
29
+
30
+
31
+ ## 0.0.38
32
+
33
+ - Hello, Menu Bar! sample
34
+ - Support `menu` and `menu_item` widgets including `:command` (default), `:separator`, `:radiobutton`, and `:checkbutton` styles
35
+ - Support menu item `accelerator` attribute
36
+ - Support menu item `selection` attribute
37
+ - Support menu item `state` attribute
38
+ - Support menu item command event, which is triggered on mouse/keyboard menu item selection or via accelerator
39
+ - Support `toplevel` `iconphoto` (more conveniently via direct path) and `resizable` attributes
40
+
3
41
  ## 0.0.37
4
42
 
43
+ - Support `focus: true` or `focus: [integer]` option for all selection formatting methods (`add_selection_format`, `remove_selection_format`, `toggle_selection_format`, `add_selection_font_format`, `remove_selection_font_format`, `toggle_selection_font_format`)
5
44
  - Have `text` widget grab focus after every formatting modification in Hello, Text! (e.g. after clicking `B` for Bold)
6
45
 
7
46
  ## 0.0.36
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for Tk 0.0.37
1
+ # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for Tk 0.0.41
2
2
  ## MRI Ruby Desktop Development GUI Library
3
3
  [![Gem Version](https://badge.fury.io/rb/glimmer-dsl-tk.svg)](http://badge.fury.io/rb/glimmer-dsl-tk)
4
4
  [![Ruby](https://github.com/AndyObtiva/glimmer-dsl-tk/actions/workflows/ruby.yml/badge.svg)](https://github.com/AndyObtiva/glimmer-dsl-tk/actions/workflows/ruby.yml)
@@ -57,7 +57,7 @@ Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems:
57
57
  - [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt): Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)
58
58
  - [glimmer-dsl-opal](https://github.com/AndyObtiva/glimmer-dsl-opal): Glimmer DSL for Opal (Pure Ruby Web GUI and Auto-Webifier of Desktop Apps)
59
59
  - [glimmer-dsl-libui](https://github.com/AndyObtiva/glimmer-dsl-libui): Glimmer DSL for LibUI (Prerequisite-Free Ruby Desktop Development GUI Library)
60
- - [glimmer-dsl-gtk](https://github.com/AndyObtiva/glimmer-dsl-gtk): Ruby-GNOME Desktop Development GUI Library
60
+ - [glimmer-dsl-gtk](https://github.com/AndyObtiva/glimmer-dsl-gtk): Glimmer DSL for GTK (Ruby-GNOME Desktop Development GUI Library)
61
61
  - [glimmer-dsl-xml](https://github.com/AndyObtiva/glimmer-dsl-xml): Glimmer DSL for XML (& HTML)
62
62
  - [glimmer-dsl-css](https://github.com/AndyObtiva/glimmer-dsl-css): Glimmer DSL for CSS (Cascading Style Sheets)
63
63
 
@@ -82,6 +82,7 @@ Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems:
82
82
  - [Image Attribute](#image-attribute)
83
83
  - [Frame Padding](#frame-padding)
84
84
  - [Notebook Frame](#notebook-frame)
85
+ - [Menu Item Accelerator](#menu-item-accelerator)
85
86
  - [Icon Photo](#icon-photo)
86
87
  - [Root Background](#root-background)
87
88
  - [Toplevel Mac Style](#toplevel-mac-style)
@@ -120,10 +121,14 @@ Other [Glimmer](https://github.com/AndyObtiva/glimmer) DSL gems:
120
121
  - [Hello, Drag and Drop!](#hello-drag-and-drop)
121
122
  - [Hello, Built-in Dialog!](#hello-built-in-dialog)
122
123
  - [Hello, Separator!](#hello-separator)
124
+ - [Hello, Scrollbar!](#hello-scrollbar)
125
+ - [Hello, Scrollbar Frame!](#hello-scrollbar-frame)
126
+ - [Hello, Menu Bar!](#hello-menu-bar)
123
127
  - [Applications](#applications)
124
128
  - [Glimmer Tk Calculator](#glimmer-tk-calculator)
125
129
  - [Y3network Ruby UI](#y3network-ruby-ui)
126
130
  - [CryptoPunks GUI](#cryptopunks-gui)
131
+ - [Circule](#circule)
127
132
  - [Process](#process)
128
133
  - [Resources](#resources)
129
134
  - [Help](#help)
@@ -146,6 +151,21 @@ For example, on the Mac, you can:
146
151
  - Run: `rvm install 3.0.2 --enable-shared --enable-pthread --with-tk --with-tcl`
147
152
  - Run: `gem install tk -v0.4.0`
148
153
 
154
+ For example, on Windows, you can follow the [instructions over here](https://tkdocs.com/tutorial/install.html), specifically the following:
155
+ - Install Ruby+Devkit (including MSYS/MINGW toolchains) through Windows Installer: https://rubyinstaller.org/downloads/
156
+ - Install the ActiveTcl Windows package from [ActiveState.com](https://activestate.com)
157
+ - Follow this instruction: "First, Ruby needs to find the tcl86t.dll and tk86t.dll shared libraries. These are located in C:\ActiveTcl\bin. Make a copy of them somewhere Ruby can find them, e.g. C:\Ruby26\bin."
158
+ - Setup environment variables TCL_LIBRARY=C:\ActiveTcl\lib\tcl8.6 & TK_LIBRARY=C:\ActiveTcl\lib\tk8.6
159
+ - Run: `gem install tk -v0.4.0`
160
+
161
+ For example, on Linux, you can:
162
+ - Download the ActiveTcl Linux package from [ActiveState.com](https://activestate.com)
163
+ - Extract the tar gz file using command `tar zxvf ActiveTcl-version-number.tar.gz`
164
+ - Run included install shell script `./ActiveTcl-version-number/install.sh`
165
+ - Install [RVM](https://rvm.io/) by running `\curl -sSL https://get.rvm.io | bash -s stable` (and run `curl -sSL https://rvm.io/pkuczynski.asc | gpg --import -` if needed for mentioned security reasons)
166
+ - Run: `rvm install 3.0.2 --enable-shared --enable-pthread --with-tk --with-tcl`
167
+ - Run: `gem install tk -v0.4.0`
168
+
149
169
  Afterwards, if you open `irb`, you should be able to run `require 'tk'` successfully.
150
170
 
151
171
  ## Setup
@@ -161,7 +181,7 @@ gem install glimmer-dsl-tk
161
181
 
162
182
  Add the following to `Gemfile`:
163
183
  ```
164
- gem 'glimmer-dsl-tk', '~> 0.0.37'
184
+ gem 'glimmer-dsl-tk', '~> 0.0.41'
165
185
  ```
166
186
 
167
187
  And, then run:
@@ -285,11 +305,18 @@ keyword(args) | attributes | event bindings & callbacks
285
305
  `label` | `text`, `image` (optional keyword args: `subsample`, `zoom`, `from`, `to`, `shrink`, `compositingrule`), `compound` (`'center', 'top', 'bottom', 'left', 'right'`), `font` (`'default', 'text', 'fixed', 'menu', 'heading', 'caption', 'small_caption', 'icon', 'tooltip'`), `relief` (`'flat' (default), 'raised', 'sunken', 'solid', 'ridge', 'groove'`), `justify` (`'left', 'center', 'right'`), `foreground`, `background` | None
286
306
  `list` | `selectmode`, `selection` | None
287
307
  `message_box(type: , message: , detail: , title: , icon: , default: , parent: )` | None | None
308
+ `menu(label: nil) (label is nil if nested under root/toplevel for menu bar)` | None | None
309
+ `menu_item(style = :command, label: , underline: )` (style also can be `:radiobutton`, `:checkbutton`, `:separator`, `:about`, `:preferences`, `:quit`, `:help`) | `state`, `accelerator`, `selection` & `variable` (if `:radiobutton` or `:checkbutton`), `image`, `compound` | `command`
288
310
  `notebook` | None | None
289
311
  `radiobutton` | `text`, `variable` (Boolean), `image` (optional keyword args: `subsample`, `zoom`, `from`, `to`, `shrink`, `compositingrule`), `compound` (`'center', 'top', 'bottom', 'left', 'right'`), `value` (default: `text`) | `command {}`
290
- `root` | `title`, `iconphoto`, `background`, `alpha`, `fullscreen?`, `topmost?`, `transparent?`, `stackorder`, `winfo_screendepth`, `winfo_screenvisual`, `winfo_screenwidth`, `winfo_screenheight`, `winfo_pixels('li')`, `winfo_screen`, `wm_maxsize`, `state` (`'normal', 'iconic', 'withdrawn', 'icon', 'zoomed'`) | `'DELETE_WINDOW'`, `'OPEN_WINDOW'`
312
+ `root` | `title`, `iconphoto`, `background`, `alpha`, `escapable`, `fullscreen?`, `topmost?`, `transparent?`, `stackorder`, `winfo_screendepth`, `winfo_screenvisual`, `winfo_screenwidth`, `winfo_screenheight`, `winfo_pixels('li')`, `winfo_screen`, `wm_maxsize`, `state` (`'normal', 'iconic', 'withdrawn', 'icon', 'zoomed'`) | `'DELETE_WINDOW'`, `'OPEN_WINDOW'`
313
+ `scrollbar` | `orient` | `command`
314
+ `scrollbar_frame` | `xscrollbar` (Boolean or scrollbar widget proxy), `yscrollbar` (Boolean or scrollbar widget proxy) | None
291
315
  `separator` | `orient` (`'horizontal' (default) or 'vertical'`) | None
316
+ `toplevel` | `title`, `iconphoto`, `background`, `alpha`, `escapable`, `fullscreen?`, `topmost?`, `transparent?`, `stackorder`, `winfo_screendepth`, `winfo_screenvisual`, `winfo_screenwidth`, `winfo_screenheight`, `winfo_pixels('li')`, `winfo_screen`, `wm_maxsize`, `state` (`'normal', 'iconic', 'withdrawn', 'icon', 'zoomed'`) | `'DELETE_WINDOW'`
292
317
  `text` | `value`, [many more attributes](https://tcl.tk/man/tcl8.6/TkCmd/text.htm#M116) | `'modified'`, `'selection'`, `'insert_mark_moved'` (alias: `'insert_mark_move', 'InsertMarkMove', 'InsertMarkMoved'`)
318
+ `x_scrollbar` | `orient` (`'horizontal'`) | `command`
319
+ `y_scrollbar` | `orient` (`'vertical'`) | `command`
293
320
 
294
321
  Options for `get_open_file` and `get_multiple_open_file` include:
295
322
  - `filetypes`: `Hash` of `'Group Name' => '.ext'` entries (e.g. `filetypes: {'PNG Images' => '.png'}`
@@ -409,8 +436,44 @@ Other useful built-in API methods:
409
436
  - `text_edit_undo`
410
437
  - `text_edit_redo`
411
438
 
439
+ If you would like to add scrollbars, you can set the `xscrollbar` and `yscrollbar` attributes.
440
+
441
+ Example of adding a vertical `scrollbar`:
442
+
443
+ ```ruby
444
+ textarea_yscrollbar = y_scrollbar {
445
+ grid row:0, column:1
446
+ }
447
+
448
+ textarea = text {
449
+ grid row:0, column:0, column_weight: 0
450
+ wrap "word"
451
+ yscrollbar textarea_yscrollbar
452
+ }
453
+ ```
454
+
455
+ Example of adding both a horizontal `scrollbar` and a vertical `scrollbar` (must disable `wrap "word"` for horizontal scrolling to work):
456
+
457
+ ```ruby
458
+ textarea_xscrollbar = x_scrollbar {
459
+ grid row:1, column:0, column_span: 2, row_weight: 0
460
+ }
461
+
462
+ textarea_yscrollbar = y_scrollbar {
463
+ grid row:0, column:1
464
+ }
465
+
466
+ textarea = text {
467
+ grid row:0, column:0, column_weight: 0
468
+ xscrollbar textarea_xscrollbar
469
+ yscrollbar textarea_yscrollbar
470
+ }
471
+ ```
472
+
412
473
  Check out the [Hello, Text!](#hello-text) sample for a good demonstration of the `text` widget features.
413
474
 
475
+ Check out the [Hello, Scrollbar!](#hello-scrollbar) sample for a `text` demo with scrolling.
476
+
414
477
  #### Drag and Drop API
415
478
 
416
479
  Drag and drop works by simply designating a widget as a drag source with attribute `drag_source true`
@@ -456,6 +519,10 @@ Frames have a padding of `15` all around by default to produce more user-friendl
456
519
 
457
520
  When nesting `frame` under `notebook`, you can pass a `:text` keyword argument to indicate the tab title.
458
521
 
522
+ #### Menu Item Accelerator
523
+
524
+ `menu_item` `accelerator` is automatically bound to the `command` set inside `menu_item` content (no need to do manual binding as per [Tk docs](https://tkdocs.com/tutorial/menus.html)).
525
+
459
526
  #### Icon Photo
460
527
 
461
528
  The `iconphoto` attribute on `root` is set to the Glimmer icon by default if no icon photo is supplied.
@@ -2920,6 +2987,447 @@ Glimmer app:
2920
2987
 
2921
2988
  ![glimmer dsl tk screenshot sample hello separator](images/glimmer-dsl-tk-screenshot-sample-hello-separator.png)
2922
2989
 
2990
+ ### Hello, Scrollbar!
2991
+
2992
+ Glimmer code (from [samples/hello/hello_scrollbar.rb](samples/hello/hello_scrollbar.rb)):
2993
+
2994
+ ```ruby
2995
+ require 'glimmer-dsl-tk'
2996
+
2997
+ include Glimmer
2998
+
2999
+ root {
3000
+ title 'Hello, Scrollbar!'
3001
+ width 400
3002
+ height 500
3003
+
3004
+ notebook {
3005
+ grid sticky: 'nsew'
3006
+
3007
+ frame(text: 'Scrollable List') {
3008
+ @list = list {
3009
+ grid sticky: 'nsew', row: 0, column: 0, row_weight: 1, column_weight: 1
3010
+ items 40.times.map {|n| "Item #{n + 1} of a very long list" }
3011
+ }
3012
+
3013
+ @scrollbar = scrollbar {
3014
+ grid row: 0, column: 1
3015
+ # orient 'vertical' # default
3016
+ }
3017
+ @list.yscrollbar @scrollbar
3018
+ }
3019
+
3020
+ frame(text: 'Scrollable Text') {
3021
+ @text = text {
3022
+ grid sticky: 'nsew', row: 0, column: 0, row_weight: 1, column_weight: 1
3023
+ value ("This is a random sample of text that will repeat over and over and over"*2 + "\n")*40
3024
+ }
3025
+
3026
+ @yscrollbar = scrollbar {
3027
+ grid row: 0, column: 1
3028
+ # orient 'vertical' # default
3029
+ }
3030
+ @text.yscrollbar @yscrollbar
3031
+
3032
+ @xscrollbar = scrollbar {
3033
+ grid row: 1, column: 0, column_span: 2, row_weight: 0
3034
+ orient 'horizontal'
3035
+ }
3036
+ @text.xscrollbar @xscrollbar
3037
+ }
3038
+ }
3039
+
3040
+ }.open
3041
+ ```
3042
+
3043
+ Run with [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed:
3044
+
3045
+ ```
3046
+ ruby -r glimmer-dsl-tk -e "require 'samples/hello/hello_scrollbar'"
3047
+ ```
3048
+
3049
+ Alternatively, run from cloned project without [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed:
3050
+
3051
+ ```
3052
+ ruby -r ./lib/glimmer-dsl-tk.rb samples/hello/hello_scrollbar.rb
3053
+ ```
3054
+
3055
+ Glimmer app:
3056
+
3057
+ ![glimmer dsl tk screenshot sample hello scrollbar](images/glimmer-dsl-tk-screenshot-sample-hello-scrollbar-list.png)
3058
+
3059
+ ![glimmer dsl tk screenshot sample hello scrollbar](images/glimmer-dsl-tk-screenshot-sample-hello-scrollbar-text.png)
3060
+
3061
+ ### Hello, Scrollbar Frame!
3062
+
3063
+ Glimmer code (from [samples/hello/hello_scrollbar_frame.rb](samples/hello/hello_scrollbar_frame.rb)):
3064
+
3065
+ ```ruby
3066
+ require 'glimmer-dsl-tk'
3067
+
3068
+ include Glimmer
3069
+
3070
+ root {
3071
+ title 'Hello, Scrollbar Frame!'
3072
+ width 400
3073
+ height 400
3074
+
3075
+ notebook {
3076
+ grid sticky: 'nsew'
3077
+
3078
+ frame(text: 'X/Y Scroll') {
3079
+ scrollbar_frame {
3080
+ 30.times do |row|
3081
+ 10.times do |column|
3082
+ button {
3083
+ grid row: row, column: column, row_weight: 0, column_weight: 0
3084
+ text "Row #{row} | Column #{column}"
3085
+ }
3086
+ end
3087
+ end
3088
+ }
3089
+ }
3090
+
3091
+ frame(text: 'Y Scroll') {
3092
+ scrollbar_frame {
3093
+ xscrollbar false
3094
+
3095
+ 30.times do |row|
3096
+ 2.times do |column|
3097
+ button {
3098
+ grid row: row, column: column, row_weight: 0, column_weight: 0
3099
+ text "Row #{row} | Column #{column}"
3100
+ }
3101
+ end
3102
+ end
3103
+ }
3104
+ }
3105
+
3106
+ frame(text: 'X Scroll') {
3107
+ scrollbar_frame {
3108
+ yscrollbar false
3109
+
3110
+ 13.times do |row|
3111
+ 10.times do |column|
3112
+ button {
3113
+ grid row: row, column: column, row_weight: 0, column_weight: 0
3114
+ text "Row #{row} | Column #{column}"
3115
+ }
3116
+ end
3117
+ end
3118
+ }
3119
+ }
3120
+ }
3121
+ }.open
3122
+ ```
3123
+
3124
+ Run with [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed:
3125
+
3126
+ ```
3127
+ ruby -r glimmer-dsl-tk -e "require 'samples/hello/hello_scrollbar_frame'"
3128
+ ```
3129
+
3130
+ Alternatively, run from cloned project without [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed:
3131
+
3132
+ ```
3133
+ ruby -r ./lib/glimmer-dsl-tk.rb samples/hello/hello_scrollbar_frame.rb
3134
+ ```
3135
+
3136
+ Glimmer app:
3137
+
3138
+ ![glimmer dsl tk screenshot sample hello scrollbar frame x y scroll](images/glimmer-dsl-tk-screenshot-sample-hello-scrollbar-frame-x-y-scroll.png)
3139
+
3140
+ ![glimmer dsl tk screenshot sample hello scrollbar frame y scroll](images/glimmer-dsl-tk-screenshot-sample-hello-scrollbar-frame-y-scroll.png)
3141
+
3142
+ ![glimmer dsl tk screenshot sample hello scrollbar frame x scroll](images/glimmer-dsl-tk-screenshot-sample-hello-scrollbar-frame-x-scroll.png)
3143
+
3144
+ ### Hello, Menu Bar!
3145
+
3146
+ Glimmer code (from [samples/hello/hello_menu_bar.rb](samples/hello/hello_menu_bar.rb)):
3147
+
3148
+ ```ruby
3149
+ require 'glimmer-dsl-tk'
3150
+
3151
+ include Glimmer
3152
+
3153
+ COLORS = [:white, :red, :yellow, :green, :blue, :magenta, :gray, :black]
3154
+
3155
+ Tk::Tile::Style.theme_use "classic" # this enables setting background on label just for demo purposes
3156
+
3157
+ root { |r|
3158
+ title 'Hello, Menu Bar!'
3159
+
3160
+ @label = label {
3161
+ grid row_weight: 1, column_weight: 1
3162
+ text 'Check Out The Menu Bar Above!'
3163
+ font size: 50
3164
+ anchor 'center'
3165
+ }
3166
+
3167
+ menu {
3168
+ # Mac-specific application menu (right next to the Apple menu)
3169
+ if OS.mac?
3170
+ menu(:application) {
3171
+ menu_item(:about, label: 'About My Application') {
3172
+ accelerator 'Command+A'
3173
+
3174
+ on('command') do
3175
+ message_box(parent: r, title: 'About', message: 'About my application.')
3176
+ end
3177
+ }
3178
+
3179
+ menu_item(:preferences) {
3180
+ on('command') do
3181
+ message_box(parent: r, title: 'Preferences', message: 'Preferences of my application.')
3182
+ end
3183
+ }
3184
+
3185
+ # If not defined, application simply quits upon selecting Quit menu item
3186
+ menu_item(:quit) {
3187
+ on('command') do
3188
+ message_box(parent: r, title: 'Quit', message: 'Quitting my application...')
3189
+ exit(0)
3190
+ end
3191
+ }
3192
+ }
3193
+ end
3194
+
3195
+ # Windows-specific system menu (to the top-left of the window frame)
3196
+ if OS.windows?
3197
+ menu(label: 'System')
3198
+ end
3199
+
3200
+ menu(label: 'File', underline: 0) {
3201
+ menu_item(label: 'New', underline: 0) {
3202
+ accelerator OS.mac? ? 'Command+N' : 'Control+N'
3203
+
3204
+ on('command') do
3205
+ message_box(parent: r, title: 'New', message: 'New file created.')
3206
+ end
3207
+ }
3208
+
3209
+ menu_item(label: 'Open...', underline: 0) {
3210
+ accelerator OS.mac? ? 'Command+O' : 'Control+O'
3211
+
3212
+ on('command') do
3213
+ message_box(parent: r, title: 'Open', message: 'Opening File...')
3214
+ end
3215
+ }
3216
+
3217
+ menu(label: 'Open Recent', underline: 5) {
3218
+ menu_item(label: 'File 1') {
3219
+ on('command') do
3220
+ message_box(parent: r, title: 'File 1', message: 'File 1 Contents')
3221
+ end
3222
+ }
3223
+
3224
+ menu_item(label: 'File 2') {
3225
+ on('command') do
3226
+ message_box(parent: r, title: 'File 2', message: 'File 2 Contents')
3227
+ end
3228
+ }
3229
+ }
3230
+
3231
+ menu_item(:separator)
3232
+
3233
+ menu_item(label: 'Exit', underline: 1) {
3234
+ on('command') do
3235
+ exit(0)
3236
+ end
3237
+ }
3238
+ }
3239
+
3240
+ menu(label: 'Edit', underline: 0) {
3241
+ menu_item(label: 'Cut', underline: 2) {
3242
+ accelerator OS.mac? ? 'Command+X' : 'Control+X'
3243
+ }
3244
+
3245
+ menu_item(label: 'Copy', underline: 0) {
3246
+ accelerator OS.mac? ? 'Command+C' : 'Control+C'
3247
+ }
3248
+
3249
+ menu_item(label: 'Paste', underline: 0) {
3250
+ accelerator OS.mac? ? 'Command+V' : 'Control+V'
3251
+ }
3252
+ }
3253
+
3254
+ menu(label: 'Options', underline: 0) {
3255
+ menu_item(:checkbutton, label: 'Enabled', underline: 0) {
3256
+ on('command') do
3257
+ @select_one_menu.children.each { |menu_item| menu_item.state = menu_item.state == 'disabled' ? 'normal' : 'disabled' }
3258
+ @select_multiple_menu.children.each { |menu_item| menu_item.state = menu_item.state == 'disabled' ? 'normal' : 'disabled' }
3259
+ end
3260
+ }
3261
+
3262
+ @select_one_menu = menu(label: 'Select One', underline: 7) {
3263
+ menu_item(:radiobutton, label: 'Option 1') {
3264
+ state 'disabled'
3265
+ }
3266
+ menu_item(:radiobutton, label: 'Option 2') {
3267
+ state 'disabled'
3268
+ }
3269
+ menu_item(:radiobutton, label: 'Option 3') {
3270
+ state 'disabled'
3271
+ }
3272
+ }
3273
+
3274
+ @select_multiple_menu = menu(label: 'Select Multiple', underline: 7) {
3275
+ menu_item(:checkbutton, label: 'Option 4') {
3276
+ state 'disabled'
3277
+ }
3278
+ menu_item(:checkbutton, label: 'Option 5') {
3279
+ state 'disabled'
3280
+ }
3281
+ menu_item(:checkbutton, label: 'Option 6') {
3282
+ state 'disabled'
3283
+ }
3284
+ }
3285
+ }
3286
+
3287
+ menu(label: 'Language', underline: 3) {
3288
+ ['denmark', 'finland', 'france', 'germany', 'italy', 'mexico', 'netherlands', 'norway', 'usa'].each do |image_name|
3289
+ menu_item(:radiobutton, label: image_name.capitalize) {
3290
+ selection image_name == 'usa'
3291
+ image File.expand_path("images/#{image_name}.png", __dir__)
3292
+ }
3293
+ end
3294
+ }
3295
+
3296
+ menu(label: 'Country', underline: 3) {
3297
+ ['denmark', 'finland', 'france', 'germany', 'italy', 'mexico', 'netherlands', 'norway', 'usa'].each do |image_name|
3298
+ menu_item(:radiobutton, label: image_name.capitalize) {
3299
+ selection image_name == 'usa'
3300
+ image File.expand_path("images/#{image_name}.png", __dir__)
3301
+ compound 'left'
3302
+ }
3303
+ end
3304
+ }
3305
+
3306
+ menu(label: 'Format', underline: 0) {
3307
+ menu(label: 'Background Color', underline: 0) {
3308
+ COLORS.each { |color_style|
3309
+ menu_item(:radiobutton, label: color_style.to_s.split('_').map(&:capitalize).join(' ')) {
3310
+ on('command') do
3311
+ @label.background = color_style
3312
+ end
3313
+ }
3314
+ }
3315
+ }
3316
+
3317
+ menu(label: 'Foreground Color', underline: 11) {
3318
+ COLORS.each { |color_style|
3319
+ menu_item(:radiobutton, label: color_style.to_s.split('_').map(&:capitalize).join(' ')) {
3320
+ on('command') do
3321
+ @label.foreground = color_style
3322
+ end
3323
+ }
3324
+ }
3325
+ }
3326
+ }
3327
+
3328
+ menu(label: 'View', underline: 0) {
3329
+ menu_item(:radiobutton, label: 'Small', underline: 0) {
3330
+ accelerator OS.mac? ? 'Command+S' : 'Control+S'
3331
+
3332
+ on('command') do
3333
+ @label.font = {size: 25}
3334
+ end
3335
+ }
3336
+
3337
+ menu_item(:radiobutton, label: 'Medium', underline: 0) {
3338
+ accelerator OS.mac? ? 'Command+M' : 'Control+M'
3339
+ selection true
3340
+
3341
+ on('command') do
3342
+ @label.font = {size: 50}
3343
+ end
3344
+ }
3345
+
3346
+ menu_item(:radiobutton, label: 'Large', underline: 0) {
3347
+ accelerator OS.mac? ? 'Command+L' : 'Control+L'
3348
+
3349
+ on('command') do
3350
+ @label.font = {size: 75}
3351
+ end
3352
+ }
3353
+ }
3354
+
3355
+ # Mac-specific window menu (containing zooming/resizing menu items)
3356
+ menu(label: 'Window', underline: 0) if OS.mac?
3357
+
3358
+ menu(label: 'Help', underline: 0) {
3359
+ if OS.mac?
3360
+ menu_item(:help) {
3361
+ on('command') do
3362
+ message_box(parent: r, title: 'Help', message: 'Help for my application.')
3363
+ end
3364
+ }
3365
+ end
3366
+
3367
+ menu_item(label: 'Manual', underline: 0) {
3368
+ accelerator OS.mac? ? 'Command+Shift+M' : 'Control+U'
3369
+
3370
+ on('command') do
3371
+ message_box(parent: r, title: 'Manual', message: 'Manual Contents')
3372
+ end
3373
+ }
3374
+
3375
+ menu_item(label: 'Tutorial', underline: 0) {
3376
+ accelerator OS.mac? ? 'Command+Shift+T' : 'Control+T'
3377
+
3378
+ on('command') do
3379
+ message_box(parent: r, title: 'Tutorial', message: 'Tutorial Contents')
3380
+ end
3381
+ }
3382
+
3383
+ menu_item(:separator)
3384
+
3385
+ menu_item(label: 'Report an Issue...', underline: 0) {
3386
+ on('command') do
3387
+ message_box(parent: r, title: 'Report an Issue', message: 'Reporting an issue...')
3388
+ end
3389
+ }
3390
+ }
3391
+ }
3392
+ }.open
3393
+ ```
3394
+
3395
+ Run with [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed:
3396
+
3397
+ ```
3398
+ ruby -r glimmer-dsl-tk -e "require 'samples/hello/hello_menu_bar'"
3399
+ ```
3400
+
3401
+ Alternatively, run from cloned project without [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed:
3402
+
3403
+ ```
3404
+ ruby -r ./lib/glimmer-dsl-tk.rb samples/hello/hello_menu_bar.rb
3405
+ ```
3406
+
3407
+ Glimmer app:
3408
+
3409
+ ![glimmer dsl tk screenshot sample hello menu-bar](images/glimmer-dsl-tk-screenshot-sample-hello-menu-bar.png)
3410
+
3411
+ ![glimmer dsl tk screenshot sample hello menu-bar](images/glimmer-dsl-tk-screenshot-sample-hello-menu-bar-application.png)
3412
+
3413
+ ![glimmer dsl tk screenshot sample hello menu-bar](images/glimmer-dsl-tk-screenshot-sample-hello-menu-bar-file.png)
3414
+
3415
+ ![glimmer dsl tk screenshot sample hello menu-bar](images/glimmer-dsl-tk-screenshot-sample-hello-menu-bar-edit.png)
3416
+
3417
+ ![glimmer dsl tk screenshot sample hello menu-bar](images/glimmer-dsl-tk-screenshot-sample-hello-menu-bar-options.png)
3418
+
3419
+ ![glimmer dsl tk screenshot sample hello menu-bar](images/glimmer-dsl-tk-screenshot-sample-hello-menu-bar-language.png)
3420
+
3421
+ ![glimmer dsl tk screenshot sample hello menu-bar](images/glimmer-dsl-tk-screenshot-sample-hello-menu-bar-language-name.png)
3422
+
3423
+ ![glimmer dsl tk screenshot sample hello menu-bar](images/glimmer-dsl-tk-screenshot-sample-hello-menu-bar-window.png)
3424
+
3425
+ ![glimmer dsl tk screenshot sample hello menu-bar](images/glimmer-dsl-tk-screenshot-sample-hello-menu-bar-format.png)
3426
+
3427
+ ![glimmer dsl tk screenshot sample hello menu-bar](images/glimmer-dsl-tk-screenshot-sample-hello-menu-bar-view.png)
3428
+
3429
+ ![glimmer dsl tk screenshot sample hello menu-bar](images/glimmer-dsl-tk-screenshot-sample-hello-menu-bar-help.png)
3430
+
2923
3431
  ## Applications
2924
3432
 
2925
3433
  ### Glimmer Tk Calculator
@@ -2938,9 +3446,17 @@ https://github.com/ancorgs/y3network-ruby-ui
2938
3446
 
2939
3447
  This is a Graphical User Interface for the famous [cryptopunks Ruby gem](https://github.com/cryptopunksnotdead/cryptopunks/tree/master/cryptopunks).
2940
3448
 
2941
- https://github.com/AndyObtiva/cryptopunks-gui
3449
+ https://github.com/cryptopunksnotdead/cryptopunks-gui
3450
+
3451
+ ![CryptoPunks GUI Screenshot](https://raw.githubusercontent.com/cryptopunksnotdead/cryptopunks-gui/master/screenshots/cryptopunks-gui-screenshot.png)
3452
+
3453
+ ### Circule
3454
+
3455
+ Generate an icon of overlapping circles derived from a hash.
3456
+
3457
+ https://gitlab.com/fjc/circule
2942
3458
 
2943
- ![CryptoPunks GUI Screenshot](https://raw.githubusercontent.com/AndyObtiva/cryptopunks-gui/master/screenshots/cryptopunks-gui-screenshot.png)
3459
+ [Demo Video](https://gitlab.com/fjc/circule/-/raw/master/circule-demo.mp4)
2944
3460
 
2945
3461
  ## Process
2946
3462
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.37
1
+ 0.0.41
Binary file