void ButtonPassive(Button *b, int x, int y) { if (b) { /* * if the mouse moved over the control */ if (ButtonClickTest(b, x, y)) { /* * If the cursor has just arrived over the control, set the highlighted flag * and force a redraw. The screen will not be redrawn again until the mouse * is no longer over this control */ if (b->highlighted == 0) { b->highlighted = 1; glutPostRedisplay(); } } else { /* * If the cursor is no longer over the control, then if the control * is highlighted (ie, the mouse has JUST moved off the control) then * we set the highlighting back to false, and force a redraw. */ if (b->highlighted == 1) { b->highlighted = 0; glutPostRedisplay(); } } } }
void ButtonRelease(Button *b, int x, int y) { if (b) { if (ButtonClickTest(b, TheMouse.xpress, TheMouse.ypress) && ButtonClickTest(b, x, y)) { if (b->callbackFunction) { b->callbackFunction(); } } b->state = 0; } }
void ButtonRelease(Button *b, int mCurX, int mCurY, int mPressX, int mPressY) { if (b) { /* * If the mouse button was pressed within the button area * as well as being released on the button..... */ if (ButtonClickTest(b, mPressX, mPressY) && ButtonClickTest(b, mCurX, mCurY)) { /* * Then if a callback function has been set, call it. */ if (b->callbackFunction) { if (b->cbOnRelease) { b->callbackFunction(); } else { if (b->type == Button::PRESS) { glutIdleFunc(NULL); } } } if (b->cbOnRelease && b->type == Button::TOGGLE) { b->mode = !b->mode; } } if (b->type == Button::TOGGLE) { glutIdleFunc(NULL); } if (b->type == Button::TOGGLE && b->mode) { b->state = 1; } else { b->state = 0; } } }
void ButtonPress(Button *b, int x, int y) { if (b) { if (ButtonClickTest(b, x, y)) { b->state = 1; } } }
void ButtonPress(Button *b, int x, int y) { if (b) { /* * if the mouse click was within the buttons client area, * set the state to true. */ if (ButtonClickTest(b, x, y)) { b->state = 1; if (!b->cbOnRelease) { b->mode = !b->mode; if ((b->type == Button::TOGGLE && b->mode && b->callbackFunction) || (b->type == Button::PRESS && b->callbackFunction)) { glutIdleFunc(b->callbackFunction); } } } } }
void ButtonPassive(Button *b, int x, int y) { if (b) { /* * if the mouse moved over the control */ if (ButtonClickTest(b, x, y)) { if (b->highlighted == 0) { b->highlighted = 1; glutPostRedisplay(); } } else if (b->highlighted == 1) { b->highlighted = 0; glutPostRedisplay(); } } }