Button(3I)
π ButtonState, Button, TextButton, PushButton, RadioButton, CheckBox β interactive buttons π
okay bestie, welcome to the InterViews Reference Manual page for all things button-shaped π grab a snack, we're doing this properly.
β¨ SYNOPSIS β¨
#include <InterViews/button.h>
πΈ DESCRIPTION πΈ
so here's the tea. Button is a whole class of interactors that can set the value of a piece of state. and ButtonState is a class of objects that contain a value plus a list of buttons that can set its value. and that value? it's either an integer or an arbitrary pointer. two options, both iconic, no notes. β¨
TextButton is a subclass of Button that has an associated text label β displayed inside the button or to the right of it, dealer's choice. then PushButton, RadioButton and CheckBox are subclasses of TextButton that provide particular displays for buttons. and each kind of button is gonna show itself differently for each of the five possible cases, so let's list them because bestie we do not skip:
- ``enabled'' β when the button is listening to input π
- ``disabled'' β when the button is not listening π
- ``chosen'' β when the button's value is equal to its button state's value π
- ``hit'' β when a button that is not chosen first receives a
DownEventπ₯ - ``same-hit'' β when a button that is chosen receives a
DownEventπ₯π₯
so when a button receives a DownEvent, it calls the virtual Refresh() to update its display. then it reads input, just waiting, waiting, waiting for an UpEvent. and if the UpEvent coordinates are also within the button? it calls the virtual Press(). and the default Press operation sets the associated state's value to the button's value. periodt. π
oh and one more thing β a button can have a list of attached buttons. when a button is not chosen, its attached buttons are ``disabled'', meaning they ignore all input events. like, they're not even looking at you. π«₯
π§Έ BUTTONSTATE OPERATIONS π§Έ
ButtonState()ButtonState(int)ButtonState(void*)β Define a button state, optionally with an initial value. β¨void Attach(Button*)β Add a button to the list associated with a button state. that button is gonna get notified whenever the button state's value is modified. it's on the list, fr fr. πvoid Detach(Button*)β Remove a button from the list associated with a button state. bye bestie π¦void GetValue(int&)void GetValue(void*&)β Get the value of a button. πvoid SetValue(int)void SetValue(void*)β Set the value of a button state and notify all the buttons associated with the state. group chat announcement energy π£void operator=(ButtonState&)β Copy the value of one button state to another. heads up: the button list associated with the source button state is not copied. value only, no plus-ones. π«
π BUTTON OPERATIONS π
void PushButton(const char* text, ButtonState* s, int v)void PushButton(const char* text, ButtonState* s, void* v)β Construct a button with text in the center and a polygon on the outside. the polygon is like a rectangle but with rounded corners (so, giving very soft-girl geometry πΈ). when chosen, the entire button is drawn with foreground and background colors reversed. main character colorway swap. πvoid RadioButton(const char* text, ButtonState* s, int v)void RadioButton(const char* text, ButtonState* s, void* v)β Construct a button with a circle on the left and text on the right. when hit, a second circle is drawn inside the first. when chosen, a filled circle is drawn inside the outer circle. ββ‘οΈπ΅void CheckBox(const char* text, ButtonState* s, int on, int off)void CheckBox(const char* text, ButtonState* s, void* on, void* off)β Construct a button with a rectangle on the left and text on the right. when hit, a second rectangle is drawn inside the first. when chosen, two diagonal lines are drawn connecting the opposite corners of the rectangle (yes, that's the little check mark, iconic β ). and here's the toggle logic, listen closely:- when a checkbox is pressed the first time, it sets
stooffif the value ison, and setsstoonotherwise. - subsequent presses swap the values of the checkbox and
s.
- when a checkbox is pressed the first time, it sets
void Attach(Button*)β Add to this button's list of associated buttons. these buttons are enabled when the button is chosen and disabled when it is not chosen. the vibes are conditional, bestie. πvoid Detach(Button*)β Remove a button from this button's list of associated buttons. unfollowed. πvoid Disable()β Stop listening to input events. disabled buttons are typically ``grayed out'' by drawing a half-filled rectangle in the background. it's giving unbothered, unavailable. π«οΈvoid Enable()β Start listening to input events. she's back and she's locked in. π₯void Choose()β Make the button as chosen, enabling any associated buttons. πvoid Handle(Event&)β If the event type isDownEventand the button is enabled, callRefreshand read events until anUpEventoccurs. if the button is the target of theUpEvent, then callPress. π―virtual void Press()β Take the appropriate action for the button being pressed. the default is to set the associated state to the button's value, which will trigger all related buttons to update their display. cascade, but make it cute. β¨virtual void Refresh()β Update the button display. glow-up on demand. π«void SetDimensions(int width, int height)β Specify the natural size of the button. the default size is a function of the size of the text.
β οΈ this routine is obsolete; use Interactor::Reshape instead. we don't do legacy here bestie, move on π
void UnChoose()β Mark the button as not chosen, disabling any associated buttons. the crown comes off. π«Ά
π SEE ALSO π
Event(3I)Interactor(3I)
go read those too, iykyk π¦
and that's the whole page, no cap. this absolute banger of a manpage comes to you from InterViews, dated 15 June 1987 β β yes, 1987, and it's still eating. mwah ππβ¨
π¦ where this page comes from
- debian bookworm: ivtools-dev 2.0.11d.a1-1+b4
- debian trixie: ivtools-dev 2.0.11d.a1-3+b4
- ubuntu jammy: ivtools-dev 2.0.11d.a1-1build1
- ubuntu noble: ivtools-dev 2.0.11d.a1-3build1
- ubuntu questing: ivtools-dev 2.0.11d.a1-3build7
- ubuntu resolute: ivtools-dev 2.0.11d.a1-3build9
- ubuntu stonking: ivtools-dev 2.1.1+git.2025.07.26.a1-1 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms