// widgetClass.c — Widget class vtable definitions #include "widgetInternal.h" // ============================================================ // Per-type class definitions // ============================================================ static const WidgetClassT sClassVBox = { .flags = WCLASS_BOX_CONTAINER, .paint = NULL, .paintOverlay = NULL, .calcMinSize = NULL, .layout = NULL, .onMouse = NULL, .onKey = NULL, .destroy = NULL, .getText = NULL, .setText = NULL }; static const WidgetClassT sClassHBox = { .flags = WCLASS_BOX_CONTAINER | WCLASS_HORIZ_CONTAINER, .paint = NULL, .paintOverlay = NULL, .calcMinSize = NULL, .layout = NULL, .onMouse = NULL, .onKey = NULL, .destroy = NULL, .getText = NULL, .setText = NULL }; static const WidgetClassT sClassLabel = { .flags = 0, .paint = widgetLabelPaint, .paintOverlay = NULL, .calcMinSize = widgetLabelCalcMinSize, .layout = NULL, .onMouse = NULL, .onKey = NULL, .destroy = NULL, .getText = widgetLabelGetText, .setText = widgetLabelSetText }; static const WidgetClassT sClassButton = { .flags = WCLASS_FOCUSABLE, .paint = widgetButtonPaint, .paintOverlay = NULL, .calcMinSize = widgetButtonCalcMinSize, .layout = NULL, .onMouse = widgetButtonOnMouse, .onKey = widgetButtonOnKey, .destroy = NULL, .getText = widgetButtonGetText, .setText = widgetButtonSetText }; static const WidgetClassT sClassCheckbox = { .flags = WCLASS_FOCUSABLE, .paint = widgetCheckboxPaint, .paintOverlay = NULL, .calcMinSize = widgetCheckboxCalcMinSize, .layout = NULL, .onMouse = widgetCheckboxOnMouse, .onKey = widgetCheckboxOnKey, .destroy = NULL, .getText = widgetCheckboxGetText, .setText = widgetCheckboxSetText }; static const WidgetClassT sClassRadioGroup = { .flags = WCLASS_BOX_CONTAINER, .paint = NULL, .paintOverlay = NULL, .calcMinSize = NULL, .layout = NULL, .onMouse = NULL, .onKey = NULL, .destroy = NULL, .getText = NULL, .setText = NULL }; static const WidgetClassT sClassRadio = { .flags = WCLASS_FOCUSABLE, .paint = widgetRadioPaint, .paintOverlay = NULL, .calcMinSize = widgetRadioCalcMinSize, .layout = NULL, .onMouse = widgetRadioOnMouse, .onKey = widgetRadioOnKey, .destroy = NULL, .getText = widgetRadioGetText, .setText = widgetRadioSetText }; static const WidgetClassT sClassTextInput = { .flags = WCLASS_FOCUSABLE, .paint = widgetTextInputPaint, .paintOverlay = NULL, .calcMinSize = widgetTextInputCalcMinSize, .layout = NULL, .onMouse = widgetTextInputOnMouse, .onKey = widgetTextInputOnKey, .destroy = widgetTextInputDestroy, .getText = widgetTextInputGetText, .setText = widgetTextInputSetText }; static const WidgetClassT sClassTextArea = { .flags = WCLASS_FOCUSABLE, .paint = widgetTextAreaPaint, .paintOverlay = NULL, .calcMinSize = widgetTextAreaCalcMinSize, .layout = NULL, .onMouse = widgetTextAreaOnMouse, .onKey = widgetTextAreaOnKey, .destroy = widgetTextAreaDestroy, .getText = widgetTextAreaGetText, .setText = widgetTextAreaSetText }; static const WidgetClassT sClassListBox = { .flags = WCLASS_FOCUSABLE, .paint = widgetListBoxPaint, .paintOverlay = NULL, .calcMinSize = widgetListBoxCalcMinSize, .layout = NULL, .onMouse = widgetListBoxOnMouse, .onKey = widgetListBoxOnKey, .destroy = widgetListBoxDestroy, .getText = NULL, .setText = NULL }; static const WidgetClassT sClassSpacer = { .flags = 0, .paint = NULL, .paintOverlay = NULL, .calcMinSize = widgetSpacerCalcMinSize, .layout = NULL, .onMouse = NULL, .onKey = NULL, .destroy = NULL, .getText = NULL, .setText = NULL }; static const WidgetClassT sClassSeparator = { .flags = 0, .paint = widgetSeparatorPaint, .paintOverlay = NULL, .calcMinSize = widgetSeparatorCalcMinSize, .layout = NULL, .onMouse = NULL, .onKey = NULL, .destroy = NULL, .getText = NULL, .setText = NULL }; static const WidgetClassT sClassFrame = { .flags = WCLASS_BOX_CONTAINER, .paint = widgetFramePaint, .paintOverlay = NULL, .calcMinSize = NULL, .layout = NULL, .onMouse = NULL, .onKey = NULL, .destroy = NULL, .getText = NULL, .setText = NULL }; static const WidgetClassT sClassDropdown = { .flags = WCLASS_FOCUSABLE, .paint = widgetDropdownPaint, .paintOverlay = widgetDropdownPaintPopup, .calcMinSize = widgetDropdownCalcMinSize, .layout = NULL, .onMouse = widgetDropdownOnMouse, .onKey = widgetDropdownOnKey, .destroy = NULL, .getText = widgetDropdownGetText, .setText = NULL }; static const WidgetClassT sClassComboBox = { .flags = WCLASS_FOCUSABLE, .paint = widgetComboBoxPaint, .paintOverlay = widgetComboBoxPaintPopup, .calcMinSize = widgetComboBoxCalcMinSize, .layout = NULL, .onMouse = widgetComboBoxOnMouse, .onKey = widgetComboBoxOnKey, .destroy = widgetComboBoxDestroy, .getText = widgetComboBoxGetText, .setText = widgetComboBoxSetText }; static const WidgetClassT sClassProgressBar = { .flags = 0, .paint = widgetProgressBarPaint, .paintOverlay = NULL, .calcMinSize = widgetProgressBarCalcMinSize, .layout = NULL, .onMouse = NULL, .onKey = NULL, .destroy = NULL, .getText = NULL, .setText = NULL }; static const WidgetClassT sClassSlider = { .flags = WCLASS_FOCUSABLE, .paint = widgetSliderPaint, .paintOverlay = NULL, .calcMinSize = widgetSliderCalcMinSize, .layout = NULL, .onMouse = widgetSliderOnMouse, .onKey = widgetSliderOnKey, .destroy = NULL, .getText = NULL, .setText = NULL }; static const WidgetClassT sClassTabControl = { .flags = WCLASS_FOCUSABLE | WCLASS_PAINTS_CHILDREN, .paint = widgetTabControlPaint, .paintOverlay = NULL, .calcMinSize = widgetTabControlCalcMinSize, .layout = widgetTabControlLayout, .onMouse = widgetTabControlOnMouse, .onKey = widgetTabControlOnKey, .destroy = NULL, .getText = NULL, .setText = NULL }; static const WidgetClassT sClassTabPage = { .flags = WCLASS_BOX_CONTAINER, .paint = NULL, .paintOverlay = NULL, .calcMinSize = NULL, .layout = NULL, .onMouse = NULL, .onKey = NULL, .destroy = NULL, .getText = NULL, .setText = NULL }; static const WidgetClassT sClassStatusBar = { .flags = WCLASS_BOX_CONTAINER | WCLASS_HORIZ_CONTAINER, .paint = widgetStatusBarPaint, .paintOverlay = NULL, .calcMinSize = NULL, .layout = NULL, .onMouse = NULL, .onKey = NULL, .destroy = NULL, .getText = NULL, .setText = NULL }; static const WidgetClassT sClassToolbar = { .flags = WCLASS_BOX_CONTAINER | WCLASS_HORIZ_CONTAINER, .paint = widgetToolbarPaint, .paintOverlay = NULL, .calcMinSize = NULL, .layout = NULL, .onMouse = NULL, .onKey = NULL, .destroy = NULL, .getText = NULL, .setText = NULL }; static const WidgetClassT sClassTreeView = { .flags = WCLASS_FOCUSABLE | WCLASS_PAINTS_CHILDREN | WCLASS_NO_HIT_RECURSE, .paint = widgetTreeViewPaint, .paintOverlay = NULL, .calcMinSize = widgetTreeViewCalcMinSize, .layout = widgetTreeViewLayout, .onMouse = widgetTreeViewOnMouse, .onKey = widgetTreeViewOnKey, .destroy = NULL, .getText = NULL, .setText = NULL }; static const WidgetClassT sClassTreeItem = { .flags = 0, .paint = NULL, .paintOverlay = NULL, .calcMinSize = NULL, .layout = NULL, .onMouse = NULL, .onKey = NULL, .destroy = NULL, .getText = widgetTreeItemGetText, .setText = widgetTreeItemSetText }; static const WidgetClassT sClassImage = { .flags = 0, .paint = widgetImagePaint, .paintOverlay = NULL, .calcMinSize = widgetImageCalcMinSize, .layout = NULL, .onMouse = widgetImageOnMouse, .onKey = NULL, .destroy = widgetImageDestroy, .getText = NULL, .setText = NULL }; static const WidgetClassT sClassImageButton = { .flags = WCLASS_FOCUSABLE, .paint = widgetImageButtonPaint, .paintOverlay = NULL, .calcMinSize = widgetImageButtonCalcMinSize, .layout = NULL, .onMouse = widgetImageButtonOnMouse, .onKey = widgetImageButtonOnKey, .destroy = widgetImageButtonDestroy, .getText = NULL, .setText = NULL }; static const WidgetClassT sClassCanvas = { .flags = 0, .paint = widgetCanvasPaint, .paintOverlay = NULL, .calcMinSize = widgetCanvasCalcMinSize, .layout = NULL, .onMouse = widgetCanvasOnMouse, .onKey = NULL, .destroy = widgetCanvasDestroy, .getText = NULL, .setText = NULL }; static const WidgetClassT sClassListView = { .flags = WCLASS_FOCUSABLE | WCLASS_NO_HIT_RECURSE, .paint = widgetListViewPaint, .paintOverlay = NULL, .calcMinSize = widgetListViewCalcMinSize, .layout = NULL, .onMouse = widgetListViewOnMouse, .onKey = widgetListViewOnKey, .destroy = widgetListViewDestroy, .getText = NULL, .setText = NULL }; static const WidgetClassT sClassAnsiTerm = { .flags = WCLASS_FOCUSABLE, .paint = widgetAnsiTermPaint, .paintOverlay = NULL, .calcMinSize = widgetAnsiTermCalcMinSize, .layout = NULL, .onMouse = widgetAnsiTermOnMouse, .onKey = widgetAnsiTermOnKey, .destroy = widgetAnsiTermDestroy, .getText = NULL, .setText = NULL }; static const WidgetClassT sClassScrollPane = { .flags = WCLASS_PAINTS_CHILDREN | WCLASS_NO_HIT_RECURSE, .paint = widgetScrollPanePaint, .paintOverlay = NULL, .calcMinSize = widgetScrollPaneCalcMinSize, .layout = widgetScrollPaneLayout, .onMouse = widgetScrollPaneOnMouse, .onKey = widgetScrollPaneOnKey, .destroy = NULL, .getText = NULL, .setText = NULL }; static const WidgetClassT sClassSpinner = { .flags = WCLASS_FOCUSABLE, .paint = widgetSpinnerPaint, .paintOverlay = NULL, .calcMinSize = widgetSpinnerCalcMinSize, .layout = NULL, .onMouse = widgetSpinnerOnMouse, .onKey = widgetSpinnerOnKey, .destroy = NULL, .getText = widgetSpinnerGetText, .setText = widgetSpinnerSetText }; // ============================================================ // Class table — indexed by WidgetTypeE // ============================================================ const WidgetClassT *widgetClassTable[] = { [WidgetVBoxE] = &sClassVBox, [WidgetHBoxE] = &sClassHBox, [WidgetLabelE] = &sClassLabel, [WidgetButtonE] = &sClassButton, [WidgetCheckboxE] = &sClassCheckbox, [WidgetRadioGroupE] = &sClassRadioGroup, [WidgetRadioE] = &sClassRadio, [WidgetTextInputE] = &sClassTextInput, [WidgetTextAreaE] = &sClassTextArea, [WidgetListBoxE] = &sClassListBox, [WidgetSpacerE] = &sClassSpacer, [WidgetSeparatorE] = &sClassSeparator, [WidgetFrameE] = &sClassFrame, [WidgetDropdownE] = &sClassDropdown, [WidgetComboBoxE] = &sClassComboBox, [WidgetProgressBarE] = &sClassProgressBar, [WidgetSliderE] = &sClassSlider, [WidgetTabControlE] = &sClassTabControl, [WidgetTabPageE] = &sClassTabPage, [WidgetStatusBarE] = &sClassStatusBar, [WidgetToolbarE] = &sClassToolbar, [WidgetTreeViewE] = &sClassTreeView, [WidgetTreeItemE] = &sClassTreeItem, [WidgetImageE] = &sClassImage, [WidgetImageButtonE] = &sClassImageButton, [WidgetCanvasE] = &sClassCanvas, [WidgetAnsiTermE] = &sClassAnsiTerm, [WidgetListViewE] = &sClassListView, [WidgetSpinnerE] = &sClassSpinner, [WidgetScrollPaneE] = &sClassScrollPane };