/* Respond to the mouse moving off a label */ void labelHiLiteLost(W_LABEL *psWidget) { if (psWidget->pTip) { tipStop((WIDGET *)psWidget); } }
void W_BUTTON::clicked(W_CONTEXT *, WIDGET_KEY key) { dirty = true; /* Can't click a button if it is disabled or locked down */ if ((state & (WBUT_DISABLE | WBUT_LOCK)) == 0) { // Check this is the correct key if ((!(style & WBUT_NOPRIMARY) && key == WKEY_PRIMARY) || ((style & WBUT_SECONDARY) && key == WKEY_SECONDARY)) { if (AudioCallback) { AudioCallback(ClickedAudioID); } state &= ~WBUT_FLASH; // Stop it flashing state |= WBUT_DOWN; } } /* Kill the tip if there is one */ if (!pTip.empty()) { tipStop(this); } }
/* Respond to the mouse moving off a label */ void W_LABEL::highlightLost() { if (!pTip.isEmpty()) { tipStop(this); } }
/* Respond to a mouse click */ void formClicked(W_FORM *psWidget, UDWORD key) { W_CLICKFORM *psClickForm; /* Stop the tip if there is one */ tipStop((WIDGET *)psWidget); if (psWidget->style & WFORM_CLICKABLE) { /* Can't click a button if it is disabled or locked down */ if (!(((W_CLICKFORM *)psWidget)->state & (WCLICK_GREY | WCLICK_LOCKED))) { // Check this is the correct key if ((!(psWidget->style & WFORM_NOPRIMARY) && key == WKEY_PRIMARY) || ((psWidget->style & WFORM_SECONDARY) && key == WKEY_SECONDARY)) { ((W_CLICKFORM *)psWidget)->state &= ~WCLICK_FLASH; // Stop it flashing ((W_CLICKFORM *)psWidget)->state &= ~WCLICK_FLASHON; ((W_CLICKFORM *)psWidget)->state |= WCLICK_DOWN; psClickForm = (W_CLICKFORM *)psWidget; if(psClickForm->AudioCallback) { psClickForm->AudioCallback(psClickForm->ClickedAudioID); } } } } }
/* Respond to the mouse moving off a label */ void W_LABEL::highlightLost(W_CONTEXT *) { if (pTip) { tipStop(this); } }
/* Respond to the mouse moving off a button */ void buttonHiLiteLost(W_BUTTON *psWidget) { psWidget->state &= ~(WBUTS_DOWN | WBUTS_HILITE); if (psWidget->pTip) { tipStop((WIDGET *)psWidget); } }
/* Respond to the mouse moving off a label */ void labelHiLiteLost(W_LABEL *psWidget) { psWidget->state &= ~(WLABEL_HILITE); if (psWidget->pTip) { tipStop((WIDGET *)psWidget); } }
/* Respond to the mouse moving off a button */ void W_BUTTON::highlightLost() { state &= ~(WBUT_DOWN | WBUT_HIGHLIGHT); dirty = true; if (!pTip.empty()) { tipStop(this); } }
WIDGET::~WIDGET() { setScreenPointer(nullptr); // Clear any pointers to us directly from screenPointer. tipStop(this); // Stop showing tooltip, if we are. if (parentWidget != nullptr) { parentWidget->detach(this); } for (unsigned n = 0; n < childWidgets.size(); ++n) { childWidgets[n]->parentWidget = nullptr; // Detach in advance, slightly faster than detach(), and doesn't change our list. delete childWidgets[n]; } }
/* Respond to the mouse moving off a form */ void formHiLiteLost(W_FORM *psWidget, W_CONTEXT *psContext) { /* If one of the widgets were hilited that has to loose it as well */ if (psWidget->psLastHiLite != NULL) { widgHiLiteLost(psWidget->psLastHiLite, psContext); } if (psWidget->style & WFORM_TABBED) { ((W_TABFORM *)psWidget)->tabHiLite = (UWORD)(-1); } if (psWidget->style & WFORM_CLICKABLE) { ((W_CLICKFORM *)psWidget)->state &= ~(WCLICK_DOWN | WCLICK_HILITE); } /* Clear the tool tip if there is one */ tipStop((WIDGET *)psWidget); }
/* Respond to a mouse click */ void buttonClicked(W_BUTTON *psWidget, UDWORD key) { /* Can't click a button if it is disabled or locked down */ if (!(psWidget->state & (WBUTS_GREY | WBUTS_LOCKED))) { // Check this is the correct key if ((!(psWidget->style & WBUT_NOPRIMARY) && key == WKEY_PRIMARY) || ((psWidget->style & WBUT_SECONDARY) && key == WKEY_SECONDARY)) { if(psWidget->AudioCallback) { psWidget->AudioCallback(psWidget->ClickedAudioID); } psWidget->state &= ~WBUTS_FLASH; // Stop it flashing psWidget->state &= ~WBUTS_FLASHON; psWidget->state |= WBUTS_DOWN; } } /* Kill the tip if there is one */ if (psWidget->pTip) { tipStop((WIDGET *)psWidget); } }
/* Respond to the mouse moving off a barGraph */ void W_BARGRAPH::highlightLost() { tipStop(this); }
/* Run a form widget */ void formRun(W_FORM *psWidget, W_CONTEXT *psContext) { SDWORD mx,my; TAB_POS sTabPos; char *pTip; W_TABFORM *psTabForm; memset(&sTabPos, 0x0, sizeof(TAB_POS)); if(psWidget->style & WFORM_CLICKABLE) { if(((W_CLICKFORM *)psWidget)->state & WCLICK_FLASH) { if (((realTime/250) % 2) == 0) { ((W_CLICKFORM *)psWidget)->state &= ~WCLICK_FLASHON; } else { ((W_CLICKFORM *)psWidget)->state |= WCLICK_FLASHON; } } } if (psWidget->style & WFORM_TABBED) { mx = psContext->mx; my = psContext->my; psTabForm = (W_TABFORM *)psWidget; /* If the mouse is over the form, see if any tabs need to be hilited */ if (mx >= 0 && mx <= psTabForm->width && my >= 0 && my <= psTabForm->height) { if (formPickTab(psTabForm, mx,my, &sTabPos)) { if (psTabForm->tabHiLite != (UWORD)sTabPos.index) { /* Got a new tab - start the tool tip if there is one */ psTabForm->tabHiLite = (UWORD)sTabPos.index; if (sTabPos.index >= psTabForm->numMajor) { pTip = psTabForm->asMajor[psTabForm->majorT]. asMinor[sTabPos.index - psTabForm->numMajor].pTip; } else { pTip = psTabForm->asMajor[sTabPos.index].pTip; } if (pTip) { /* Got a tip - start it off */ tipStart((WIDGET *)psTabForm, pTip, psContext->psScreen->TipFontID, psTabForm->aColours, sTabPos.x + psContext->xOffset, sTabPos.y + psContext->yOffset, sTabPos.width,sTabPos.height); } else { /* No tip - clear any old tip */ tipStop((WIDGET *)psWidget); } } } else { /* No tab - clear the tool tip */ tipStop((WIDGET *)psWidget); /* And clear the hilite */ psTabForm->tabHiLite = (UWORD)(-1); } } } }
/* Respond to the mouse moving off a barGraph */ void barGraphHiLiteLost(W_BARGRAPH *psWidget) { tipStop((WIDGET *)psWidget); }