/* * Implementation of timeprefed.h. */ #include "timeprefed.h" TimePrefsEditor::TimePrefsEditor(int rows, int cols) : FullTextEditor(rows, cols, 8, Reversed, false, false, NoCaret) { /* * Normally, a TextEditor only listens to selected subset of events, not * including mouse exit and entry. Since we want to modify the cursor to * go of when we exit a TimePrefsEditor, we expand the set of events we * listen to. It would be more precise to expand only to the events we * actually need, but listening to all events is OK for now. */ Listen(allEvents); } void TimePrefsEditor::Handle(Event& e) { /* * Turn on the editing caret when the user does a left down. */ if ((e.eventType == DownEvent) and (e.button == LEFTMOUSE)) { CaretStyle(BarCaret); Update(); } /* * Turn off the editing caret whenever the user moves the mouse out of * this. */ if (e.eventType == LeaveEvent) { CaretStyle(NoCaret); Update(); } /* * Under any circumstances, let the parent editor do its thing too. */ FullTextEditor::Handle(e); } void TimePrefsEditor::HandleChar(char c) { /* * Call LocalHandleChar to do any specialized char handling. */ if (not LocalHandleChar(c)) FullTextEditor::HandleChar(c); } bool TimePrefsEditor::LocalHandleChar(char c) { switch (c) { case TABCHAR: HandleTab(); break; case RTNCHAR: HandleReturn(); break; } return true; } void TimePrefsEditor::HandleTab() { /* Do this. */ } void TimePrefsEditor::HandleReturn() { /* Do this. */ }