Simple DrawingArea
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!-- Created with Cambalache 0.94.1 -->
|
||||
<!-- Created with Cambalache 0.99.3 -->
|
||||
<interface>
|
||||
<!-- interface-name window.ui -->
|
||||
<requires lib="Adw" version="1.0"/>
|
||||
<requires lib="gtk" version="4.0"/>
|
||||
<requires lib="gio" version="2.0"/>
|
||||
<requires lib="gtk" version="4.0"/>
|
||||
<requires lib="libadwaita" version="1.4"/>
|
||||
<template class="AllesappWindow" parent="AdwApplicationWindow">
|
||||
<property name="content">
|
||||
@@ -39,15 +39,26 @@
|
||||
<child>
|
||||
<object class="GtkLabel" id="my_ip_address_label">
|
||||
<property name="label">Meowwww</property>
|
||||
<property name="margin-bottom">5</property>
|
||||
<property name="margin-top">5</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="fetch_my_ip_address">
|
||||
<property name="icon-name">processes-symbolic</property>
|
||||
<property name="label">Fetch my IP address</property>
|
||||
<property name="margin-bottom">5</property>
|
||||
<property name="margin-start">0</property>
|
||||
<property name="margin-top">5</property>
|
||||
<signal name="clicked" handler="on_fetch_my_ip_address"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkDrawingArea" id="pdf_display">
|
||||
<property name="content-height">100</property>
|
||||
<property name="content-width">100</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</property>
|
||||
</object>
|
||||
|
||||
@@ -29,13 +29,29 @@ public class Allesapp.Window : Adw.ApplicationWindow {
|
||||
[GtkChild]
|
||||
private unowned Adw.Banner network_offline;
|
||||
|
||||
[GtkChild]
|
||||
private unowned Gtk.DrawingArea pdf_display;
|
||||
|
||||
public Window (Gtk.Application app) {
|
||||
Object (application: app);
|
||||
}
|
||||
|
||||
public void draw_pdf (Gtk.DrawingArea drawing_area, Cairo.Context cr, int width, int height) {
|
||||
cr.arc(
|
||||
width / 2,
|
||||
height / 2,
|
||||
height / 2,
|
||||
0,
|
||||
2
|
||||
);
|
||||
cr.fill();
|
||||
}
|
||||
|
||||
construct {
|
||||
app.toast.connect (add_toast);
|
||||
app.network_online_changed.connect (on_network_online_changed);
|
||||
|
||||
pdf_display.set_draw_func (draw_pdf);
|
||||
}
|
||||
|
||||
[GtkCallback]
|
||||
|
||||
Reference in New Issue
Block a user