~aleteoryx/tclircc

ref: 133ef83a37963e0684f69e86ddae35da29ba573c tclircc/uiMain.tcl -rw-r--r-- 937 bytes
133ef83aaleteoryx basic ui things a month ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/env tclsh

set path [file dirname [dict get [info frame 0] file]]

variable toplevel_count 0

package require logger
set log [logger::init tclircc::ui]

${log}::debug "loading tk"
package require Tk
wm withdraw .
# TODO: tray handling

proc mkToplevel {varname {takefocus 0}} {
  variable toplevel_count
  upvar $varname window
  set window .win$toplevel_count
  toplevel $window -takefocus $takefocus
  incr toplevel_count

  wm title $window "tclircc - $window"

  menu $window.menu
  menu $window.menu.me
  $window configure -menu "$window.menu"

  $window.menu add cascade -label "tclircc" -menu $window.menu.me
  $window.menu.me add command -label "About" -command {
    tk_messageBox -title "About tclircc" \
                  -message "tclircc v0.0.1" \
                  -detail "by Aleteoryx\nhttps://amehut.dev/~aleteoryx/tclircc\n\nThis software is in the public domain." \
                  -type ok }
}

mkToplevel _