Description
This widget provides a nice way for the user of your application to
select fonts.
It first searches on your system for the list of fonts available, and
displays a set of boxes to select them based on their name, their
weight, their size, etc.
This widget is provided in two forms, one widget that can be embedded
in any container, a
Gtk_Font_Selection, whereas the other one comes
directly in its own separate window (to be popped up as a dialog).
Some filters can be applied to the widget, when you want the user to
select only a font only among a specific subset (like bitmap or
true-type fonts for instance).
There are two kinds of filters: a base filter, set in your application
and that the user can not change; a user filter that can be modified
interactively by the user.
Subprograms
Font_Selection functions
-
procedure Gtk_New (Widget : out Gtk_Font_Selection);
procedure Initialize (Widget : access Gtk_Font_Selection_Record'Class);
-
-
function Set_Font_Name
(Fontsel : access Gtk_Font_Selection_Record;
Fontname : String) return Boolean;
function Get_Font_Name
(Fontsel : access Gtk_Font_Selection_Record) return String;
-
procedure Set_Preview_Text
(Fontsel : access Gtk_Font_Selection_Record; Text : UTF8_String);
function Get_Preview_Text
(Fontsel : access Gtk_Font_Selection_Record) return UTF8_String;
Font_Selection_Dialog functions
-
procedure Gtk_New
(Widget : out Gtk_Font_Selection_Dialog; Title : UTF8_String);
procedure Initialize
(Widget : access Gtk_Font_Selection_Dialog_Record'Class;
Title : UTF8_String);
-
-
function Set_Font_Name
(Fsd : access Gtk_Font_Selection_Dialog_Record;
Fontname : String) return Boolean;
function Get_Font_Name
(Fsd : access Gtk_Font_Selection_Dialog_Record) return String;
-
procedure Set_Preview_Text
(Fsd : access Gtk_Font_Selection_Dialog_Record; Text : UTF8_String);
function Get_Preview_Text
(Fsd : access Gtk_Font_Selection_Dialog_Record) return UTF8_String;
-
-
-
Testgtk source code
This code is part of testgtk, a demo application packaged with GtkAda. Testgtk demonstrates the various widgets of GtkAda
-----------------------------------------------------------------------
-- GtkAda - Ada95 binding for the Gimp Toolkit --
-- --
-- Copyright (C) 1998-1999 --
-- Emmanuel Briot, Joel Brobecker and Arnaud Charlet --
-- --
-- This library is free software; you can redistribute it and/or --
-- modify it under the terms of the GNU General Public --
-- License as published by the Free Software Foundation; either --
-- version 2 of the License, or (at your option) any later version. --
-- --
-- This library is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of --
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU --
-- General Public License for more details. --
-- --
-- You should have received a copy of the GNU General Public --
-- License along with this library; if not, write to the --
-- Free Software Foundation, Inc., 59 Temple Place - Suite 330, --
-- Boston, MA 02111-1307, USA. --
-- --
--
--
--
--
--
--
--
-----------------------------------------------------------------------
with Gtk.Font_Selection;
use Gtk.Font_Selection;
with Gtk;
use Gtk;
package body Create_Font_Selection
is
----------
-- Help --
----------
function Help
return String
is
begin
return "A very specific widget to
select a
new font based on its"
& " characteristics, like the family, weight, size, ...";
end Help;
---------
-- Run --
---------
procedure Run (Frame :
access Gtk.Frame.Gtk_Frame_Record'Class)
is
Font : Gtk_Font_Selection;
begin
Set_Label (Frame, "Font Selection");
Gtk_New (Font);
Add (Frame, Font);
Show_All (Frame);
end Run;
end Create_Font_Selection;