Skip to content

December22

mdavisprog edited this page Apr 5, 2023 · 2 revisions

December 2022

Here is a list of updates for the month of December 2022. This month saw the least amount of updates, but there were some clean-up changes made. For a full list of updates, please refer to the commit history. Thanks to thnom for an update this month.

Control

A new function 'Load' has been introduced that accepts a JSON stream to load properties for a control. This is useful for dynamically adding controls to containers.

List.To<OctaneGUI::Button>("Container.Button")->SetOnClicked([&](OctaneGUI::Button&) -> void
{
    static bool DidClick = false;
    if (!DidClick)
    {
        const char* Stream = R"({
            "Controls": [
                {"Type": "HorizontalContainer", "Expand": "Width", "Grow": "Center", "Controls": [
                    {"Type": "Text", "Text": "Well Hello Friends!"}
                ]}
            ]
        })";
        List.To<OctaneGUI::Container>("Container")->Load(Stream);
        DidClick = true;
    }
});

Custom Control

A new control CustomControl has been introduced. This is a control that can be used to register callbacks for each control event. This allows for creating custom control logic without needing to create a new class for the control.

Designer

Support Save and Save As functionality. Save will write the contents to the file that was opened. If no file was opened, the save file dialog is presented.

File Dialog

Each directory entry now displays the file size and the associated unit of memory.

The filter combo box has been fixed to properly update the file list if a new filter is selected.

If the file dialog is a save file dialog and an existing file is selected, a confirmation message box is displayed.

File System

The DirectoryItems function previously returned just a string for each entry. This has been changed to now return a struct that contains more information about each entry in a directory.

The function 'WriteContents' has been added to the API. This provides a quick way to write a string stream to a file.

OctaneGUI::Application Application;
Application.FS().WriteContents(U"Text.txt", U"Hello World!");

Scrollable Container

Scrolling will now only request a repaint instead of a layout. This helps with improving performance when scrolling containers.

Splitter

A splitter is now added after the last container which allows for resizing this container.

The SetSplitterPosition API has been changed to SetSplitterSize. Previously, the value given was a normalized value. The new API now accepts an absolute size value.

Text Input

TextPosition struct members have been changed from using a uint32_t to a size_t. This change required updates throughout the control.

This control now supports PageUp/PageDown keys. The number of lines advanced by is determined by the amount of visible lines in the control.

Drag selecting text with the mouse will now scroll the container.

Tools

Command Palette

The 'quit' and 'exit' commands have been added to close the application.

Unit Tests

The arguments passed into the testing framework has been updated to accept both a test suite and a test case:

  • --Suite: Specify the test suite to run.
  • --Test: Specify the test case to run within the test suite.

The following test suites have been added or updated:

  • CustomControl
  • Scrollable
  • Table
  • TestInput

Window

The layout logic has been updated to prevent duplicate layout requests. If a requested container is a child of a container that is already requested to be laid out, this requested container is ignored.

Clone this wiki locally