Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issues or add improvements in testgtk. #38

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,4 @@ docs/gtkada_ug/gtkada_ug.html
docs/gtkada_ug/gtkada_ug.info
docs/gtkada_ug/gtkada_ug.ps
docs/gtkada_ug/gtkada_ug.txt
testgtk/task_project/obj
2 changes: 2 additions & 0 deletions testgtk/create_canvas.adb
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,8 @@ package body Create_Canvas is
Success : Boolean;

begin
Gtk.Frame.Set_Label (Frame, "Canvas (obsolescent)");

Last_Item := Items_List'First;
Last_Link := 1;

Expand Down
2 changes: 2 additions & 0 deletions testgtk/create_canvas_view_animate.adb
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ package body Create_Canvas_View_Animate is
Scrolled : Gtk_Scrolled_Window;
Label : Gtk_Label;
begin
Gtk.Frame.Set_Label (Frame, "Canvas View (animation)");

Gtk_New (Model);

Gtkada.Canvas_View.Initialize (Canvas);
Expand Down
2 changes: 2 additions & 0 deletions testgtk/create_canvas_view_composite.adb
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,8 @@ package body Create_Canvas_View_Composite is
end Do_Example;

begin
Gtk.Frame.Set_Label (Frame, "Canvas View (composite)");

Red := Gtk_New
(Stroke => Black_RGBA,
Fill => Create_Rgba_Pattern ((1.0, 0.0, 0.0, 0.6)));
Expand Down
2 changes: 2 additions & 0 deletions testgtk/create_canvas_view_edit.adb
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ package body Create_Canvas_View_Edit is
Rect : Rect_Item;
White, Font : Drawing_Style;
begin
Gtk.Frame.Set_Label (Frame, "Canvas View (editing)");

