Back to index

unity  6.0.0
Public Member Functions | Protected Member Functions | Private Member Functions
unity::IMTextEntry Class Reference

#include <IMTextEntry.h>

List of all members.

Public Member Functions

 IMTextEntry ()
bool im_preedit ()

Protected Member Functions

virtual void InsertText (std::string const &text)
virtual void CopyClipboard ()
virtual void PasteClipboard ()
virtual void PastePrimaryClipboard ()
void Paste (bool primary=false)

Private Member Functions

 NUX_DECLARE_OBJECT_TYPE (IMTextEntry, nux::TextEntry)

Detailed Description

Definition at line 30 of file IMTextEntry.h.


Constructor & Destructor Documentation

Definition at line 28 of file IMTextEntry.cpp.

: TextEntry("", NUX_TRACKER_LOCATION)
{}

Member Function Documentation

void unity::IMTextEntry::CopyClipboard ( ) [protected, virtual]

Definition at line 32 of file IMTextEntry.cpp.

{
  int start, end;

  if (GetSelectionBounds(&start, &end))
  {
    GtkClipboard* clip = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
    gtk_clipboard_set_text(clip, text_.c_str() + start, end - start);
  }
}

Definition at line 84 of file IMTextEntry.cpp.

{
  return !preedit_.empty();
}
void unity::IMTextEntry::InsertText ( std::string const &  text) [protected, virtual]

Definition at line 68 of file IMTextEntry.cpp.

{
  DeleteSelection();

  if (!text.empty())
  {
    std::string new_text(GetText());
    new_text.insert(cursor_, text);

    int cursor = cursor_;
    SetText(new_text.c_str());
    SetCursor(cursor + text.length());
    QueueRefresh(true, true);
  }
}

Here is the caller graph for this function:

unity::IMTextEntry::NUX_DECLARE_OBJECT_TYPE ( IMTextEntry  ,
nux::TextEntry   
) [private]
void unity::IMTextEntry::Paste ( bool  primary = false) [protected]

Definition at line 53 of file IMTextEntry.cpp.

{
  GdkAtom origin = primary ? GDK_SELECTION_PRIMARY : GDK_SELECTION_CLIPBOARD;
  GtkClipboard* clip = gtk_clipboard_get(origin);

  auto callback = [](GtkClipboard* clip, const char* text, gpointer user_data)
   {
     IMTextEntry* self = static_cast<IMTextEntry*>(user_data);
     if (text)
      self->InsertText(std::string(text));
   };

  gtk_clipboard_request_text(clip, callback, this);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void unity::IMTextEntry::PasteClipboard ( ) [protected, virtual]

Definition at line 43 of file IMTextEntry.cpp.

{
  Paste();
}

Here is the call graph for this function:

void unity::IMTextEntry::PastePrimaryClipboard ( ) [protected, virtual]

Definition at line 48 of file IMTextEntry.cpp.

{
  Paste(true);
}

Here is the call graph for this function:


The documentation for this class was generated from the following files: