summaryrefslogtreecommitdiff
path: root/src/Fl_Input.cxx
diff options
context:
space:
mode:
authorManolo Gouy <Manolo>2012-12-24 11:45:07 +0000
committerManolo Gouy <Manolo>2012-12-24 11:45:07 +0000
commitcf672dba0db831679ba0cb5b9966a6dd1bbcb6e5 (patch)
treea01386823937540124aaf43c9f6237a0c4b1fc99 /src/Fl_Input.cxx
parent3c72b20458c943f650ddc071577b9876461d6389 (diff)
Mac OS text input: defined a small API that user-defined text editing widgets can use to signal marked text.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9774 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl_Input.cxx')
-rw-r--r--src/Fl_Input.cxx22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/Fl_Input.cxx b/src/Fl_Input.cxx
index 094912ea1..80d7cf955 100644
--- a/src/Fl_Input.cxx
+++ b/src/Fl_Input.cxx
@@ -358,6 +358,11 @@ int Fl_Input::handle_key() {
else replace(position(), del ? position()-del : mark(),
Fl::event_text(), Fl::event_length());
}
+#ifdef __APPLE__
+ if (Fl::marked_text_length()) {
+ this->mark( this->position() - Fl::marked_text_length() );
+ }
+#endif
return 1;
}
@@ -585,6 +590,14 @@ int Fl_Input::handle(int event) {
static int dnd_save_position, dnd_save_mark, drag_start = -1, newpos;
static Fl_Widget *dnd_save_focus;
switch (event) {
+#ifdef __APPLE__
+ case FL_UNFOCUS:
+ if (Fl::marked_text_length()) {
+ this->mark( this->position() );
+ Fl::reset_marked_text();
+ }
+ break;
+#endif
case FL_FOCUS:
switch (Fl::event_key()) {
case FL_Right:
@@ -799,6 +812,15 @@ Fl_Secret_Input::Fl_Secret_Input(int X,int Y,int W,int H,const char *l)
type(FL_SECRET_INPUT);
}
+int Fl_Secret_Input::handle(int event) {
+ int retval = Fl_Input::handle(event);
+#ifdef __APPLE__
+ if (event == FL_KEYBOARD && Fl::marked_text_length()) {
+ this->mark( this->position() ); // don't underline marked text
+ }
+#endif
+ return retval;
+}
//
// End of "$Id$".