feat:implementacion grafica 2.0
This commit is contained in:
@@ -4,10 +4,17 @@ project(runner LANGUAGES CXX)
|
||||
|
||||
# The name of the executable created for the application. Change this to change
|
||||
# the on-disk name of your application.
|
||||
<<<<<<< HEAD
|
||||
set(BINARY_NAME "flutter_application_1")
|
||||
# The unique GTK application identifier for this application. See:
|
||||
# https://wiki.gnome.org/HowDoI/ChooseApplicationID
|
||||
set(APPLICATION_ID "com.example.flutter_application_1")
|
||||
=======
|
||||
set(BINARY_NAME "recoleccion_residuos")
|
||||
# The unique GTK application identifier for this application. See:
|
||||
# https://wiki.gnome.org/HowDoI/ChooseApplicationID
|
||||
set(APPLICATION_ID "com.example.recoleccion_residuos")
|
||||
>>>>>>> ffb5bdb346bb7ba0556931b52a489d47eca0d902
|
||||
|
||||
# Explicitly opt in to modern CMake behaviors to avoid warnings with recent
|
||||
# versions of CMake.
|
||||
|
||||
@@ -14,6 +14,14 @@ struct _MyApplication {
|
||||
|
||||
G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION)
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
// Called when first Flutter frame received.
|
||||
static void first_frame_cb(MyApplication* self, FlView* view) {
|
||||
gtk_widget_show(gtk_widget_get_toplevel(GTK_WIDGET(view)));
|
||||
}
|
||||
|
||||
>>>>>>> ffb5bdb346bb7ba0556931b52a489d47eca0d902
|
||||
// Implements GApplication::activate.
|
||||
static void my_application_activate(GApplication* application) {
|
||||
MyApplication* self = MY_APPLICATION(application);
|
||||
@@ -40,6 +48,7 @@ static void my_application_activate(GApplication* application) {
|
||||
if (use_header_bar) {
|
||||
GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new());
|
||||
gtk_widget_show(GTK_WIDGET(header_bar));
|
||||
<<<<<<< HEAD
|
||||
gtk_header_bar_set_title(header_bar, "flutter_application_1");
|
||||
gtk_header_bar_set_show_close_button(header_bar, TRUE);
|
||||
gtk_window_set_titlebar(window, GTK_WIDGET(header_bar));
|
||||
@@ -57,22 +66,64 @@ static void my_application_activate(GApplication* application) {
|
||||
gtk_widget_show(GTK_WIDGET(view));
|
||||
gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view));
|
||||
|
||||
=======
|
||||
gtk_header_bar_set_title(header_bar, "recoleccion_residuos");
|
||||
gtk_header_bar_set_show_close_button(header_bar, TRUE);
|
||||
gtk_window_set_titlebar(window, GTK_WIDGET(header_bar));
|
||||
} else {
|
||||
gtk_window_set_title(window, "recoleccion_residuos");
|
||||
}
|
||||
|
||||
gtk_window_set_default_size(window, 1280, 720);
|
||||
|
||||
g_autoptr(FlDartProject) project = fl_dart_project_new();
|
||||
fl_dart_project_set_dart_entrypoint_arguments(
|
||||
project, self->dart_entrypoint_arguments);
|
||||
|
||||
FlView* view = fl_view_new(project);
|
||||
GdkRGBA background_color;
|
||||
// Background defaults to black, override it here if necessary, e.g. #00000000
|
||||
// for transparent.
|
||||
gdk_rgba_parse(&background_color, "#000000");
|
||||
fl_view_set_background_color(view, &background_color);
|
||||
gtk_widget_show(GTK_WIDGET(view));
|
||||
gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view));
|
||||
|
||||
// Show the window when Flutter renders.
|
||||
// Requires the view to be realized so we can start rendering.
|
||||
g_signal_connect_swapped(view, "first-frame", G_CALLBACK(first_frame_cb),
|
||||
self);
|
||||
gtk_widget_realize(GTK_WIDGET(view));
|
||||
|
||||
>>>>>>> ffb5bdb346bb7ba0556931b52a489d47eca0d902
|
||||
fl_register_plugins(FL_PLUGIN_REGISTRY(view));
|
||||
|
||||
gtk_widget_grab_focus(GTK_WIDGET(view));
|
||||
}
|
||||
|
||||
// Implements GApplication::local_command_line.
|
||||
<<<<<<< HEAD
|
||||
static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) {
|
||||
=======
|
||||
static gboolean my_application_local_command_line(GApplication* application,
|
||||
gchar*** arguments,
|
||||
int* exit_status) {
|
||||
>>>>>>> ffb5bdb346bb7ba0556931b52a489d47eca0d902
|
||||
MyApplication* self = MY_APPLICATION(application);
|
||||
// Strip out the first argument as it is the binary name.
|
||||
self->dart_entrypoint_arguments = g_strdupv(*arguments + 1);
|
||||
|
||||
g_autoptr(GError) error = nullptr;
|
||||
if (!g_application_register(application, nullptr, &error)) {
|
||||
<<<<<<< HEAD
|
||||
g_warning("Failed to register: %s", error->message);
|
||||
*exit_status = 1;
|
||||
return TRUE;
|
||||
=======
|
||||
g_warning("Failed to register: %s", error->message);
|
||||
*exit_status = 1;
|
||||
return TRUE;
|
||||
>>>>>>> ffb5bdb346bb7ba0556931b52a489d47eca0d902
|
||||
}
|
||||
|
||||
g_application_activate(application);
|
||||
@@ -83,7 +134,11 @@ static gboolean my_application_local_command_line(GApplication* application, gch
|
||||
|
||||
// Implements GApplication::startup.
|
||||
static void my_application_startup(GApplication* application) {
|
||||
<<<<<<< HEAD
|
||||
//MyApplication* self = MY_APPLICATION(object);
|
||||
=======
|
||||
// MyApplication* self = MY_APPLICATION(object);
|
||||
>>>>>>> ffb5bdb346bb7ba0556931b52a489d47eca0d902
|
||||
|
||||
// Perform any actions required at application startup.
|
||||
|
||||
@@ -92,7 +147,11 @@ static void my_application_startup(GApplication* application) {
|
||||
|
||||
// Implements GApplication::shutdown.
|
||||
static void my_application_shutdown(GApplication* application) {
|
||||
<<<<<<< HEAD
|
||||
//MyApplication* self = MY_APPLICATION(object);
|
||||
=======
|
||||
// MyApplication* self = MY_APPLICATION(object);
|
||||
>>>>>>> ffb5bdb346bb7ba0556931b52a489d47eca0d902
|
||||
|
||||
// Perform any actions required at application shutdown.
|
||||
|
||||
@@ -108,7 +167,12 @@ static void my_application_dispose(GObject* object) {
|
||||
|
||||
static void my_application_class_init(MyApplicationClass* klass) {
|
||||
G_APPLICATION_CLASS(klass)->activate = my_application_activate;
|
||||
<<<<<<< HEAD
|
||||
G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line;
|
||||
=======
|
||||
G_APPLICATION_CLASS(klass)->local_command_line =
|
||||
my_application_local_command_line;
|
||||
>>>>>>> ffb5bdb346bb7ba0556931b52a489d47eca0d902
|
||||
G_APPLICATION_CLASS(klass)->startup = my_application_startup;
|
||||
G_APPLICATION_CLASS(klass)->shutdown = my_application_shutdown;
|
||||
G_OBJECT_CLASS(klass)->dispose = my_application_dispose;
|
||||
@@ -124,7 +188,12 @@ MyApplication* my_application_new() {
|
||||
g_set_prgname(APPLICATION_ID);
|
||||
|
||||
return MY_APPLICATION(g_object_new(my_application_get_type(),
|
||||
<<<<<<< HEAD
|
||||
"application-id", APPLICATION_ID,
|
||||
"flags", G_APPLICATION_NON_UNIQUE,
|
||||
nullptr));
|
||||
=======
|
||||
"application-id", APPLICATION_ID, "flags",
|
||||
G_APPLICATION_NON_UNIQUE, nullptr));
|
||||
>>>>>>> ffb5bdb346bb7ba0556931b52a489d47eca0d902
|
||||
}
|
||||
|
||||
@@ -3,7 +3,14 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
<<<<<<< HEAD
|
||||
G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION,
|
||||
=======
|
||||
G_DECLARE_FINAL_TYPE(MyApplication,
|
||||
my_application,
|
||||
MY,
|
||||
APPLICATION,
|
||||
>>>>>>> ffb5bdb346bb7ba0556931b52a489d47eca0d902
|
||||
GtkApplication)
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user