/src/wrappers/gtk/library/gtk_font_selection.e
Specman e | 118 lines | 59 code | 21 blank | 38 comment | 4 complexity | f485964656cf841b21206e0e63de39e1 MD5 | raw file
1indexing 2 description: "GtkFontSelection: A widget for selecting fonts." 3 copyright: "[ 4 Copyright (C) 2007 Paolo Redaelli, GTK+ team 5 6 This library is free software; you can redistribute it and/or 7 modify it under the terms of the GNU Lesser General Public License 8 as published by the Free Software Foundation; either version 2.1 of 9 the License, or (at your option) any later version. 10 11 This library is distributed in the hopeOA that it will be useful, but 12 WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 Lesser General Public License for more details. 15 16 You should have received a copy of the GNU Lesser General Public 17 License along with this library; if not, write to the Free Software 18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 19 02110-1301 USA 20 ]" 21 22 wrapped_version: "2.10.6" 23 24class GTK_FONT_SELECTION 25 -- The GtkFontSelection widget lists the available fonts, styles 26 -- and sizes, allowing the user to select a font. It is used in the 27 -- GtkFontSelectionDialog widget to provide a dialog box for 28 -- selecting fonts. 29 30 -- To set the font which is initially selected, use 31 -- `set_font_name'. 32 33 -- To get the selected font use `font_name'. 34 35 -- To change the text which is shown in the preview area, use 36 -- `set_preview_text'. 37 38inherit 39 GTK_VBOX 40 rename 41 make as make_vbox 42 undefine 43 struct_size 44 end 45 -- GtkFontSelection implements AtkImplementorIface. 46 47insert GTK_FONT_SELECTION_EXTERNALS 48 49creation make, from_external_pointer 50 51feature {} -- Creation 52 make is 53 -- Creates a new GtkFontSelection. 54 do 55 from_external_pointer(gtk_font_selection_new) 56 end 57 58feature 59 font_name: STRING is 60 -- The currently-selected font name. Note that this can be a 61 -- different string than what you set with `set_font_name', 62 -- as the font selection widget may normalize font names and 63 -- thus return a string with a different structure. For 64 -- example, "Helvetica Italic Bold 12" could be normalized to 65 -- "Helvetica Bold Italic 12". Use (TODO) 66 -- pango_font_description_equal() if you want to compare two 67 -- font 68 local ptr: POINTER 69 do 70 ptr:=gtk_font_selection_get_font_name(handle) 71 if ptr.is_not_null then 72 create Result.from_external(ptr) 73 -- Note: C documentation saya that 74 -- gtk_font_selection_get_font_name "returns a string with 75 -- the name of the current font, or NULL if no font is 76 -- selected. You must free this string with g_free()". We 77 -- isntead pass it under the Garbage Collector. 78 end 79 end 80 81 successfully_set: BOOLEAN 82 -- Has the last call to `set_font_name' been successful? 83 84 set_font_name (a_font_name: STRING) is 85 -- Sets the currently-selected font. Note that the font 86 -- selection widget needs to know the screen in which it will 87 -- appear for this to work; this can be guaranteed by simply 88 -- making sure that the widget is inserted in a toplevel 89 -- window before you call this function. 90 91 -- `a_fontname': a font name like "Helvetica 12" or "Times 92 -- Bold 18" 93 94 -- `successfully_set' will be True if the font could be set 95 -- successfully; False if no such font exists or if the 96 -- fontsel doesn't belong to a particular screen yet. 97 require name_not_void: a_font_name /= Void 98 do 99 successfully_set:=(gtk_font_selection_set_font_name 100 (handle, a_font_name.to_external).to_boolean) 101 end 102 103 preview_text: CONST_STRING is 104 -- the text displayed in the preview area. 105 do 106 create Result.from_external(gtk_font_selection_get_preview_text(handle)) 107 end 108 109 set_preview_text (a_text: STRING) is 110 -- Sets the text displayed in the preview area. 111 require text_not_void: a_text /= Void 112 do 113 gtk_font_selection_set_preview_text(handle, a_text.to_external) 114 end 115 116 -- GtkFontSelectionDialog a dialog box which uses GtkFontSelection. 117 118end -- class GTK_FONT_SELECTION