From 23649e8d87bf2c1d8c93fa0c4a6502285b258429 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 3 Aug 2017 22:50:01 +0200 Subject: GRAPHICS: MACGUI: Initial code for copying selection to clipboard --- graphics/macgui/mactextwindow.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'graphics/macgui/mactextwindow.cpp') diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp index 9d1de2f129..fb75f41cc5 100644 --- a/graphics/macgui/mactextwindow.cpp +++ b/graphics/macgui/mactextwindow.cpp @@ -212,6 +212,20 @@ void MacTextWindow::drawSelection() { } } +Common::String MacTextWindow::getSelection(bool formatted) { + if (_selectedText.endY == -1) + return Common::String(""); + + SelectedText s = _selectedText; + + if (s.startY > s.endY) { + SWAP(s.startRow, s.endRow); + SWAP(s.startCol, s.endCol); + } + + return _mactext->getTextChunk(s.startRow, s.startCol, s.endRow, s.endCol, formatted); +} + bool MacTextWindow::processEvent(Common::Event &event) { /*WindowClick click =*/ isInBorder(event.mouse.x, event.mouse.y); -- cgit v1.2.3