本文整理汇总了C++中GetEditable函数的典型用法代码示例。如果您正苦于以下问题:C++ GetEditable函数的具体用法?C++ GetEditable怎么用?C++ GetEditable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetEditable函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: gtk_editable_select_region
void wxTextEntry::SetSelection(long from, long to)
{
// in wx convention, (-1, -1) means the entire range but GTK+ translates -1
// (or any negative number for that matter) into last position so we need
// to translate manually
if ( from == -1 && to == -1 )
from = 0;
// for compatibility with MSW, exchange from and to parameters so that the
// insertion point is set to the start of the selection and not its end as
// GTK+ does by default
gtk_editable_select_region(GetEditable(), to, from);
#ifndef __WXGTK3__
// avoid reported problem with RHEL 5 GTK+ 2.10 where selection is reset by
// a clipboard callback, see #13277
if (gtk_check_version(2,12,0))
{
GtkEntry* entry = GTK_ENTRY(GetEditable());
if (to < 0)
to = entry->text_length;
entry->selection_bound = to;
}
#endif
}
示例2: GetEditable
bool GroupCell::SetEditableContent(wxString text)
{
if (GetEditable()) {
GetEditable()->SetValue(text);
return true;
}
else
return false;
}
示例3: DoAutoCompleteStrings
bool wxTextEntry::DoAutoCompleteStrings(const wxArrayString& choices)
{
GtkEntry* const entry = (GtkEntry*)GetEditable();
wxCHECK_MSG(GTK_IS_ENTRY(entry), false, "auto completion doesn't work with this control");
GtkListStore * const store = gtk_list_store_new(1, G_TYPE_STRING);
GtkTreeIter iter;
#if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */
# pragma ivdep
# pragma swp
# pragma unroll
# pragma prefetch
# if 0
# pragma simd noassert
# endif
#endif /* VDM auto patch */
for ( wxArrayString::const_iterator i = choices.begin();
i != choices.end();
++i )
{
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter,
0, (const gchar *)i->utf8_str(),
-1);
}
GtkEntryCompletion * const completion = gtk_entry_completion_new();
gtk_entry_completion_set_model(completion, GTK_TREE_MODEL(store));
gtk_entry_completion_set_text_column(completion, 0);
gtk_entry_set_completion(entry, completion);
g_object_unref(completion);
return true;
}
示例4: GetEditable
void wxTextEntry::WriteText(const wxString& value)
{
GtkEditable * const edit = GetEditable();
// remove the selection if there is one and suppress the text change event
// generated by this: we only want to generate one event for this change,
// not two
{
EventsSuppressor noevents(this);
gtk_editable_delete_selection(edit);
}
// insert new text at the cursor position
gint len = gtk_editable_get_position(edit);
gtk_editable_insert_text
(
edit,
wxGTK_CONV_FONT(value, GetEditableWindow()->GetFont()),
-1, // text: length: compute it using strlen()
&len // will be updated to position after the text end
);
// and move cursor to the end of new text
gtk_editable_set_position(edit, len);
}
示例5: GetSelection
void wxTextEntry::GetSelection(long *from, long *to) const
{
gint start, end;
if ( gtk_editable_get_selection_bounds(GetEditable(), &start, &end) )
{
// the output must always be in order, although in GTK+ it isn't
if ( start > end )
{
gint tmp = start;
start = end;
end = tmp;
}
}
else // no selection
{
// for compatibility with MSW return the empty selection at cursor
start =
end = GetInsertionPoint();
}
if ( from )
*from = start;
if ( to )
*to = end;
}
示例6: DoAutoCompleteStrings
bool wxTextEntry::DoAutoCompleteStrings(const wxArrayString& choices)
{
GtkEntry* const entry = (GtkEntry*)GetEditable();
wxCHECK_MSG(GTK_IS_ENTRY(entry), false, "auto completion doesn't work with this control");
GtkListStore * const store = gtk_list_store_new(1, G_TYPE_STRING);
GtkTreeIter iter;
for ( wxArrayString::const_iterator i = choices.begin();
i != choices.end();
++i )
{
gtk_list_store_append(store, &iter);
gtk_list_store_set(store, &iter,
0, (const gchar *)i->utf8_str(),
-1);
}
GtkEntryCompletion * const completion = gtk_entry_completion_new();
gtk_entry_completion_set_model(completion, GTK_TREE_MODEL(store));
gtk_entry_completion_set_text_column(completion, 0);
gtk_entry_set_completion(entry, completion);
g_object_unref(completion);
return true;
}
示例7: value
wxString wxTextEntry::DoGetValue() const
{
const wxGtkString value(gtk_editable_get_chars(GetEditable(), 0, -1));
return wxGTK_CONV_BACK_FONT(value,
const_cast<wxTextEntry *>(this)->GetEditableWindow()->GetFont());
}
示例8: GTK_ENTRY
long wxTextEntry::GetLastPosition() const
{
// this can't be implemented for arbitrary GtkEditable so only do it for
// GtkEntries
GtkEntry * const entry = GTK_ENTRY(GetEditable());
return entry ? entry->text_length : - 1;
}
示例9: SetMaxLength
void wxTextEntry::SetMaxLength(unsigned long len)
{
GtkEntry* const entry = (GtkEntry*)GetEditable();
if (!GTK_IS_ENTRY(entry))
return;
gtk_entry_set_max_length(entry, len);
}
示例10: DestroyOutput
void GroupCell::RemoveOutput()
{
DestroyOutput();
ResetSize();
m_height = GetEditable()->GetHeight();
m_output = NULL;
m_lastInOutput = NULL;
m_appendedCells = NULL;
m_hide = false;
}
示例11: GetLastPosition
long wxTextEntry::GetLastPosition() const
{
// this can't be implemented for arbitrary GtkEditable so only do it for
// GtkEntries
long pos = -1;
GtkEntry* entry = (GtkEntry*)GetEditable();
if (GTK_IS_ENTRY(entry))
pos = gtk_entry_get_text_length(entry);
return pos;
}
示例12: gtk_editable_select_region
void wxTextEntry::SetSelection(long from, long to)
{
// in wx convention, (-1, -1) means the entire range but GTK+ translates -1
// (or any negative number for that matter) into last position so we need
// to translate manually
if ( from == -1 && to == -1 )
from = 0;
// for compatibility with MSW, exchange from and to parameters so that the
// insertion point is set to the start of the selection and not its end as
// GTK+ does by default
gtk_editable_select_region(GetEditable(), to, from);
}
示例13: GetEditable
void GroupCell::Hide(bool hide) {
if (IsFoldable())
return;
if (m_hide == hide)
return;
else
{
if (m_hide == false) {
if ((m_groupType == GC_TYPE_TEXT) || (m_groupType == GC_TYPE_CODE))
GetEditable()->SetFirstLineOnly(true);
m_hide = true;
}
else {
if ((m_groupType == GC_TYPE_TEXT) || (m_groupType == GC_TYPE_CODE))
GetEditable()->SetFirstLineOnly(false);
m_hide = false;
}
ResetSize();
GetEditable()->ResetSize();
}
}
示例14: ToString
wxString GroupCell::ToString()
{
wxString str;
if (GetEditable()) {
str = m_input->ListToString();
if (m_output != NULL && !m_hide) {
MathCell *tmp = m_output;
while (tmp != NULL) {
if (tmp->ForceBreakLineHere() && str.Length()>0)
str += wxT("\n");
str += tmp->ToString();
tmp = tmp->m_nextToDraw;
}
}
}
return str;
}
示例15: gtk_editable_set_position
void wxTextEntry::SetInsertionPoint(long pos)
{
gtk_editable_set_position(GetEditable(), pos);
}