The core widgets are the simple building blocks of Baby X, providing facilites for data display and interactive data entry.
A button is perhaps the most basic widget of all. It displays a text message, and calls a callback when the user presses it.
A BBX_Button is constructed off a panel. It has a display text and a callback. It is possible to rest the text. It can be enabled or disabled. There currenly isn't a way of setting the button's font - it uses the default gui font.
The canvas is one of the most fundamental elements of Baby X, and most of the other widgets are constructed using canvases.
See Baby Graphics for a description of how to draw on canvases. The canvas is constructed with known width and height (this may change) and background colour. bbx_canvas_rgba() obtains the canvas' rgba buffer, you write to it, then call bbx_canvas_flush() to draw the results on screen. The buffer is currently persistent. bbx_canvas_setimage() is a realtively high-level function which resizes the simage if it is not the same size as the canvas. You can also set a mouse function.
The Baby X checkbox is an element that allows for entry of a boolean value. It also dispaly a lable next to the checkbox.
The checkbox is constructed off a panel passing in the text and callback. You can set or query the state and enable or disable it.
The Baby X edit box is a multi-line edit control used for entering large amounts of text.
The edit box is constructed off a panel, as usual. The function callback is currently inoperative. You can set or get the text, and set the font.
A label is constructed off a panel. It has no callback. Text can be set, as can the alignment (BBX_ALIGN_CENTER, BBX_ALIGN_LEFT or BBX_ALIGN_RIGHT). Foreground and background colours can be set. There is also a function bbx_label_getpreferredsize() which is important when laying out objects in response to a layout callback. You can also set the font.
A line edit is an edit box which is constrained to entering one line of text.
The line edit is constructed off a panel, and takes intial text plus a callback. The callback is generated whenthe user presses "enter". You can get or set the text, enable or disable it, and set the font.
The list box shows a list of text options, which the user can choose.
The list box is constructed off a parent. The callback is triggered when the user clicks on an entry. Strings are added sequentially with bbx_listbox_addstring(). The entire state is cleared with bbx_listbox_clear(). You can query and set the selected item.
A radio box shows a list of mutually exclusive options, with one selected, together with text labels.
The radio box is constructed off a panel, passing in the text labels and the number of entries. The callback will be triggered each time the user selects an entry. You can also query and set the state. Individual items can be enabled or disabled.
A scrollbar is designed to be attahced to another widget to provide interactive scrolling.
A scrollbar is constructed off a panel. it takes a direction (BBX_SCROLLBAR_VERTICAL or BBX_SCROLLBAR_HORIZONTAL) and a callback which passes back the scroll position. it is necessary to set the scrollbar's range and visible portion. The visible portion reflects the size of the scrollbar thumb, and also the maximum value that will be passed back. You can also query the scrollbar psotion directly, or set it programatically.
The spinner is designed for easy entry of numerical values. It shows an edit box, together with little "up" and "down" arrows. As user clicks the arrows, the value changes.
The spinner is constructed off a panel. It take the intial value, the minimum and maxmimum, and also delta, which is the amount incremented or decremented at each step. Note that whilst it takes doubles, in fact the spinner will often be used for integers. You can get or set the value and set the mimumum / maximum ranges. The mode is a logical OR of BBX_SPINNER_REAL, BBX_SPINNER_LOGARITHMIC and BBX_SPINNER_INTERACTIVE. If BBX_SPINNER_REAL is set, the value isn't constrained to be exactly a multiple of delta. If BBX_SPINNER_LOGARITMIC is set, the spinner responds by increasing delta at high values. If BBX_SPINNER_INTERACTIVE is set, you get the callback as the user spins. But defualt all these flags are off. You can also set the format, which is a printf() style format string that should accept a double. This allows you to add units or set precision. bbx_spinner_spinning() returns true if the spinner is currently spinning, and the control can be enabled or disabled.