bool
WndProperty::on_mouse_down(int x, int y)
{
  if (mDialogStyle) {
    BeginEditing();
  } else {
    if (!edit.has_focus()) {
      if (!edit.is_read_only())
        edit.set_focus();

      return true;
    }

    RasterPoint Pos;
    Pos.x = x;
    Pos.y = y;
    //POINTSTOPOINT(Pos, MAKEPOINTS(lParam));

    mDownDown = (PtInRect(&mHitRectDown, Pos) != 0);
    if (mDownDown) {
      DecValue();
      invalidate(mHitRectDown);
    }

    mUpDown = (PtInRect(&mHitRectUp, Pos) != 0);
    if (mUpDown) {
      IncValue();
      invalidate(mHitRectUp);
    }

    set_capture();
  }

  return true;
}
Beispiel #2
0
ParseSize::ParseSize(const char *s)
 {
  Size result=0;  
    
  for(int d; (d=DecValue(*s))>=0 ;s++) result=10*result+d;  
 
  value=result;
  str=s;
 }
Beispiel #3
0
bool
WndProperty::on_mouse_down(int x, int y)
{
  POINT Pos;

  if (mDialogStyle) {
    if (!edit.is_read_only()) {
      // when they click on the label
      SingleWindow *root = (SingleWindow *)get_root_owner();

      /* if this asserton fails, then there no valid root window could
         be found - maybe it didn't register its wndproc? */
      assert(root != NULL);

      dlgComboPicker(*root, this);
    } else {
      OnHelp(); // this would display xml file help on a read-only wndproperty if it exists
    }
  } else {
    if (!edit.has_focus()) {
      if (!edit.is_read_only())
        edit.set_focus();

      return true;
    }

    Pos.x = x;
    Pos.y = y;
    //POINTSTOPOINT(Pos, MAKEPOINTS(lParam));

    mDownDown = (PtInRect(&mHitRectDown, Pos) != 0);
    if (mDownDown) {
      DecValue();
      invalidate(mHitRectDown);
    }

    mUpDown = (PtInRect(&mHitRectUp, Pos) != 0);
    if (mUpDown) {
      IncValue();
      invalidate(mHitRectUp);
    }

    set_capture();
  }

  return true;
}
Beispiel #4
0
Widget * SpinButton::ClickUp(const Point2i & mousePosition,
                             uint button)
{
  NeedRedrawing();

  bool is_click = Mouse::IS_CLICK_BUTTON(button);
  if ((button == SDL_BUTTON_WHEELDOWN && Contains(mousePosition)) ||
      (is_click && m_minus->Contains(mousePosition))){
    DecValue();
    return this;
  } else if ((button == SDL_BUTTON_WHEELUP && Contains(mousePosition)) ||
             (is_click && m_plus->Contains(mousePosition))){
    IncValue();
    return this;
  }
  return NULL;
}