Enhancement: Fixes #498, wizard97 - initial implementation

This commit is contained in:
Rory Fewell
2026-01-22 19:56:28 +00:00
parent d2edd38e30
commit bb0ac39919
49 changed files with 2810 additions and 10 deletions

View File

@@ -0,0 +1,86 @@
cmake_minimum_required(VERSION 3.12)
project(
wintc-wizard-test
VERSION 1.0
DESCRIPTION "Windows Total Conversion 'Hello World' application."
LANGUAGES C
)
set(PROJECT_ANYARCH false)
set(PROJECT_FREESTATUS true)
set(PROJECT_MAINTAINER "Rory Fewell <roryf@oddmatics.uk>")
set(PROJECT_ROOT ${CMAKE_CURRENT_LIST_DIR})
include(GNUInstallDirs)
include(../../../packaging/cmake-inc/common/CMakeLists.txt)
include(../../../packaging/cmake-inc/linking/CMakeLists.txt)
include(../../../packaging/cmake-inc/packaging/CMakeLists.txt)
include(../../../packaging/cmake-inc/resources/CMakeLists.txt)
wintc_resolve_library(glib-2.0 GLIB)
wintc_resolve_library(gtk+-3.0 GTK3)
wintc_resolve_library(wintc-comctl WINTC_COMCTL)
wintc_resolve_library(wintc-comgtk WINTC_COMGTK)
wintc_resolve_library(wintc-wizard97 WINTC_WIZARD97)
wintc_compile_resources()
add_executable(
wintc-wizard-test
src/application.c
src/application.h
src/main.c
src/resources.c
src/window.c
src/window.h
)
target_compile_options(
wintc-wizard-test
PRIVATE ${WINTC_COMPILE_OPTIONS}
)
target_include_directories(
wintc-wizard-test
SYSTEM
PRIVATE ${GLIB_INCLUDE_DIRS}
PRIVATE ${GTK3_INCLUDE_DIRS}
PRIVATE ${WINTC_COMCTL_INCLUDE_DIRS}
PRIVATE ${WINTC_COMGTK_INCLUDE_DIRS}
PRIVATE ${WINTC_WIZARD97_INCLUDE_DIRS}
)
target_link_directories(
wintc-wizard-test
PRIVATE ${GLIB_LIBRARY_DIRS}
PRIVATE ${GTK3_LIBRARY_DIRS}
PRIVATE ${WINTC_COMCTL_LIBRARY_DIRS}
PRIVATE ${WINTC_COMGTK_LIBRARY_DIRS}
PRIVATE ${WINTC_WIZARD97_LIBRARY_DIRS}
)
target_link_libraries(
wintc-wizard-test
PRIVATE ${GLIB_LIBRARIES}
PRIVATE ${GTK3_LIBRARIES}
PRIVATE ${WINTC_COMCTL_LIBRARIES}
PRIVATE ${WINTC_COMGTK_LIBRARIES}
PRIVATE ${WINTC_WIZARD97_LIBRARIES}
)
# Installation
#
wintc_configure_and_install_packaging()
wintc_install_icons_into_package()
install(
FILES wintc-wizard-test.desktop
DESTINATION share/applications
)
install(
TARGETS wintc-wizard-test
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

View File

@@ -0,0 +1,5 @@
# wizard
This directory contains the source code for the sample wizard.
<img width="506" height="382" alt="Image" src="https://github.com/user-attachments/assets/4e0ed558-089d-43eb-b3d4-5f12c5bc0a1c" />
<img width="506" height="382" alt="Image" src="https://github.com/user-attachments/assets/6d3ddfbf-b786-427b-8f57-d9521312b7dc" />

5
private/play/wizard/deps Normal file
View File

@@ -0,0 +1,5 @@
bt,rt:glib2
bt,rt:gtk3
bt,rt:wintc-comctl
bt,rt:wintc-comgtk
bt,rt:wintc-wizard97

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 B

View File

@@ -0,0 +1,90 @@
#include <glib.h>
#include <gtk/gtk.h>
#include <wintc/comctl.h>
#include <wintc/comgtk.h>
#include "application.h"
#include "window.h"
//
// GTK OOP CLASS/INSTANCE DEFINITIONS
//
struct _WinTCWizardApplicationClass
{
GtkApplicationClass __parent__;
};
struct _WinTCWizardApplication
{
GtkApplication __parent__;
};
//
// FORWARD DECLARATIONS
//
static void wintc_wizard_application_activate(
GApplication* application
);
static void wintc_wizard_application_startup(
GApplication* application
);
//
// GTK TYPE DEFINITIONS & CTORS
//
G_DEFINE_TYPE(
WinTCWizardApplication,
wintc_wizard_application,
GTK_TYPE_APPLICATION
)
static void wintc_wizard_application_class_init(
WinTCWizardApplicationClass* klass
)
{
GApplicationClass* application_class = G_APPLICATION_CLASS(klass);
application_class->activate = wintc_wizard_application_activate;
application_class->startup = wintc_wizard_application_startup;
}
static void wintc_wizard_application_init(
WINTC_UNUSED(WinTCWizardApplication* self)
) { }
//
// CLASS VIRTUAL METHODS
//
static void wintc_wizard_application_activate(
GApplication* application
)
{
GtkWidget* new_window =
wintc_wizard_window_new(WINTC_WIZARD_APPLICATION(application));
gtk_widget_show_all(new_window);
}
static void wintc_wizard_application_startup(
GApplication* application
)
{
(G_APPLICATION_CLASS(wintc_wizard_application_parent_class))
->startup(application);
wintc_ctl_install_default_styles();
}
//
// PUBLIC FUNCTIONS
//
WinTCWizardApplication* wintc_wizard_application_new(void)
{
return WINTC_WIZARD_APPLICATION(
g_object_new(
wintc_wizard_application_get_type(),
"application-id", "uk.oddmatics.wintc.play.wizard",
NULL
)
);
}

View File

@@ -0,0 +1,25 @@
#ifndef __APPLICATION_H__
#define __APPLICATION_H__
#include <glib.h>
#include <gtk/gtk.h>
//
// GTK OOP BOILERPLATE
//
#define WINTC_TYPE_WIZARD_APPLICATION (wintc_wizard_application_get_type())
G_DECLARE_FINAL_TYPE(
WinTCWizardApplication,
wintc_wizard_application,
WINTC,
WIZARD_APPLICATION,
GtkApplication
)
//
// PUBLIC FUNCTIONS
//
WinTCWizardApplication* wintc_wizard_application_new(void);
#endif

View File

@@ -0,0 +1,20 @@
#include <glib.h>
#include "application.h"
int main(
int argc,
char* argv[]
)
{
WinTCWizardApplication* app = wintc_wizard_application_new();
int status;
g_set_application_name("Wizard");
status = g_application_run(G_APPLICATION(app), argc, argv);
g_object_unref(app);
return status;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/uk/oddmatics/wintc/play/wizard">
<file>header.png</file>
<file>watermk.png</file>
<file>wizpg1.ui</file>
<file>wizpg2.ui</file>
<file>wizpg3.ui</file>
<file>wizpg4.ui</file>
</gresource>
</gresources>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

View File

@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="WinTCWizard97Page" id="page">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="title">Welcome</property>
<property name="subtitle">Welcome to the test wizard.</property>
<property name="is-exterior-page">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel">
<property name="label">Welcome to the Sample Test Wizard</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="max-width-chars">25</property>
<property name="wrap">True</property>
<property name="xalign">0.0</property>
<style>
<class name="wintc-w97-title" />
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="label">This wizard guides you in the process of doing nothing, achieving nothing, and ultimately reaching enlightenment.</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="max-width-chars">25</property>
<property name="wrap">True</property>
<property name="xalign">0.0</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
</interface>

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="WinTCWizard97Page" id="page">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="title">Welcome</property>
<property name="subtitle">Welcome to the test wizard.</property>
<property name="is-exterior-page">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel">
<property name="label">This is a second exterior page, a bit like the Hardware Update Wizard uses.</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="max-width-chars">25</property>
<property name="wrap">True</property>
<property name="xalign">0.0</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
</object>
</interface>

View File

@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="WinTCWizard97Page" id="page">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="title">Page 2</property>
<property name="subtitle">This is page two.</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel">
<property name="label">Please select which one of these you think is better:</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="max-width-chars">25</property>
<property name="wrap">True</property>
<property name="xalign">0.0</property>
<style>
<class name="wintc-mb-sm" />
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="radio-apples">
<property name="label">Apples</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<style>
<class name="wintc-ml-lg" />
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="radio-oranges">
<property name="label">Oranges</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="group">radio-apples</property>
<style>
<class name="wintc-ml-lg" />
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
</object>
</interface>

View File

@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="WinTCWizard97Page" id="page">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="title">Finished</property>
<property name="subtitle">Completing the test wizard.</property>
<property name="is-exterior-page">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel">
<property name="label">Completing the Sample Test Wizard</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="xalign">0.0</property>
<style>
<class name="wintc-w97-title" />
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="label">The Sample Test Wizard is now complete!
You have managed to:</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="max-width-chars">25</property>
<property name="wrap">True</property>
<property name="xalign">0.0</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label-done-prefer">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="max-width-chars">25</property>
<property name="wrap">True</property>
<property name="xalign">0.0</property>
<style>
<class name="wintc-ml-lg" />
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
</object>
</interface>

View File

@@ -0,0 +1,261 @@
#include <glib.h>
#include <gtk/gtk.h>
#include <wintc/comgtk.h>
#include <wintc/wizard97.h>
#include "application.h"
#include "window.h"
//
// PRIVATE ENUMS
//
enum
{
PROP_NULL,
PROP_CAN_HELP,
N_PROPERTIES
};
enum
{
WIZPAGE_INTRO,
WIZPAGE_INTRO2,
WIZPAGE_DECISION,
WIZPAGE_FINISHED
};
enum
{
DECISION_APPLES,
DECISION_ORANGES
};
//
// FORWARD DECLARATIONS
//
static void wintc_wizard_window_get_property(
GObject* object,
guint prop_id,
GValue* value,
GParamSpec* pspec
);
static void wintc_wizard_window_constructing_page(
WinTCWizard97Window* wiz_wnd,
guint page_num,
GtkBuilder* builder
);
static guint wintc_wizard_window_get_next_page(
WinTCWizard97Window* wiz_wnd,
guint current_page
);
static void wintc_wizard_window_help(
WinTCWizard97Window* wiz_wnd,
guint current_page
);
//
// GTK OOP CLASS/INSTANCE DEFINITIONS
//
struct _WinTCWizardWindowClass
{
WinTCWizard97WindowClass __parent__;
};
struct _WinTCWizardWindow
{
WinTCWizard97Window __parent__;
// UI stuff
//
GtkWidget* radio_apples;
GtkWidget* label_done_prefer;
};
//
// GTK TYPE DEFINITION & CTORS
//
G_DEFINE_TYPE(
WinTCWizardWindow,
wintc_wizard_window,
WINTC_TYPE_WIZARD97_WINDOW
)
static void wintc_wizard_window_class_init(
WinTCWizardWindowClass* klass
)
{
GObjectClass* object_class = G_OBJECT_CLASS(klass);
WinTCWizard97WindowClass* wizard_class =
WINTC_WIZARD97_WINDOW_CLASS(klass);
wizard_class->constructing_page = wintc_wizard_window_constructing_page;
wizard_class->get_next_page = wintc_wizard_window_get_next_page;
wizard_class->help = wintc_wizard_window_help;
object_class->get_property = wintc_wizard_window_get_property;
g_object_class_override_property(
object_class,
PROP_CAN_HELP,
"can-help"
);
wintc_wizard97_window_class_setup_from_resources(
wizard_class,
"/uk/oddmatics/wintc/play/wizard/watermk.png",
"/uk/oddmatics/wintc/play/wizard/header.png",
"/uk/oddmatics/wintc/play/wizard/wizpg1.ui",
"/uk/oddmatics/wintc/play/wizard/wizpg2.ui",
"/uk/oddmatics/wintc/play/wizard/wizpg3.ui",
"/uk/oddmatics/wintc/play/wizard/wizpg4.ui",
NULL
);
}
static void wintc_wizard_window_init(
WinTCWizardWindow* self
)
{
wintc_wizard97_window_init_wizard(
WINTC_WIZARD97_WINDOW(self)
);
}
//
// CLASS VIRTUAL METHODS
//
static void wintc_wizard_window_get_property(
GObject* object,
guint prop_id,
GValue* value,
GParamSpec* pspec
)
{
switch (prop_id)
{
case PROP_CAN_HELP:
g_value_set_boolean(value, TRUE);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
}
}
static void wintc_wizard_window_constructing_page(
WinTCWizard97Window* wiz_wnd,
guint page_num,
GtkBuilder* builder
)
{
WinTCWizardWindow* swiz_wnd = WINTC_WIZARD_WINDOW(wiz_wnd);
switch (page_num)
{
case WIZPAGE_DECISION:
wintc_builder_get_objects(
builder,
"radio-apples", &(swiz_wnd->radio_apples),
NULL
);
break;
case WIZPAGE_FINISHED:
wintc_builder_get_objects(
builder,
"label-done-prefer", &(swiz_wnd->label_done_prefer),
NULL
);
break;
default: break;
}
}
static guint wintc_wizard_window_get_next_page(
WinTCWizard97Window* wiz_wnd,
guint current_page
)
{
WinTCWizardWindow* swiz_wnd = WINTC_WIZARD_WINDOW(wiz_wnd);
guint next_page = current_page + 1;
switch (next_page)
{
case WIZPAGE_FINISHED:
{
guint idx_prefer;
const gchar* text_prefer_item;
gchar* text_prefer;
idx_prefer =
wintc_radio_group_get_selection(
gtk_radio_button_get_group(
GTK_RADIO_BUTTON(swiz_wnd->radio_apples)
)
);
switch (idx_prefer)
{
case DECISION_APPLES: text_prefer_item = "apples"; break;
case DECISION_ORANGES: text_prefer_item = "oranges"; break;
}
text_prefer =
g_strdup_printf(
"Decide that %s are better.",
text_prefer_item
);
gtk_label_set_text(
GTK_LABEL(swiz_wnd->label_done_prefer),
text_prefer
);
g_free(text_prefer);
break;
}
default: break;
}
return
(WINTC_WIZARD97_WINDOW_CLASS(wintc_wizard_window_parent_class))
->get_next_page(wiz_wnd, current_page);
}
static void wintc_wizard_window_help(
WinTCWizard97Window* wiz_wnd,
WINTC_UNUSED(guint current_page)
)
{
wintc_messagebox_show(
GTK_WINDOW(wiz_wnd),
"And this is where I'd display the help dialog... IF I HAD ONE!",
"Help",
GTK_BUTTONS_OK,
GTK_MESSAGE_ERROR
);
}
//
// PUBLIC FUNCTIONS
//
GtkWidget* wintc_wizard_window_new(
WinTCWizardApplication* app
)
{
return GTK_WIDGET(
g_object_new(
WINTC_TYPE_WIZARD_WINDOW,
"application", GTK_APPLICATION(app),
"title", "My Sample Wizard",
NULL
)
);
}

View File

@@ -0,0 +1,30 @@
#ifndef __WINDOW_H__
#define __WINDOW_H__
#include <glib.h>
#include <gtk/gtk.h>
#include <wintc/wizard97.h>
#include "application.h"
//
// GTK OOP BOILERPLATE
//
#define WINTC_TYPE_WIZARD_WINDOW (wintc_wizard_window_get_type())
G_DECLARE_FINAL_TYPE(
WinTCWizardWindow,
wintc_wizard_window,
WINTC,
WIZARD_WINDOW,
WinTCWizard97Window
)
//
// PUBLIC FUNCTIONS
//
GtkWidget* wintc_wizard_window_new(
WinTCWizardApplication* app
);
#endif

View File

@@ -0,0 +1,9 @@
[Desktop Entry]
Name=Hello (WinTC Sample)
Comment=WinTC demonstration hello program.
Exec=wintc-hello
Icon=wintc-hello
Terminal=false
StartupNotify=false
Type=Application
Categories=Utility;GTK;

View File

@@ -167,7 +167,8 @@ static void wintc_ctl_menu_binding_constructed(
WinTCCtlMenuBinding* menu_binding = WINTC_CTL_MENU_BINDING(object);
wintc_container_clear(
GTK_CONTAINER(menu_binding->menu_shell)
GTK_CONTAINER(menu_binding->menu_shell),
TRUE
);
wintc_ctl_menu_binding_track_menu(

View File

@@ -55,3 +55,26 @@ box.vertical.wintc-button-box button:last-child
{
margin-bottom: 0px;
}
/**
* Edges
*/
.wintc-edge-bottom
{
border-bottom: 1px solid @borders;
}
.wintc-edge-left
{
border-left: 1px solid @borders;
}
.wintc-edge-right
{
border-right: 1px solid @borders;
}
.wintc-edge-top
{
border-top: 1px solid @borders;
}

View File

@@ -70,6 +70,8 @@ add_library(
public/msgbox.h
src/profile.c
public/profile.h
src/radio.c
public/radio.h
src/regex.c
public/regex.h
public/shorthand.h

View File

@@ -13,9 +13,11 @@
* Destroys all child widgets of a container.
*
* @param container The container.
* @param destroy True to destroy, rather than just remove, the children.
*/
void wintc_container_clear(
GtkContainer* container
GtkContainer* container,
gboolean destroy
);
/**

View File

@@ -21,6 +21,7 @@
#include "@LIB_HEADER_DIR@/menu.h"
#include "@LIB_HEADER_DIR@/msgbox.h"
#include "@LIB_HEADER_DIR@/profile.h"
#include "@LIB_HEADER_DIR@/radio.h"
#include "@LIB_HEADER_DIR@/regex.h"
#include "@LIB_HEADER_DIR@/shorthand.h"
#include "@LIB_HEADER_DIR@/signals.h"

View File

@@ -0,0 +1,19 @@
#ifndef __COMGTK_RADIO_H__
#define __COMGTK_RADIO_H__
#include <gtk/gtk.h>
//
// PUBLIC FUNCTIONS
//
/**
* Retrieve the index of the active selection in a radio button group.
*
* @param group The radio button group.
*/
guint wintc_radio_group_get_selection(
GSList* group
);
#endif

View File

@@ -7,17 +7,29 @@
// PUBLIC FUNCTIONS
//
void wintc_container_clear(
GtkContainer* container
GtkContainer* container,
gboolean destroy
)
{
GList* children = gtk_container_get_children(container);
GList* iter = children;
while (iter)
if (destroy)
{
gtk_widget_destroy(GTK_WIDGET(iter->data));
iter = iter->next;
for (; iter; iter = iter->next)
{
gtk_widget_destroy(GTK_WIDGET(iter->data));
}
}
else
{
for (; iter; iter = iter->next)
{
gtk_container_remove(
container,
GTK_WIDGET(iter->data)
);
}
}
g_list_free(children);

31
shared/comgtk/src/radio.c Normal file
View File

@@ -0,0 +1,31 @@
#include <glib.h>
#include <gtk/gtk.h>
#include "../public/radio.h"
//
// PUBLIC FUNCTIONS
//
guint wintc_radio_group_get_selection(
GSList* group
)
{
GSList* iter = group;
for (guint i = 0; iter; iter = iter->next, i++)
{
if (
gtk_toggle_button_get_active(
GTK_TOGGLE_BUTTON(iter->data)
)
)
{
// From GtkBuilder, it's in reverse
//
return g_slist_length(group) - i - 1;
}
}
g_critical("%s", "comgtk: no radio in group was active");
return 0;
}

View File

@@ -0,0 +1,87 @@
cmake_minimum_required(VERSION 3.12)
project(
libwintc-wizard97
VERSION 1.0
DESCRIPTION "Windows Total Conversion wizard UI library."
LANGUAGES C
)
set(PROJECT_ANYARCH false)
set(PROJECT_FREESTATUS true)
set(PROJECT_MAINTAINER "Rory Fewell <roryf@oddmatics.uk>")
set(PROJECT_ROOT ${CMAKE_CURRENT_LIST_DIR})
include(GNUInstallDirs)
include(../../packaging/cmake-inc/common/CMakeLists.txt)
include(../../packaging/cmake-inc/libraries/CMakeLists.txt)
include(../../packaging/cmake-inc/linking/CMakeLists.txt)
include(../../packaging/cmake-inc/packaging/CMakeLists.txt)
include(../../packaging/cmake-inc/resources/CMakeLists.txt)
wintc_resolve_library(gdk-pixbuf-2.0 GDK_PIXBUF)
wintc_resolve_library(glib-2.0 GLIB)
wintc_resolve_library(gtk+-3.0 GTK3)
wintc_resolve_library(wintc-comgtk WINTC_COMGTK)
wintc_compile_resources()
add_library(
libwintc-wizard97
src/resources.c
src/wizpage.c
public/wizpage.h
src/wizwnd.c
public/wizwnd.h
)
set_target_properties(
libwintc-wizard97
PROPERTIES
SOVERSION 1
VERSION ${PROJECT_VERSION}
)
target_compile_options(
libwintc-wizard97
PRIVATE ${WINTC_COMPILE_OPTIONS}
)
target_include_directories(
libwintc-wizard97
SYSTEM
BEFORE
PRIVATE ${GDK_PIXBUF_INCLUDE_DIRS}
PRIVATE ${GLIB_INCLUDE_DIRS}
PRIVATE ${GTK3_INCLUDE_DIRS}
PRIVATE ${WINTC_COMGTK_INCLUDE_DIRS}
)
target_link_directories(
libwintc-wizard97
PRIVATE ${GDK_PIXBUF_LIBRARY_DIRS}
PRIVATE ${GLIB_LIBRARY_DIRS}
PRIVATE ${GTK3_LIBRARY_DIRS}
PRIVATE ${WINTC_COMGTK_LIBRARY_DIRS}
)
target_link_libraries(
libwintc-wizard97
PRIVATE ${GDK_PIXBUF_LIBRARIES}
PRIVATE ${GLIB_LIBRARIES}
PRIVATE ${GTK3_LIBRARIES}
PRIVATE ${WINTC_COMGTK_LIBRARIES}
)
# Installation
#
wintc_configure_and_install_packaging()
wintc_add_pkgconfig_install()
wintc_install_public_headers()
install(
TARGETS libwintc-wizard97
LIBRARY DESTINATION ${LIB_DIR}
)

View File

@@ -0,0 +1,5 @@
# libwintc-wizard97
This directory contains the source code for the wizard library.
## Purpose
This library is essentially a GTK-ised version of wizard97, used for making the nice looking wizards in Windows 2000 and XP.

4
shared/wizard97/deps Normal file
View File

@@ -0,0 +1,4 @@
bt,rt:gdk-pixbuf2
bt,rt:glib2
bt,rt:gtk3
bt,rt:wintc-comgtk

View File

@@ -0,0 +1,6 @@
#ifndef __WINTC_WIZARD97_H__
#define __WINTC_WIZARD97_H__
#include "@LIB_HEADER_DIR@/wizwnd.h"
#endif

View File

@@ -0,0 +1,41 @@
#ifndef __WIZARD97_WIZPAGE_H__
#define __WIZARD97_WIZPAGE_H__
#include <glib.h>
#include <gtk/gtk.h>
//
// GTK OOP BOILERPLATE
//
#define WINTC_TYPE_WIZARD97_PAGE (wintc_wizard97_page_get_type())
G_DECLARE_DERIVABLE_TYPE(
WinTCWizard97Page,
wintc_wizard97_page,
WINTC,
WIZARD97_PAGE,
GtkBox
)
struct _WinTCWizard97PageClass
{
GtkBoxClass __parent__;
};
//
// PUBLIC FUNCTIONS
//
gboolean wintc_wizard97_page_get_is_exterior_page(
WinTCWizard97Page* wiz_page
);
gboolean wintc_wizard97_page_get_is_final_page(
WinTCWizard97Page* wiz_page
);
const gchar* wintc_wizard97_page_get_subtitle(
WinTCWizard97Page* wiz_page
);
const gchar* wintc_wizard97_page_get_title(
WinTCWizard97Page* wiz_page
);
#endif

View File

@@ -0,0 +1,70 @@
#ifndef __WIZARD97_WIZWND_H__
#define __WIZARD97_WIZWND_H__
#include <glib.h>
#include <gtk/gtk.h>
//
// GTK OOP BOILERPLATE
//
#define WINTC_TYPE_WIZARD97_WINDOW (wintc_wizard97_window_get_type())
G_DECLARE_DERIVABLE_TYPE(
WinTCWizard97Window,
wintc_wizard97_window,
WINTC,
WIZARD97_WINDOW,
GtkWindow
)
struct _WinTCWizard97WindowClass
{
GtkWindowClass __parent__;
// Wizard stuff
//
gchar* resource_watermark;
gchar* resource_header;
GList* list_resources_pages;
// Vfuncs
//
gboolean (*cancel) (
WinTCWizard97Window* wiz_wnd,
guint current_page
);
void (*constructing_page) (
WinTCWizard97Window* wiz_wnd,
guint page_num,
GtkBuilder* builder
);
gboolean (*finish) (
WinTCWizard97Window* wiz_wnd,
guint current_page
);
guint (*get_next_page) (
WinTCWizard97Window* wiz_wnd,
guint current_page
);
void (*help) (
WinTCWizard97Window* wiz_wnd,
guint current_page
);
};
//
// PUBLIC FUNCTIONS
//
void wintc_wizard97_window_class_setup_from_resources(
WinTCWizard97WindowClass* wizard_class,
const gchar* resource_watermark,
const gchar* resource_header,
...
);
void wintc_wizard97_window_init_wizard(
WinTCWizard97Window* wiz_wnd
);
#endif

View File

@@ -0,0 +1,40 @@
/**
* Default wizard97-specific styles
*/
.wintc-w97-title
{
font-weight: bold;
}
.wintc-w97-header
{
background-color: @theme_base_color;
font-family: 'Microsoft Sans Serif', sans-serif;
}
.wintc-w97-page-area
{
font-family: 'Microsoft Sans Serif', sans-serif;
}
.wintc-w97-header .wintc-w97-title
{
margin-left: 18px;
margin-top: 8px;
}
.wintc-w97-header .wintc-w97-subtitle
{
margin-left: 25px
}
.wintc-w97-exterior .wintc-w97-page-area
{
background-color: @theme_base_color;
}
.wintc-w97-page-area .wintc-w97-title
{
font-size: 13pt;
margin: 8px 0px;
}

View File

@@ -0,0 +1,19 @@
/**
* Default wizard97 priority styles
*/
/** Unfortunately padding is app priority, because of #249 */
.wintc-w97-header
{
padding: 5px;
}
.wintc-w97-exterior .wintc-w97-page-area
{
padding: 8px;
}
.wintc-w97-interior .wintc-w97-page-area
{
padding: 12px 12px 12px 42px;
}

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/uk/oddmatics/wintc/wizard97">
<file>default.css</file>
<file>default_p.css</file>
<file>wizext.ui</file>
<file>wizint.ui</file>
<file>wizwnd.ui</file>
</gresource>
</gresources>

View File

@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkBox" id="main-box">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">horizontal</property>
<child>
<object class="GtkImage" id="img-watermark">
<property name="visible">False</property>
<property name="can-focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box-page">
<property name="visible">False</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<style>
<class name="wintc-edge-left" />
<class name="wintc-w97-page-area" />
</style>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<style>
<class name="wintc-w97-exterior" />
</style>
</object>
</interface>

View File

@@ -0,0 +1,106 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkBox" id="main-box">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox" id="box-header">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">horizontal</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="label-title">
<property name="label">This is a title</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="xalign">0.0</property>
<style>
<class name="wintc-w97-title" />
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label-subtitle">
<property name="label">And this is a subtitle</property>
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="xalign">0.0</property>
<style>
<class name="wintc-w97-subtitle" />
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkImage" id="img-header">
<property name="visible">False</property>
<property name="can-focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<style>
<class name="wintc-edge-bottom" />
<class name="wintc-w97-header" />
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box-page">
<property name="visible">False</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<style>
<class name="wintc-w97-page-area" />
</style>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<style>
<class name="wintc-w97-interior" />
</style>
</object>
</interface>

View File

@@ -0,0 +1,125 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<object class="GtkBox" id="main-box">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox" id="box-page-area">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">vertical</property>
<style>
<class name="wintc-edge-bottom" />
</style>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can-focus">False</property>
<property name="orientation">horizontal</property>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">Help</property>
<property name="visible" bind-source="wizard" bind-property="can-help" />
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="action-name">win.help</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack-type">end</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">Cancel</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="action-name">win.cancel</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack-type">end</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">Finish</property>
<property name="visible" bind-source="wizard" bind-property="final-page" />
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="action-name">win.next</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack-type">end</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">Next &gt;</property>
<property name="visible" bind-source="wizard" bind-property="final-page" bind-flags="invert-boolean" />
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="action-name">win.next</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack-type">end</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">&lt; Back</property>
<property name="visible">True</property>
<property name="can-focus">True</property>
<property name="receives-default">True</property>
<property name="action-name">win.back</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="pack-type">end</property>
<property name="position">4</property>
</packing>
</child>
<style>
<class name="wintc-button-box" />
<class name="wintc-mb-md" />
<class name="wintc-ml-md" />
<class name="wintc-mr-md" />
<class name="wintc-mt-md" />
</style>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
</interface>

View File

@@ -0,0 +1,258 @@
#include <glib.h>
#include <gtk/gtk.h>
#include <wintc/comgtk.h>
#include "../public/wizpage.h"
//
// PRIVATE ENUMS
//
enum
{
PROP_NULL,
PROP_TITLE,
PROP_SUBTITLE,
PROP_IS_FINAL_PAGE,
PROP_IS_EXTERIOR_PAGE,
N_PROPERTIES
};
//
// FORWARD DECLARATIONS
//
static void wintc_wizard97_page_finalize(
GObject* object
);
static void wintc_wizard97_page_get_property(
GObject* object,
guint prop_id,
GValue* value,
GParamSpec* pspec
);
static void wintc_wizard97_page_set_property(
GObject* object,
guint prop_id,
const GValue* value,
GParamSpec* pspec
);
//
// STATIC DATA
//
static GParamSpec* wintc_wizard97_page_properties[N_PROPERTIES] = { 0 };
//
// GTK OOP CLASS/INSTANCE DEFINITIONS
//
typedef struct _WinTCWizard97PagePrivate
{
gchar* title;
gchar* subtitle;
gboolean is_final_page;
gboolean is_exterior_page;
} WinTCWizard97PagePrivate;
//
// GTK TYPE DEFINITIONS & CTORS
//
G_DEFINE_TYPE_WITH_PRIVATE(
WinTCWizard97Page,
wintc_wizard97_page,
GTK_TYPE_BOX
)
static void wintc_wizard97_page_class_init(
WinTCWizard97PageClass* klass
)
{
GObjectClass* object_class = G_OBJECT_CLASS(klass);
object_class->finalize = wintc_wizard97_page_finalize;
object_class->get_property = wintc_wizard97_page_get_property;
object_class->set_property = wintc_wizard97_page_set_property;
wintc_wizard97_page_properties[PROP_TITLE] =
g_param_spec_string(
"title",
"Title",
"The title of the page.",
NULL,
G_PARAM_READWRITE
);
wintc_wizard97_page_properties[PROP_SUBTITLE] =
g_param_spec_string(
"subtitle",
"Subtitle",
"The subtitle of the page.",
NULL,
G_PARAM_READWRITE
);
wintc_wizard97_page_properties[PROP_IS_FINAL_PAGE] =
g_param_spec_boolean(
"is-final-page",
"IsFinalPage",
"Determines whether this is a final page in the wizard.",
FALSE,
G_PARAM_READWRITE
);
wintc_wizard97_page_properties[PROP_IS_EXTERIOR_PAGE] =
g_param_spec_boolean(
"is-exterior-page",
"IsExteriorPage",
"Determines whether this is an exterior page.",
FALSE,
G_PARAM_READWRITE
);
g_object_class_install_properties(
object_class,
N_PROPERTIES,
wintc_wizard97_page_properties
);
}
static void wintc_wizard97_page_init(
WINTC_UNUSED(WinTCWizard97Page* self)
) {}
//
// CLASS VIRTUAL METHODS
//
static void wintc_wizard97_page_finalize(
GObject* object
)
{
WinTCWizard97PagePrivate* priv =
wintc_wizard97_page_get_instance_private(
WINTC_WIZARD97_PAGE(object)
);
g_free(priv->title);
g_free(priv->subtitle);
(G_OBJECT_CLASS(wintc_wizard97_page_parent_class))
->finalize(object);
}
static void wintc_wizard97_page_get_property(
GObject* object,
guint prop_id,
GValue* value,
GParamSpec* pspec
)
{
WinTCWizard97PagePrivate* priv =
wintc_wizard97_page_get_instance_private(
WINTC_WIZARD97_PAGE(object)
);
switch (prop_id)
{
case PROP_TITLE:
g_value_set_string(value, priv->title);
break;
case PROP_SUBTITLE:
g_value_set_string(value, priv->subtitle);
break;
case PROP_IS_FINAL_PAGE:
g_value_set_boolean(value, priv->is_final_page);
break;
case PROP_IS_EXTERIOR_PAGE:
g_value_set_boolean(value, priv->is_exterior_page);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
}
}
static void wintc_wizard97_page_set_property(
GObject* object,
guint prop_id,
const GValue* value,
GParamSpec* pspec
)
{
WinTCWizard97PagePrivate* priv =
wintc_wizard97_page_get_instance_private(
WINTC_WIZARD97_PAGE(object)
);
switch (prop_id)
{
case PROP_TITLE:
priv->title = g_value_dup_string(value);
break;
case PROP_SUBTITLE:
priv->subtitle = g_value_dup_string(value);
break;
case PROP_IS_FINAL_PAGE:
priv->is_final_page = g_value_get_boolean(value);
break;
case PROP_IS_EXTERIOR_PAGE:
priv->is_exterior_page = g_value_get_boolean(value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
}
}
//
// PUBLIC FUNCTIONS
//
gboolean wintc_wizard97_page_get_is_exterior_page(
WinTCWizard97Page* wiz_page
)
{
WinTCWizard97PagePrivate* priv =
wintc_wizard97_page_get_instance_private(
wiz_page
);
return priv->is_exterior_page;
}
gboolean wintc_wizard97_page_get_is_final_page(
WinTCWizard97Page* wiz_page
)
{
WinTCWizard97PagePrivate* priv =
wintc_wizard97_page_get_instance_private(
wiz_page
);
return priv->is_final_page;
}
const gchar* wintc_wizard97_page_get_subtitle(
WinTCWizard97Page* wiz_page
)
{
WinTCWizard97PagePrivate* priv =
wintc_wizard97_page_get_instance_private(
wiz_page
);
return priv->subtitle;
}
const gchar* wintc_wizard97_page_get_title(
WinTCWizard97Page* wiz_page
)
{
WinTCWizard97PagePrivate* priv =
wintc_wizard97_page_get_instance_private(
wiz_page
);
return priv->title;
}

1136
shared/wizard97/src/wizwnd.c Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -276,7 +276,11 @@ static void refresh_wallpaper_list(
)
{
g_list_free_full(wnd->list_wallpapers, g_free);
wintc_container_clear(GTK_CONTAINER(wnd->listbox_wallpapers));
wintc_container_clear(
GTK_CONTAINER(wnd->listbox_wallpapers),
TRUE
);
// Load up wallpapers
//

View File

@@ -576,7 +576,10 @@ static void populate_toolbar(
{
GtkWidget* toolbar = (WINTC_EXPLORER_TOOLBAR(toolbar_std))->toolbar;
wintc_container_clear(GTK_CONTAINER(toolbar));
wintc_container_clear(
GTK_CONTAINER(toolbar),
TRUE
);
WINTC_LOG_DEBUG("explorer: populating std toolbar with %s", config_str);

View File

@@ -778,7 +778,8 @@ static void refresh_personal_menu(
// Clear existing items
//
wintc_container_clear(
GTK_CONTAINER(toolbar_start->personal.menubar_programs)
GTK_CONTAINER(toolbar_start->personal.menubar_programs),
TRUE
);
// Set up signal tuple array

View File

@@ -44,6 +44,7 @@ wintc-shlang-->bt,rt-->libwintc-shlang
wintc-sndapi-->bt,rt-->libwintc-sndapi
wintc-syscfg-->bt,rt-->libwintc-syscfg
wintc-winbrand-->bt,rt-->libwintc-winbrand
wintc-wizard97-->bt,rt-->libwintc-wizard97
xcursorgen-->bt,rt-->xcursorgen
xdg-mime-->bt,rt-->xdg-utils
xml2-->bt-->libxml2-dev

View File

@@ -32,6 +32,7 @@ wintc-shlang-->bt,rt-->wintc-shlang
wintc-sndapi-->bt,rt-->wintc-sndapi
wintc-syscfg-->bt,rt-->wintc-syscfg
wintc-winbrand-->bt,rt-->wintc-winbrand
wintc-wizard97-->bt,rt-->wintc-wizard97
xcursorgen-->bt,rt-->xorg-xcursorgen
xdg-mime-->bt,rt-->xdg-utils
xml2-->bt,rt-->libxml2

View File

@@ -31,6 +31,7 @@ wintc-shlang-->bt,rt-->wintc-shlang
wintc-sndapi-->bt,rt-->wintc-sndapi
wintc-syscfg-->bt,rt-->wintc-syscfg
wintc-winbrand-->bt,rt-->wintc-winbrand
wintc-wizard97-->bt,rt-->wintc-wizard97
xcursorgen-->bt,rt-->xcursorgen
xdg-mime-->bt,rt-->xdg-utils
xml2-->bt,rt-->libxml2

View File

@@ -45,6 +45,7 @@ wintc-shlang-->bt,rt-->libwintc-shlang
wintc-sndapi-->bt,rt-->libwintc-sndapi
wintc-syscfg-->bt,rt-->libwintc-syscfg
wintc-winbrand-->bt,rt-->libwintc-winbrand
wintc-wizard97-->bt,rt-->libwintc-wizard97
xcursorgen-->bt,rt-->x11-apps
xdg-mime-->bt,rt-->xdg-utils
xml2-->bt-->libxml2-dev

View File

@@ -44,6 +44,7 @@ wintc-shlang-->bt,rt-->wintc-shlang
wintc-sndapi-->bt,rt-->wintc-sndapi
wintc-syscfg-->bt,rt-->wintc-syscfg
wintc-winbrand-->bt,rt-->wintc-winbrand
wintc-wizard97-->bt,rt-->wintc-wizard97
xcursorgen-->bt,rt-->xcursorgen
xdg-mime-->bt,rt-->xdg-utils
xml2-->bt-->libxml2-devel

View File

@@ -44,6 +44,7 @@ wintc-shlang-->bt,rt-->wintc-shlang
wintc-sndapi-->bt,rt-->wintc-sndapi
wintc-syscfg-->bt,rt-->wintc-syscfg
wintc-winbrand-->bt,rt-->wintc-winbrand
wintc-wizard97-->bt,rt-->wintc-wizard97
xcursorgen-->bt,rt-->xcursorgen
xdg-mime-->bt,rt-->xdg-utils
xml2-->bt-->libxml2-devel