Move jclipboard functions to gui::clipboard namespace.

This commit is contained in:
David Capello 2012-04-15 15:24:26 -03:00
parent 7d0bed8341
commit f2f6ba9fca
4 changed files with 16 additions and 8 deletions

View File

@ -6,6 +6,8 @@
#include "config.h"
#include "gui/clipboard.h"
#include <algorithm>
#include <string>
@ -23,7 +25,7 @@ static void lowlevel_set_clipboard_text(const char *text)
clipboard_text = text ? text: "";
}
const char* jclipboard_get_text()
const char* gui::clipboard::get_text()
{
#ifdef WIN32
if (IsClipboardFormatAvailable(CF_TEXT)) {
@ -44,7 +46,7 @@ const char* jclipboard_get_text()
return clipboard_text.c_str();
}
void jclipboard_set_text(const char *text)
void gui::clipboard::set_text(const char *text)
{
lowlevel_set_clipboard_text(text);

View File

@ -9,7 +9,13 @@
#include "gui/base.h"
const char* jclipboard_get_text();
void jclipboard_set_text(const char* text);
namespace gui {
namespace clipboard {
const char* get_text();
void set_text(const char* text);
} // namespace clipboard
} // namespace gui
#endif // ASE_JINETE_JCLIPBOARD_H

View File

@ -516,7 +516,7 @@ void Entry::executeCmd(EntryCmd::Type cmd, int ascii, bool shift_pressed)
// *cut* text!
if (cmd == EntryCmd::Cut) {
base::string buf = text.substr(selbeg, selend - selbeg + 1);
jclipboard_set_text(buf.c_str());
gui::clipboard::set_text(buf.c_str());
}
// remove text
@ -536,7 +536,7 @@ void Entry::executeCmd(EntryCmd::Type cmd, int ascii, bool shift_pressed)
case EntryCmd::Paste: {
const char *clipboard;
if ((clipboard = jclipboard_get_text())) {
if ((clipboard = gui::clipboard::get_text())) {
// delete the entire selection
if (selbeg >= 0) {
text.erase(selbeg, selend-selbeg+1);
@ -560,7 +560,7 @@ void Entry::executeCmd(EntryCmd::Type cmd, int ascii, bool shift_pressed)
case EntryCmd::Copy:
if (selbeg >= 0) {
base::string buf = text.substr(selbeg, selend - selbeg + 1);
jclipboard_set_text(buf.c_str());
gui::clipboard::set_text(buf.c_str());
}
break;

View File

@ -36,7 +36,7 @@ Jinete::~Jinete()
CurrentTheme::set(NULL);
// destroy clipboard
jclipboard_set_text(NULL);
gui::clipboard::set_text(NULL);
// shutdown system
_ji_widgets_exit();