entry: Delegate to GtkText

Use a GtkText child, and delegate the editable functionality
to it. Also forward all the properties that are provided by
GtkText.

Some of the more internal APIs, such as layout and im context
access and caps-lock warning, are removed here, but we preserve
most of the plain GtkEntry API by forwarding it to the GtkText
child.
This commit is contained in:
Matthias Clasen 2019-02-16 00:50:40 -05:00
parent 936181f354
commit 45fb1d06e3
4 changed files with 165 additions and 6082 deletions

View File

@ -942,10 +942,6 @@ gtk_entry_set_placeholder_text
gtk_entry_get_placeholder_text gtk_entry_get_placeholder_text
gtk_entry_set_overwrite_mode gtk_entry_set_overwrite_mode
gtk_entry_get_overwrite_mode gtk_entry_get_overwrite_mode
gtk_entry_get_layout
gtk_entry_get_layout_offsets
gtk_entry_layout_index_to_text_index
gtk_entry_text_index_to_layout_index
gtk_entry_set_attributes gtk_entry_set_attributes
gtk_entry_get_attributes gtk_entry_get_attributes
gtk_entry_set_completion gtk_entry_set_completion
@ -955,7 +951,6 @@ gtk_entry_get_progress_fraction
gtk_entry_set_progress_pulse_step gtk_entry_set_progress_pulse_step
gtk_entry_get_progress_pulse_step gtk_entry_get_progress_pulse_step
gtk_entry_progress_pulse gtk_entry_progress_pulse
gtk_entry_im_context_filter_keypress
gtk_entry_reset_im_context gtk_entry_reset_im_context
gtk_entry_set_tabs gtk_entry_set_tabs
gtk_entry_get_tabs gtk_entry_get_tabs

File diff suppressed because it is too large Load Diff

View File

@ -115,28 +115,9 @@ struct _GtkEntryClass
{ {
GtkWidgetClass parent_class; GtkWidgetClass parent_class;
/* Hook to customize right-click popup */
void (* populate_popup) (GtkEntry *entry,
GtkWidget *popup);
/* Action signals /* Action signals
*/ */
void (* activate) (GtkEntry *entry); void (* activate) (GtkEntry *entry);
void (* move_cursor) (GtkEntry *entry,
GtkMovementStep step,
gint count,
gboolean extend_selection);
void (* insert_at_cursor) (GtkEntry *entry,
const gchar *str);
void (* delete_from_cursor) (GtkEntry *entry,
GtkDeleteType type,
gint count);
void (* backspace) (GtkEntry *entry);
void (* cut_clipboard) (GtkEntry *entry);
void (* copy_clipboard) (GtkEntry *entry);
void (* paste_clipboard) (GtkEntry *entry);
void (* toggle_overwrite) (GtkEntry *entry);
void (* insert_emoji) (GtkEntry *entry);
/*< private >*/ /*< private >*/
@ -224,12 +205,6 @@ void gtk_entry_set_text (GtkEntry *entry,
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
const gchar* gtk_entry_get_text (GtkEntry *entry); const gchar* gtk_entry_get_text (GtkEntry *entry);
GDK_AVAILABLE_IN_ALL
PangoLayout* gtk_entry_get_layout (GtkEntry *entry);
GDK_AVAILABLE_IN_ALL
void gtk_entry_get_layout_offsets (GtkEntry *entry,
gint *x,
gint *y);
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
void gtk_entry_set_alignment (GtkEntry *entry, void gtk_entry_set_alignment (GtkEntry *entry,
gfloat xalign); gfloat xalign);
@ -242,13 +217,6 @@ void gtk_entry_set_completion (GtkEntry *entry,
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
GtkEntryCompletion *gtk_entry_get_completion (GtkEntry *entry); GtkEntryCompletion *gtk_entry_get_completion (GtkEntry *entry);
GDK_AVAILABLE_IN_ALL
gint gtk_entry_layout_index_to_text_index (GtkEntry *entry,
gint layout_index);
GDK_AVAILABLE_IN_ALL
gint gtk_entry_text_index_to_layout_index (GtkEntry *entry,
gint text_index);
/* Progress API /* Progress API
*/ */
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
@ -341,9 +309,6 @@ void gtk_entry_get_icon_area (GtkEntry *
GdkRectangle *icon_area); GdkRectangle *icon_area);
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
gboolean gtk_entry_im_context_filter_keypress (GtkEntry *entry,
GdkEventKey *event);
GDK_AVAILABLE_IN_ALL
void gtk_entry_reset_im_context (GtkEntry *entry); void gtk_entry_reset_im_context (GtkEntry *entry);
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL

View File

@ -26,6 +26,7 @@
#include "gtktreemodelfilter.h" #include "gtktreemodelfilter.h"
#include "gtktreeviewcolumn.h" #include "gtktreeviewcolumn.h"
#include "gtkeventcontrollerkey.h" #include "gtkeventcontrollerkey.h"
#include "gtktextprivate.h"
G_BEGIN_DECLS G_BEGIN_DECLS
@ -84,17 +85,12 @@ void _gtk_entry_completion_connect (GtkEntryCompletion *completion,
GtkEntry *entry); GtkEntry *entry);
void _gtk_entry_completion_disconnect (GtkEntryCompletion *completion); void _gtk_entry_completion_disconnect (GtkEntryCompletion *completion);
gchar* _gtk_entry_get_display_text (GtkEntry *entry,
gint start_pos,
gint end_pos);
GtkIMContext* _gtk_entry_get_im_context (GtkEntry *entry); GtkIMContext* _gtk_entry_get_im_context (GtkEntry *entry);
void gtk_entry_enter_text (GtkEntry *entry, void gtk_entry_enter_text (GtkEntry *entry,
const char *text); const char *text);
void gtk_entry_set_positions (GtkEntry *entry,
int current_pos,
int selection_bound);
GtkEventController * gtk_entry_get_key_controller (GtkEntry *entry); GtkEventController * gtk_entry_get_key_controller (GtkEntry *entry);
GtkText *gtk_entry_get_text_widget (GtkEntry *entry);
G_END_DECLS G_END_DECLS