summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorKevin Walzer <kw@codebykevin.com>2018-03-07 13:49:31 (GMT)
committerKevin Walzer <kw@codebykevin.com>2018-03-07 13:49:31 (GMT)
commit0c434d6e5c4870f202f5ebd8b3711159d4d577db (patch)
tree5aa26b17b0678e70def2e59cf12cc40a891dd706 /library
parent659f7071997ade9b977ca0a28e57b1f947208f3b (diff)
downloadtk-0c434d6e5c4870f202f5ebd8b3711159d4d577db.zip
tk-0c434d6e5c4870f202f5ebd8b3711159d4d577db.tar.gz
tk-0c434d6e5c4870f202f5ebd8b3711159d4d577db.tar.bz2
Flesh out implementation
Diffstat (limited to 'library')
-rw-r--r--library/entry.tcl12
-rw-r--r--library/text.tcl2
-rw-r--r--library/tk.tcl15
-rw-r--r--library/ttk/entry.tcl3
4 files changed, 29 insertions, 3 deletions
diff --git a/library/entry.tcl b/library/entry.tcl
index 780fcb2..3819832 100644
--- a/library/entry.tcl
+++ b/library/entry.tcl
@@ -75,6 +75,7 @@ bind Entry <<TraverseIn>> {
# Standard Motif bindings:
bind Entry <1> {
+ tk::RegisterServiceWidget %W
tk::EntryButton1 %W %x
%W selection clear
}
@@ -657,7 +658,7 @@ proc ::tk::EntryGetSelection {w} {
}
-if {[tk windowingsystem] eq "aqua"]{
+if {[tk windowingsystem] eq "aqua"} {
# ::tk::CheckEntrySelection --
#
# Writes selected text to the clipboard on macOS.
@@ -671,4 +672,13 @@ proc ::tk::CheckEntrySelection {w} {
clipboard append [::tk::EntryGetSelection $w]
}
}
+
}
+
+
+
+
+
+
+
+
diff --git a/library/text.tcl b/library/text.tcl
index c76153c..6c4c0f6 100644
--- a/library/text.tcl
+++ b/library/text.tcl
@@ -43,6 +43,7 @@
bind Text <1> {
tk::TextButton1 %W %x %y
%W tag remove sel 0.0 end
+ ::tk::RegisterServiceWidget %W
}
bind Text <B1-Motion> {
set tk::Priv(x) %x
@@ -400,7 +401,6 @@ bind Text <<Selection>> {
set selected [%W get sel.first sel.last]
clipboard append $selected
}
-
# End of Mac only bindings
}
diff --git a/library/tk.tcl b/library/tk.tcl
index d2f7b65..bda847d 100644
--- a/library/tk.tcl
+++ b/library/tk.tcl
@@ -682,6 +682,21 @@ if {[tk windowingsystem] eq "aqua"} {
namespace eval ::tk::mac {
set useCustomMDEF 0
}
+
+ #stub proc for NSServices API, must be replaced with custom implementation
+ proc ::tk::mac::PerformService {args} {
+
+ tk_messageBox -icon info -title "Services Example" -message "This data was sent to Wish with the NSServices API:\n\n$args"
+ }
+}
+
+#register to send data to macOS Services
+
+proc ::tk::RegisterServiceWidget {w} {
+
+if {[tk windowingsytem] eq "aqua"} {
+ ::tk::mac::registerServiceWidget $w
+ }
}
# Run the Ttk themed widget set initialization
diff --git a/library/ttk/entry.tcl b/library/ttk/entry.tcl
index 7ac29e4..01ade97 100644
--- a/library/ttk/entry.tcl
+++ b/library/ttk/entry.tcl
@@ -348,6 +348,7 @@ proc ttk::entry::Press {w x} {
set State(x) $x
set State(selectMode) char
set State(anchor) [$w index insert]
+ ::tk::RegisterServiceWidget $w
}
## Shift-Press -- Shift-ButtonPress-1 binding.
@@ -607,7 +608,7 @@ proc ttk::entry::Delete {w} {
}
}
-if {[tk windowingsystem] eq "aqua"] {
+if {[tk windowingsystem] eq "aqua"} {
# ::ttk::CheckEntrySelection --
#
# Writes selected text to the clipboard on macOS.