Font := Gtk_New
(Stroke => Null_RGBA,
Font => (Name => From_String ("sans 10"),
Expand Down
2 changes: 2 additions & 0 deletions testgtk/create_canvas_view_events.adb
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ package body Create_Canvas_View_Events is

L : Gdouble;
begin
Gtk.Frame.Set_Label (Frame, "Canvas View (events)");

Gtk_New (Model);
Model.Set_Selection_Mode (Selection_Multiple);

Expand Down
2 changes: 2 additions & 0 deletions testgtk/create_canvas_view_items.adb
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,8 @@ package body Create_Canvas_View_Items is
Rect1, Rect2 : Rect_Item;

begin
Gtk.Frame.Set_Label (Frame, "Canvas View (items)");

Font := Gtk_New
(Stroke => Null_RGBA,
Font => (Name => From_String ("sans 10"),
Expand Down
2 changes: 2 additions & 0 deletions testgtk/create_canvas_view_links.adb
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,8 @@ package body Create_Canvas_View_Links is
Text : Text_Item;
Y : Gdouble;
begin
Gtk.Frame.Set_Label (Frame, "Canvas View (links)");

Gtk_New (Model);

Black := Gtk_New;
Expand Down
2 changes: 2 additions & 0 deletions testgtk/create_canvas_view_minimap.adb
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ package body Create_Canvas_View_Minimap is

L : Gdouble;
begin
Gtk.Frame.Set_Label (Frame, "Canvas View (minimap)");

Gtk_New (Model);

Canvas := new Canvas_View_Record;
Expand Down
2 changes: 2 additions & 0 deletions testgtk/create_canvas_view_routes.adb
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ package body Create_Canvas_View_Routes is
Items : array (Pos'Range) of Demo_Item;

begin
Gtk.Frame.Set_Label (Frame, "Canvas View (routes)");

Layout := Frame.Create_Pango_Layout;
Layout.Set_Font_Description (From_String ("sans 8px"));

Expand Down
2 changes: 2 additions & 0 deletions testgtk/create_canvas_view_rtrees.adb
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ package body Create_Canvas_View_Rtrees is
Link_Style : Drawing_Style;

begin
Gtk.Frame.Set_Label (Frame, "Canvas View (large)");

Gtk_New (Model);
Model.Set_Selection_Mode (Selection_Single);

Expand Down
30 changes: 26 additions & 4 deletions testgtk/create_clipboard.adb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
-- --
------------------------------------------------------------------------------

with System;
with Glib; use Glib;
with Glib.Unicode; use Glib.Unicode;
with Gdk.Pixbuf; use Gdk.Pixbuf;
with Gdk.Property; use Gdk.Property;
with Gdk.Types; use Gdk.Types;
Expand Down Expand Up @@ -165,6 +167,9 @@ package body Create_Clipboard is

declare
Format : constant String := Get_String (Model, Iter, 0);
Valid : Boolean;
Invalid_Pos : Natural;
use type System.Address;
begin
Data := Wait_For_Contents (Clipboard, Atom_Intern (Format));

Expand Down Expand Up @@ -196,10 +201,27 @@ package body Create_Clipboard is
& ASCII.LF);

if As_String then
Insert
(Contents,
First,
"As_String=" & Get_Data_As_String (Data));
if Data.Get_Data /= System.Null_Address then
UTF8_Validate (Str => Get_Data_As_String (Data),
Valid => Valid,
Invalid_Pos => Invalid_Pos);
if Valid then
Insert
(Contents,
First,
"As_String=" & Get_Data_As_String (Data));
else
Insert
(Contents,
First,
"Non valid UTF8 string");
end if;
else
Insert
(Contents,
First,
"Null data");
end if;
end if;

Free (Data);
Expand Down
5 changes: 3 additions & 2 deletions testgtk/create_cursors.adb
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,10 @@ package body Create_Cursors is

-- The cursor change is asynchronous: if you plan to do a blocking
-- operation right after setting this, it is useful to call
-- Process_All_Updates in order for impacted windows to have the new
-- Process_Updates in order for impacted windows to have the new
-- cursor.
Process_All_Updates;
Process_Updates (Self => Window,
Update_Children => False);

-- Note: the cursor pixmap is copied to the server, which keeps it as
-- long at it needs. On the client side, it is possible to delete the
Expand Down
2 changes: 2 additions & 0 deletions testgtk/create_mdi.adb
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ package body Create_MDI is

procedure Run (Frame : access Gtk.Frame.Gtk_Frame_Record'Class) is
begin
Gtk.Frame.Set_Label (Frame, "MDI");
Setup (Frame, Independent => False);
end Run;

Expand All @@ -381,6 +382,7 @@ package body Create_MDI is
procedure Run_Independent
(Frame : access Gtk.Frame.Gtk_Frame_Record'Class) is
begin
Gtk.Frame.Set_Label (Frame, "MDI (independent perspectives)");
Setup (Frame, Independent => True);
end Run_Independent;
end Create_MDI;
5 changes: 4 additions & 1 deletion testgtk/create_range.adb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ with Gtk.Volume_Button; use Gtk.Volume_Button;

package body Create_Range is

Zero_String : aliased String := (1 => ASCII.NUL);

----------
-- Help --
----------
Expand Down Expand Up @@ -107,7 +109,8 @@ package body Create_Range is
Pack_Start (Box3, Label, False, False, 0);

Gtk_New (Scale_Button, Icon_Size_Button, 0.0, 100.0, 2.0,
Icons => (1 .. 0 => null));
-- Icons => (1 .. 0 => null)); -- it seems to be a GTK issue in gtkscalebutton.c:988
Icons => (1 => Zero_String'Access));
Pack_Start (Box3, Scale_Button, False, False, 0);

Gtk_New (Label, "Volume button:");
Expand Down
1 change: 0 additions & 1 deletion testgtk/create_revealer.adb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ package body Create_Revealer is
Gtk_New (Button, "None");
Box.Attach (Button, 0, 0, 1, 1);
Gtk_New (Revealer);
Revealer.Set_Halign (Align_Start);
Revealer.Set_Valign (Align_Start);
Gtk_New (Ent);
Ent.Set_Text ("00000");
Expand Down
2 changes: 2 additions & 0 deletions testgtk/create_splittable.adb
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ package body Create_Splittable is
Box : Gtk_Box;
Toggle : Gtk_Toggle_Button;
begin
Gtk.Frame.Set_Label (Frame, "Multi Paned");

Gtk_New_Vbox (Box, Homogeneous => False);
Add (Frame, Box);

Expand Down
4 changes: 2 additions & 2 deletions testgtk/create_tooltips.adb
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ package body Create_Tooltips is
is
pragma Unreferenced (X, Y, Keyboard_Tip, Tooltip);
Window : constant Gtk_Window := Gtk_Window (Check.Get_Tooltip_Window);
Color : constant Gdk_RGBA := (0.0, 0.0, 1.0, 0.5);
Color : constant Gdk_RGBA := (0.25, 0.65, 1.0, 1.0);
begin
Window.Override_Background_Color (Gtk_State_Flag_Normal, Color);
return True;
Expand Down Expand Up @@ -131,7 +131,7 @@ package body Create_Tooltips is
Gtk_New (Label, "A selectable label");
Box1.Pack_Start (Label, False, False, 0);
Label.Set_Selectable (True);
Label.Set_Tooltip_Text ("<b>Another</b> Label tooltip");
Label.Set_Tooltip_Markup ("<b>Another</b> Label tooltip");

-- Another one, with a custom tooltip window

Expand Down
14 changes: 7 additions & 7 deletions testgtk/css_accordion.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
font-variant: inherit;
font-weight: inherit;
text-shadow: inherit;
icon-shadow: inherit;
-gtk-icon-shadow: inherit;
box-shadow: initial;
margin-top: initial;
margin-left: initial;
Expand Down Expand Up @@ -51,19 +51,19 @@
transition-duration: initial;
transition-timing-function: initial;
transition-delay: initial;
engine: initial;
gtk-key-bindings: initial;

-GtkWidget-focus-line-width: 0;
-GtkWidget-focus-padding: 0;
-GtkNotebook-initial-gap: 0;
-gtk-key-bindings: initial;




}

* {
transition-property: color, background-color, border-color, background-image, padding, border-width;
transition-duration: 0.2s;

font: Cantarell 20px;
font: 20px Cantarell;
}

GtkWindow {
Expand Down