ags(control-center/page): add tooltip and onDestroy properties to PageButton

This commit is contained in:
retrozinndev
2025-05-17 19:10:16 -03:00
parent 98d284b7ba
commit 086fb0bf96
+7 -1
View File
@@ -99,14 +99,20 @@ export function PageButton(props: {
title: string | Binding<string>; title: string | Binding<string>;
endWidget?: Gtk.Widget | Binding<Gtk.Widget>; endWidget?: Gtk.Widget | Binding<Gtk.Widget>;
extraButtons?: Array<Widget.Button> | Binding<Array<Gtk.Widget>>; extraButtons?: Array<Widget.Button> | Binding<Array<Gtk.Widget>>;
onDestroy?: (self: Widget.Box) => void;
onClick?: (self: Widget.Button) => void; onClick?: (self: Widget.Button) => void;
tooltipText?: string | Binding<string>;
tooltipMarkup?: string | Binding<string>;
}): Gtk.Widget { }): Gtk.Widget {
return new Widget.Box({ return new Widget.Box({
onDestroy: props.onDestroy,
children: [ children: [
new Widget.Button({ new Widget.Button({
onClick: props.onClick, onClick: props.onClick,
className: props.className, className: props.className,
hexpand: true, hexpand: true,
tooltipText: props.tooltipText,
tooltipMarkup: props.tooltipMarkup,
child: new Widget.Box({ child: new Widget.Box({
className: "page-button", className: "page-button",
orientation: Gtk.Orientation.HORIZONTAL, orientation: Gtk.Orientation.HORIZONTAL,
@@ -135,7 +141,7 @@ export function PageButton(props: {
} as Widget.BoxProps) } as Widget.BoxProps)
} as Widget.ButtonProps), } as Widget.ButtonProps),
new Widget.Box({ new Widget.Box({
className: "button-row extra-buttons", className: "extra-buttons button-row",
visible: (props.extraButtons instanceof Binding) ? visible: (props.extraButtons instanceof Binding) ?
props.extraButtons.as(extra => extra.length > 0) props.extraButtons.as(extra => extra.length > 0)
: (props.extraButtons ? props.extraButtons.length > 0 : false), : (props.extraButtons ? props.extraButtons.length > 0 : false),