- Home
- Products
- Integration
- Tutorial
- Barcode FAQ
- Purchase
- Company
THE TEXT VIEW WIDGET in Font
CHAPTER 7 THE TEXT VIEW WIDGET DataMatrix Generator In None Using Barcode printer for Font Control to generate, create DataMatrix image in Font applications. www.OnBarcode.comCode128 Drawer In None Using Barcode creator for Font Control to generate, create ANSI/AIM Code 128 image in Font applications. www.OnBarcode.com/* Add the name of the text g_object_set_data (G_OBJECT g_object_set_data (G_OBJECT g_object_set_data (G_OBJECT g_object_set_data (G_OBJECT Barcode Drawer In None Using Barcode maker for Font Control to generate, create Barcode image in Font applications. www.OnBarcode.comMaking EAN / UCC - 13 In None Using Barcode generation for Font Control to generate, create EAN 128 image in Font applications. www.OnBarcode.comtag as a data parameter of the object. */ (bold), "tag", "bold"); (italic), "tag", "italic"); (underline), "tag", "underline"); (strike), "tag", "strike"); Code39 Creator In None Using Barcode generation for Font Control to generate, create USS Code 39 image in Font applications. www.OnBarcode.comBarcode Generator In None Using Barcode generator for Font Control to generate, create Barcode image in Font applications. www.OnBarcode.com/* Connect each of the buttons and the combo box to the necessary signals. */ g_signal_connect (G_OBJECT (bold), "clicked", G_CALLBACK (format), (gpointer) textview); g_signal_connect (G_OBJECT (italic), "clicked", G_CALLBACK (format), (gpointer) textview); g_signal_connect (G_OBJECT (underline), "clicked", G_CALLBACK (format), (gpointer) textview); g_signal_connect (G_OBJECT (strike), "clicked", G_CALLBACK (format), (gpointer) textview); g_signal_connect (G_OBJECT (scale), "changed", G_CALLBACK (scale_changed), (gpointer) textview); g_signal_connect (G_OBJECT (clear), "clicked", G_CALLBACK (clear_clicked), (gpointer) textview); /* Pack the widgets into a GtkVBox, vbox = gtk_vbox_new (TRUE, 5); gtk_box_pack_start (GTK_BOX (vbox), gtk_box_pack_start (GTK_BOX (vbox), gtk_box_pack_start (GTK_BOX (vbox), gtk_box_pack_start (GTK_BOX (vbox), gtk_box_pack_start (GTK_BOX (vbox), gtk_box_pack_start (GTK_BOX (vbox), GtkHBox, and then into the window. */ bold, FALSE, FALSE, 0); italic, FALSE, FALSE, 0); underline, FALSE, FALSE, 0); strike, FALSE, FALSE, 0); scale, FALSE, FALSE, 0); clear, FALSE, FALSE, 0); Encoding Data Matrix In None Using Barcode creation for Font Control to generate, create Data Matrix ECC200 image in Font applications. www.OnBarcode.comMaking ISBN In None Using Barcode generation for Font Control to generate, create Bookland EAN image in Font applications. www.OnBarcode.comscrolled_win = gtk_scrolled_window_new (NULL, NULL); gtk_container_add (GTK_CONTAINER (scrolled_win), textview); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS); hbox = gtk_hbox_new (FALSE, 5); gtk_box_pack_start (GTK_BOX (hbox), scrolled_win, TRUE, TRUE, 0); gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, TRUE, 0); gtk_container_add (GTK_CONTAINER (window), hbox); gtk_widget_show_all (window); Encode DataMatrix In Visual Basic .NET Using Barcode maker for .NET framework Control to generate, create ECC200 image in .NET framework applications. www.OnBarcode.comPrinting Data Matrix In None Using Barcode creation for Office Excel Control to generate, create DataMatrix image in Microsoft Excel applications. www.OnBarcode.comCHAPTER 7 THE TEXT VIEW WIDGET
Paint Code 128 Code Set C In C# Using Barcode drawer for Visual Studio .NET Control to generate, create Code 128 Code Set A image in VS .NET applications. www.OnBarcode.comMaking UCC - 12 In Visual C#.NET Using Barcode generator for VS .NET Control to generate, create GS1 128 image in .NET framework applications. www.OnBarcode.comgtk_main(); return 0; } /* Retrieve the tag from the "tag" object data and apply it to the selection. */ static void format (GtkWidget *widget, GtkTextView *textview) { GtkTextIter start, end; GtkTextBuffer *buffer; gchar *tagname; tagname = (gchar*) g_object_get_data (G_OBJECT (widget), "tag"); buffer = gtk_text_view_get_buffer (textview); gtk_text_buffer_get_selection_bounds (buffer, &start, &end); gtk_text_buffer_apply_tag_by_name (buffer, tagname, &start, &end); } /* Apply the selected text size property as the tag. */ static void scale_changed (GtkComboBox *combo, GtkTextView *textview) { const gchar *text; if (gtk_combo_box_get_active (combo) == -1) return; text = gtk_combo_box_get_active_text (combo); g_object_set_data (G_OBJECT (combo), "tag", (gpointer) text); format (GTK_WIDGET (combo), textview); gtk_combo_box_set_active (combo, -1); } /* Remove all of the tags from the selected text. */ static void clear_clicked (GtkButton *button, GtkTextView *textview) { GtkTextIter start, end; GtkTextBuffer *buffer; EAN / UCC - 14 Printer In Java Using Barcode encoder for BIRT reports Control to generate, create GS1-128 image in Eclipse BIRT applications. www.OnBarcode.comEuropean Article Number 13 Decoder In None Using Barcode scanner for Software Control to read, scan read, scan image in Software applications. www.OnBarcode.comCHAPTER 7 THE TEXT VIEW WIDGET
EAN-13 Generation In Java Using Barcode generator for Java Control to generate, create EAN-13 image in Java applications. www.OnBarcode.comUPC Code Printer In Objective-C Using Barcode encoder for iPhone Control to generate, create UPC Code image in iPhone applications. www.OnBarcode.combuffer = gtk_text_view_get_buffer (textview); gtk_text_buffer_get_selection_bounds (buffer, &start, &end); gtk_text_buffer_remove_all_tags (buffer, &start, &end); } When you create a text tag, you normally have to add it to a GtkTextBuffer s tag table, an object that holds all of the tags available to a text buffer. You can create a new GtkTextTag object with gtk_text_tag_new() and then add it to the tag table. However, you can do this all in one step with gtk_text_buffer_create_tag(). GtkTextTag* gtk_text_buffer_create_tag (GtkTextBuffer *buffer, const gchar *tag_name, const gchar *first_property_name, ...); The first two parameters of the function allow you to specify the text buffer to whose tag table the GtkTextTag will be added and a name to give the text tag. This name can be used to reference a tag for which you do not have the GtkTextTag object anymore. The next set of parameters is a NULL-terminated list of GtkTextTag style properties and their values. For example, if you wanted to create a text tag that sets the background and foreground colors as black and white respectively, you could use the following function. This function returns the text tag that was created, although it will have already been added to the text buffer s tag table. tag = gtk_text_buffer_create_tag (buffer, "colors", "background", "#000000", "foreground", "#FFFFFF", NULL); There are a large number of style properties available in GTK+. A full list of GtkTextTag styles is shown in Appendix C. The table shows the name of each property, a short description of its use, and what type of value it accepts. Once you have created a text tag and added it to a GtkTextBuffer s tag table, you can apply it to ranges of text. In Listing 7-7, the tag is applied to selected text when a button is clicked. If there is no selected text, the cursor position will be set to the style. All text typed at that position would have the tag applied as well. Tags are generally applied to text with gtk_text_buffer_apply_tag_by_name(). The tag is applied to the text between the start and end iterators. If you still have access to the GtkTextTag object, you can also apply a tag with gtk_text_buffer_apply_tag(). void gtk_text_buffer_apply_tag_by_name (GtkTextBuffer *buffer, const gchar *tag_name, const GtkTextIter *start, const GtkTextIter *end); Code 128 Code Set B Reader In Visual Basic .NET Using Barcode reader for .NET Control to read, scan read, scan image in VS .NET applications. www.OnBarcode.comScanning Code 39 Full ASCII In VS .NET Using Barcode scanner for .NET framework Control to read, scan read, scan image in VS .NET applications. www.OnBarcode.comRead USS Code 39 In None Using Barcode scanner for Software Control to read, scan read, scan image in Software applications. www.OnBarcode.comBarcode Maker In .NET Framework Using Barcode generation for ASP.NET Control to generate, create Barcode image in ASP.NET applications. www.OnBarcode.com |
|