Skip to content

C++ class: Menu

Index · Français

Description

Drop-down menu title.

Qualified name : gaspardos::gui::Menu.

Header : bindings/cpp/widgets.hpp. C++98.

When to use it

Describe this control, then copy it with Widgets::add.

Simple program example

#include "widgets.hpp"
#include <cstdio>
#include <cstring>

int main()
{
    gaspardos::gui::Widgets widgets(320, 200);
    gaspardos::gui::Menu    item(1, 10, 10, 100, 26, "File");
    return widgets.add(item) == 0 ? 0 : 1;
}

Building from Windows

Save the program above as build/api-examples/Menu.cpp from the repository root. Create the directory if necessary.

PowerShell — from the repository root:

New-Item -ItemType Directory -Force build/api-examples | Out-Null
& .\build-x64-install\bin\x86_64-gaspardos-g++.exe -std=c++98 -O2 -Ibindings/cpp build/api-examples/Menu.cpp -o build/api-examples/Menu-x64.elf
if ($LASTEXITCODE -ne 0) { throw "C++ compilation/link failed" }

Run the ELF on GaspardOS, not Windows. The driver supplies CRT and libraries. Prepare the required volumes/services; examples bound their waits and may exit on backpressure rather than retry. Successful compilation does not validate kernel execution.

The headers, implementation files, native wrappers and complete examples are available under Source files.

Class methods

Construct the control; unique positive id, dimensions at least 16 × 20, geometry within surface. Text truncated to 63 bytes; MenuItem requires an existing Menu parent.

Public data

kind, id, x, y, width, height, parent, text[64] (inherited from Widget where applicable).