gtk_window_get_accel_group(), make accelerators work for dialogs,

make semi-public gtktextlayout.h and gtktextdisplay.h work without the
genuinely private text widget headers, don't install the private headers
This commit is contained in:
Havoc Pennington
2000-07-09 19:47:12 +00:00
parent cc0de72d97
commit 3a5915201e
14 changed files with 51 additions and 22 deletions

View File

@@ -182,16 +182,18 @@ gtk_public_h_sources = @STRIP_BEGIN@ \
# interface)
gtk_semipublic_h_sources = @STRIP_BEGIN@ \
gtktextbtree.h \
gtktextchild.h \
gtktextdisplay.h \
gtktextlayout.h \
gtktextsegment.h \
gtktexttypes.h \
@STRIP_END@
# GTK+ header files that don't get installed
gtk_private_h_sources = @STRIP_BEGIN@ \
gtktextbtree.h \
gtktextchild.h \
gtktextsegment.h \
gtktexttypes.h \
gtktextiterprivate.h \
gtktextmarkprivate.h \
@STRIP_END@
# GTK+ C sources to build the library from
gtk_c_sources = @STRIP_BEGIN@ \

View File

@@ -135,7 +135,7 @@ static gint
gtk_dialog_key_press (GtkWidget *widget,
GdkEventKey *key)
{
GdkEventAny event = { GDK_DELETE, widget->window, FALSE };
GdkEventAny event = { GDK_DELETE, widget->window, TRUE };
if (GTK_WIDGET_CLASS (parent_class)->key_press_event (widget, key))
return TRUE;
@@ -143,6 +143,7 @@ gtk_dialog_key_press (GtkWidget *widget,
if (key->keyval != GDK_Escape)
return FALSE;
/* Synthesize delete_event on key press. */
g_object_ref (G_OBJECT (event.window));
gtk_main_do_event ((GdkEvent*)&event);
@@ -299,7 +300,8 @@ gtk_dialog_add_button (GtkDialog *dialog,
g_return_if_fail (GTK_IS_DIALOG (dialog));
g_return_if_fail (button_text != NULL);
button = gtk_button_new_stock (button_text, NULL);
button = gtk_button_new_stock (button_text,
gtk_window_get_accel_group (GTK_WINDOW (dialog)));
gtk_widget_show (button);

View File

@@ -55,7 +55,7 @@ typedef enum
*/
typedef enum
{
/* GTK returns this if an response widget has no response_id,
/* GTK returns this if a response widget has no response_id,
or the dialog gets destroyed with no response */
GTK_RESPONSE_NONE = 0,
/* GTK won't return these unless you pass them in
@@ -119,8 +119,8 @@ void gtk_dialog_add_buttons (GtkDialog *dialog,
...);
/* Emit response signal */
void gtk_dialog_response (GtkDialog *dialog,
gint response_id);
void gtk_dialog_response (GtkDialog *dialog,
gint response_id);
/* Returns response_id */
gint gtk_dialog_run (GtkDialog *dialog);

View File

@@ -2622,8 +2622,6 @@ gtk_text_btree_first_could_contain_tag (GtkTextBTree *tree,
g_assert(node != NULL);
}
done:
g_assert(node != NULL); /* The tag summaries said some node had
tag toggles... */
@@ -3841,7 +3839,6 @@ gtk_text_line_next_could_contain_tag(GtkTextLine *line,
g_assert(node != NULL);
}
done:
g_assert(node != NULL);
g_assert(node->level == 0);

View File

@@ -163,8 +163,6 @@ GtkTextLine * gtk_text_btree_last_could_contain_tag (GtkTextBTree *
/* Chunk of data associated with a line; views can use this to store
info at the line. They should "subclass" the header struct here. */
typedef struct _GtkTextLineData GtkTextLineData;
struct _GtkTextLineData {
gpointer view_id;
GtkTextLineData *next;

View File

@@ -6,6 +6,7 @@ extern "C" {
#endif /* __cplusplus */
#include <gtk/gtktextiter.h>
#include <gtk/gtktextbtree.h>
GtkTextLineSegment *gtk_text_iter_get_indexable_segment(const GtkTextIter *iter);
GtkTextLineSegment *gtk_text_iter_get_any_segment(const GtkTextIter *iter);

View File

@@ -14,8 +14,12 @@ extern "C" {
#include <gtk/gtktextbuffer.h>
#include <gtk/gtktextiter.h>
#include <gtk/gtktextbtree.h>
/* forward declarations that have to be here to avoid including
* gtktextbtree.h
*/
typedef struct _GtkTextLine GtkTextLine;
typedef struct _GtkTextLineData GtkTextLineData;
#define GTK_TYPE_TEXT_LAYOUT (gtk_text_layout_get_type())
#define GTK_TEXT_LAYOUT(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_TEXT_LAYOUT, GtkTextLayout))
@@ -24,6 +28,7 @@ extern "C" {
#define GTK_IS_TEXT_LAYOUT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TEXT_LAYOUT))
#define GTK_TEXT_LAYOUT_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_TEXT_LAYOUT, GtkTextLayoutClass))
typedef struct _GtkTextLayout GtkTextLayout;
typedef struct _GtkTextLayoutClass GtkTextLayoutClass;
typedef struct _GtkTextLineDisplay GtkTextLineDisplay;
typedef struct _GtkTextCursorDisplay GtkTextCursorDisplay;

View File

@@ -6,7 +6,7 @@ extern "C" {
#endif /* __cplusplus */
#include <gtk/gtktexttypes.h>
#include <gtk/gtktextlayout.h>
#define GTK_IS_TEXT_MARK(mark) (((GtkTextLineSegment*)mark)->type == &gtk_text_left_mark_type || \
((GtkTextLineSegment*)mark)->type == &gtk_text_right_mark_type)

View File

@@ -10,7 +10,6 @@ extern "C" {
#include <gtk/gtktextbuffer.h>
#include <gtk/gtktexttagprivate.h>
typedef struct _GtkTextLine GtkTextLine;
typedef struct _GtkTextCounter GtkTextCounter;
typedef struct _GtkTextLineSegment GtkTextLineSegment;
typedef struct _GtkTextLineSegmentClass GtkTextLineSegmentClass;
@@ -19,7 +18,6 @@ typedef struct _GtkTextViewSearch GtkTextViewSearch;
typedef struct _GtkTextTab GtkTextTab;
typedef struct _GtkTextViewStyle GtkTextViewStyle;
typedef struct _GtkTextMarkBody GtkTextMarkBody;
typedef struct _GtkTextLayout GtkTextLayout;
/*
* Search

View File

@@ -57,6 +57,7 @@
#include "gtktextview.h"
#include "gtkimmulticontext.h"
#include "gdk/gdkkeysyms.h"
#include "gtktexttypes.h"
#include <string.h>
enum {

View File

@@ -534,6 +534,29 @@ gtk_window_remove_accel_group (GtkWindow *window,
gtk_accel_group_detach (accel_group, GTK_OBJECT (window));
}
GtkAccelGroup*
gtk_window_get_accel_group (GtkWindow *window)
{
GtkAccelGroup *group;
g_return_val_if_fail (GTK_IS_WINDOW (window), NULL);
group = gtk_object_get_data (GTK_OBJECT (window),
"__gtk_accel_group");
if (group == NULL)
{
group = gtk_accel_group_new ();
gtk_window_add_accel_group (window, group);
gtk_object_set_data (GTK_OBJECT (window),
"__gtk_accel_group",
group);
gtk_accel_group_unref (group);
}
return group;
}
void
gtk_window_set_position (GtkWindow *window,
GtkWindowPosition position)

View File

@@ -135,6 +135,8 @@ void gtk_window_set_modal (GtkWindow *window,
gboolean modal);
GList* gtk_window_list_toplevels (void);
/* Get the "built-in" accel group (convenience thing) */
GtkAccelGroup* gtk_window_get_accel_group (GtkWindow *window);
/* --- internal functions --- */
void gtk_window_set_focus (GtkWindow *window,

View File

@@ -934,8 +934,8 @@ do_search (gpointer callback_data,
dialog = gtk_dialog_new_with_buttons ("Search",
GTK_WINDOW (view->window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_BUTTON_OK,
0, NULL);
GTK_STOCK_BUTTON_CLOSE,
GTK_RESPONSE_NONE, NULL);
buffer = gtk_text_buffer_new (NULL);

View File

@@ -934,8 +934,8 @@ do_search (gpointer callback_data,
dialog = gtk_dialog_new_with_buttons ("Search",
GTK_WINDOW (view->window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_BUTTON_OK,
0, NULL);
GTK_STOCK_BUTTON_CLOSE,
GTK_RESPONSE_NONE, NULL);
buffer = gtk_text_buffer_new (NULL);