Esempio n. 1
0
LONG CSkinItemEdit::GetBorderHelper(LONG clrNormal, LONG clrHover, LONG clrFocus, LONG clrReadOnly, LONG clrDisabled)
{
    LONG color = 0;

    if (IsReadOnly() && m_bReadOnlyBorder) {
        color = clrReadOnly;
    } else if (IsFocused() && m_bFocusBorder) {
        color = clrFocus;
    } else if (IsHot()) {
        color = clrHover;
    } else {
        color = clrNormal;
    }

    if (GetDisabled())
        color = clrDisabled;

    if (color == -1)
        color = clrNormal;

    if (color == -1)
        return -1;

    if (GetColorTransform()) {
        GetEngine()->TransformColor(color, color);
    }

    return color;
}
void g2Slider::Render(int pX, int pY)
{
    // Center on the vertical the user's slider controller
    int SliderWidth, SliderHeight;
    int ControllerHeight;
    GetTheme()->GetComponentSize(g2Theme_SliderButton, &SliderWidth, &SliderHeight);
    GetTheme()->GetComponentSize(g2Theme_Slider, NULL, &ControllerHeight);
    
    // Which is the total height? We may need to shift the slider's background
    // since some slider buttons are taller than the bg
    int TotalHeight = SliderHeight;
    if(ControllerHeight > TotalHeight)
        TotalHeight = ControllerHeight;
    
    // Render the centered background
    DrawComponentStretch(g2Theme_Slider, pX, pY + TotalHeight / 2 - ControllerHeight / 2, Width);
    
    // Draw slider button
    g2ThemeElement ButtonStyle = g2Theme_SliderButton;
    if(GetDisabled())
        ButtonStyle = g2Theme_SliderButton_Disabled;
    else if(IsDragging || GetControllerState() == g2ControllerState_Pressed)
        ButtonStyle = g2Theme_SliderButton_Pressed;
    
    // Computer offsets
    float ProgressRatio = Progress / fabs(MaxBound - MinBound);
    int OffsetX = g2Slider_SidePixelBuffer + int(float(Width - 2 * g2Slider_SidePixelBuffer) * ProgressRatio) - SliderWidth / 2;
    
    // Draw the slider button itself
    DrawComponent(ButtonStyle, pX + OffsetX, pY + TotalHeight / 2 - SliderHeight / 2);
}
Esempio n. 3
0
nsresult
nsHTMLTextAreaElement::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
{
  // Do not process any DOM events if the element is disabled
  aVisitor.mCanHandle = PR_FALSE;
  PRBool disabled;
  nsresult rv = GetDisabled(&disabled);
  if (NS_FAILED(rv) || disabled) {
    return rv;
  }

  nsIFormControlFrame* formControlFrame = GetFormControlFrame(PR_FALSE);
  nsIFrame* formFrame = nsnull;

  if (formControlFrame &&
      (formFrame = do_QueryFrame(formControlFrame))) {
    const nsStyleUserInterface* uiStyle = formFrame->GetStyleUserInterface();

    if (uiStyle->mUserInput == NS_STYLE_USER_INPUT_NONE ||
        uiStyle->mUserInput == NS_STYLE_USER_INPUT_DISABLED) {
      return NS_OK;
    }
  }

  // Don't dispatch a second select event if we are already handling
  // one.
  if (aVisitor.mEvent->message == NS_FORM_SELECTED) {
    if (mHandlingSelect) {
      return NS_OK;
    }
    mHandlingSelect = PR_TRUE;
  }

  // If NS_EVENT_FLAG_NO_CONTENT_DISPATCH is set we will not allow content to handle
  // this event.  But to allow middle mouse button paste to work we must allow 
  // middle clicks to go to text fields anyway.
  if (aVisitor.mEvent->flags & NS_EVENT_FLAG_NO_CONTENT_DISPATCH)
    aVisitor.mItemFlags |= NS_NO_CONTENT_DISPATCH;
  if (aVisitor.mEvent->message == NS_MOUSE_CLICK &&
      aVisitor.mEvent->eventStructType == NS_MOUSE_EVENT &&
      static_cast<nsMouseEvent*>(aVisitor.mEvent)->button ==
        nsMouseEvent::eMiddleButton) {
    aVisitor.mEvent->flags &= ~NS_EVENT_FLAG_NO_CONTENT_DISPATCH;
  }

  // Fire onchange (if necessary), before we do the blur, bug 370521.
  if (aVisitor.mEvent->message == NS_BLUR_CONTENT) {
    nsIFrame* primaryFrame = GetPrimaryFrame();
    if (primaryFrame) {
      nsITextControlFrame* textFrame = do_QueryFrame(primaryFrame);
      if (textFrame) {
        textFrame->CheckFireOnChange();
      }
    }
  }

  return nsGenericHTMLFormElement::PreHandleEvent(aVisitor);
}
Esempio n. 4
0
BOOL CSkinText::OnMouseLeave()
{
    if(	GetDisabled() ) {
        return FALSE;
    }

    m_enMouseState = MOUSE_NORMAL;
	InvalidateRect();

	return CSkinBase::OnMouseLeave();
}
Esempio n. 5
0
// CSkinText message handlers
BOOL CSkinText::OnMouseEnter()
{
    if(	GetDisabled() ) {
        return FALSE;
    }

    m_enMouseState = MOUSE_HOVER;
	InvalidateRect();

	return CSkinBase::OnMouseEnter();
}
void g2TextField::Render(int pX, int pY)
{
    /*** Draw Background (Text field) ***/
    
    // What state is the component currently in?
    g2ThemeElement TextFieldState = g2Theme_TextField;
    if(GetDisabled())
        TextFieldState = g2Theme_TextField_Disabled;
    
    // Render the background
    DrawComponentStretch(TextFieldState, pX, pY, Width);
    
    // The editable text field will draw itself
}
void g2Controller::__MouseClick(g2MouseButton button, g2MouseClick state, int x, int y)
{
    // Ignore if not visible
    if(!GetVisibility())
        return;
    
    // Update mouse to localized positions
    x -= pX;
    y -= pY;
    
    // Are we in this object's volume and do we have a full left-click?
    if(InController(x, y) && button == g2MouseButton_Left && state == g2MouseClick_Down)
        ControllerState = g2ControllerState_Pressed;
    
    // Else, if there is a mouse release AND we are coming from a pressed state....
    else if(InController(x, y) && button == g2MouseButton_Left && state == g2MouseClick_Up && ControllerState == g2ControllerState_Pressed)
        ControllerState = g2ControllerState_Clicked;
    
    // Else, reset to either hover or none...
    else if(InController(x, y))
        ControllerState = g2ControllerState_Hover;
    
    // Else, no hovering, just nothing
    else
        ControllerState = g2ControllerState_None;
    
    // Update mouse click
    MouseClick(button, state, x, y);
    
    // Update all children
    int QueueSize = (int)ChildObjects.size();
    for(int i = 0; i < QueueSize; i++)
    {
        // Get child
        g2Controller* Child = ChildObjects.front();
        ChildObjects.pop();
        
        // Update child window event
        Child->__MouseClick(button, state, x, y);
        
        // Put back
        ChildObjects.push(Child);
    }
    
    // Execute callback
    if(!GetDisabled() && GetControllerState() == g2ControllerState_Clicked && PressedCallback != 0)
        PressedCallback(this);
}
Esempio n. 8
0
void g2Spinner::Render(int pX, int pY)
{
    // Source texture coordinates for spinner
    float SourceX, SourceY, SourceWidth, SourceHeight;
    int OutWidth, OutHeight;
    GetTheme()->GetComponent(g2Theme_Spinner_Pressed, &SourceX, &SourceY, &SourceWidth, &SourceHeight, &OutWidth, &OutHeight);
    
    // Compute the offsets based on the size of the text field
    int OffsetX = TextField->GetWidth();
    int OffsetY = 0;
    GetTheme()->GetComponentSize(g2Theme_TextField, NULL, &OffsetY);
    OffsetY = OffsetY / 2 - OutHeight / 2; // Centered vertically
    
    // Is the user's mouse on the top or bottom of the button?
    // Note the ternary comparison operator to do the half-height offset
    bool IsAbove = (MouseY < (OffsetY + (OutHeight / 2)));
    bool IsVerticalBound = (MouseY >= OffsetY && MouseY <= (OffsetY + OutHeight));
    
    // Disabled
    if(GetDisabled())
        DrawComponent(g2Theme_Spinner_Disabled, pX + OffsetX, pY + OffsetY);
    
    // Actively pressed on the buttons, need to draw only the pressed button
    else if( ((ControllerState & g2ControllerState_Pressed) == g2ControllerState_Pressed) && MouseX > TextField->GetWidth() && IsVerticalBound )
    {
        // Draw background normally, then draw the pressed button
        DrawComponent(g2Theme_Spinner, pX + OffsetX, pY + OffsetY);
        DrawComponent(pX + OffsetX, pY + OffsetY + (IsAbove ? 0 : (OutHeight / 2)), OutWidth, OutHeight / 2, SourceX, SourceY + (SourceHeight / 2.0f) * (IsAbove ? 0.0f : 1.0f), SourceWidth, SourceHeight / 2.0f);
    }
    // Normal
    else
        DrawComponent(g2Theme_Spinner, pX + OffsetX, pY + OffsetY);
    
    // Increase or decrease the value based on timing
    if((PressedTime > (g2Spinner_UpdateRate + g2Spinner_UpdateMin)) || (((ControllerState & g2ControllerState_Clicked) == g2ControllerState_Clicked) && MouseX > TextField->GetWidth() && IsVerticalBound))
    {
        if(IsAbove)
            IncrementUp();
        else
            IncrementDown();
        
        PressedTime -= g2Spinner_UpdateRate;
    }
    
    // Set the live value based on what the field currently has
    if(LiveValue != NULL)
        *LiveValue = (Type == g2SpinnerType_Float) ? GetFloat() : (float)GetInt();
}
Esempio n. 9
0
BOOL CSkinText::OnLButtonDown(LONG x, LONG y, UINT flag)
{
    if(	GetDisabled() ) {
        return FALSE;
    }

	if (IsPointInSkinRgn(x, y)) {
		SetCaptureSkin();
	} else {
		ReleaseCaptureSkin();
	}

	m_enMouseState = MOUSE_DOWN;
	InvalidateRect();

	return CSkinBase::OnLButtonDown(x, y, flag);
}
Esempio n. 10
0
HCURSOR CSkinText::GetSkinCursor(LPPOINT lpPoint)
{
	if (lpPoint == NULL)
		return NULL;

    if (GetDisabled())
        return NULL;

	if (m_rcTextArea.PtInRect(*lpPoint)) {
        if (m_hCursor)
		    return m_hCursor;
        if (m_hSysCursor)
            return m_hSysCursor;
        return NULL;
	} else {
		return NULL;
	}
}
Esempio n. 11
0
void g2RadioGroup::Render(int pX, int pY)
{
    // Get the size of a radio button
    int RadioHeight;
    GetTheme()->GetComponentSize(g2Theme_RadioButton, NULL, &RadioHeight);
    
    // For each option; draw with a pixel buffer
    for(int i = 0; i < OptionCount; i++)
    {
        // Draw the radio button
        if(GetDisabled())
            DrawComponent((i == ActiveIndex) ? g2Theme_RadioButton_Pressed_Disabled : g2Theme_RadioButton_Disabled, pX, pY + i * (RadioHeight + 1));
        else
            DrawComponent((i == ActiveIndex) ? g2Theme_RadioButton_Pressed : g2Theme_RadioButton, pX, pY + i * (RadioHeight + 1));
    }
    
    // Note that labels self-draw as they are registered as children
}
Esempio n. 12
0
NS_IMETHODIMP
nsHTMLTextAreaElement::SaveState()
{
  nsresult rv = NS_OK;

  // Only save if value != defaultValue (bug 62713)
  nsPresState *state = nsnull;
  if (mValueChanged) {
    rv = GetPrimaryPresState(this, &state);
    if (state) {
      nsAutoString value;
      GetValueInternal(value, PR_TRUE);

      rv = nsLinebreakConverter::ConvertStringLineBreaks(
               value,
               nsLinebreakConverter::eLinebreakPlatform,
               nsLinebreakConverter::eLinebreakContent);
      NS_ASSERTION(NS_SUCCEEDED(rv), "Converting linebreaks failed!");

      nsCOMPtr<nsISupportsString> pState
        (do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID));
      if (!pState) {
        return NS_ERROR_OUT_OF_MEMORY;
      }
      pState->SetData(value);
      state->SetStateProperty(pState);
    }
  }

  if (mDisabledChanged) {
    if (!state) {
      rv = GetPrimaryPresState(this, &state);
    }
    if (state) {
      PRBool disabled;
      GetDisabled(&disabled);
      state->SetDisabled(disabled);
    }
  }
  return rv;
}
Esempio n. 13
0
BOOL CSkinText::OnLButtonUp(LONG x, LONG y, UINT flag)
{
    if(	GetDisabled() ) {
        return FALSE;
    }

    CSkinBase* pCapture = NULL;
	if (GetCaptureSkin(&pCapture)) {
		if (pCapture == this 
			&& IsPointInSkinRgn(x, y) 
			&& m_rcTextArea.PtInRect(CPoint(x, y)) )
		{
			OnClick(0);
		}
	}
	ReleaseCaptureSkin();

	m_enMouseState = MOUSE_HOVER;
	InvalidateRect();

	return CSkinBase::OnLButtonUp(x, y, flag);
}
Esempio n. 14
0
BOOL CSkinItemEdit::CtlColor(CDC* pDC, CWnd* pWnd, HBRUSH& hBrush)
{
    if (m_bSelfOnCtlColor)
        return FALSE;

    if (IsReadOnly() && !GetDisabled()) {
        hBrush = NULL;
        BOOL bCtlColor = FALSE;
        CRect skinRect = GetSkinAbsRect();
        m_brushBk.DeleteObject();
        if (m_clrBkColorReadOnly != -1){
            LONG transedColor = m_clrBkColorReadOnly;
            if (m_bColorTransform && m_bBkColorTransform)
                GetEngine()->TransformColor(transedColor, transedColor);
            pDC->SetBkColor(transedColor);
            m_brushBk.CreateSolidBrush(transedColor);
            bCtlColor = TRUE;
        }
        int textColor = GettextColorReadOnly();
        if (textColor == -1) {
            textColor = GettextColorNormal();
        }
        if (textColor != -1) {
            pDC->SetTextColor(textColor);
        }
        if (m_pbkImageNormal != NULL){
            m_pbkImageNormal->Draw(*pDC, &skinRect, NULL, GetImageParam());
        }
        if (bCtlColor) {
            hBrush = m_brushBk;
            return TRUE;
        }
        return CSkinItem::CtlColor(pDC, pWnd, hBrush);
    } else {
        return CSkinItem::CtlColor(pDC, pWnd, hBrush);
    }
}
Esempio n. 15
0
NS_IMETHODIMP
nsHTMLTextAreaElement::SubmitNamesValues(nsIFormSubmission* aFormSubmission,
                                         nsIContent* aSubmitElement)
{
  nsresult rv = NS_OK;

  //
  // Disabled elements don't submit
  //
  PRBool disabled;
  rv = GetDisabled(&disabled);
  if (NS_FAILED(rv) || disabled) {
    return rv;
  }

  //
  // Get the name (if no name, no submit)
  //
  nsAutoString name;
  if (!GetAttr(kNameSpaceID_None, nsGkAtoms::name, name)) {
    return NS_OK;
  }

  //
  // Get the value
  //
  nsAutoString value;
  GetValueInternal(value, PR_FALSE);

  //
  // Submit
  //
  rv = aFormSubmission->AddNameValuePair(this, name, value);

  return rv;
}
Esempio n. 16
0
void g2LabelEdit::KeyEvent(unsigned char key, bool IsSpecial)
{
    // In OSX the backspace maps to DEL while DEL maps to backspace, need to swap
    #if __APPLE__
    if(key == 127)
        key = 8;
    else if(key == 8)
        key = 127;
    #endif
    
    // Ignore all inputs if disabled
    if(GetDisabled())
        return;
    
    /*** User Movement / Editing ***/
    
    // If system key (i.e. left/right)
    else if(IsSpecial)
    {
        // Move far left/right
        if(key == GLUT_KEY_LEFT && glutGetModifiers() == GLUT_ACTIVE_CTRL)
        {
            CursorIndex = 0;
            ViewIndex = 0;
        }
        else if(key == GLUT_KEY_RIGHT && glutGetModifiers() == GLUT_ACTIVE_CTRL)
        {
            // Move the cursor to the far right and calculate
            // what is the best position for the view buffer to be moved to
            CursorIndex = (int)strlen(TextBuffer);
            
            // When something is written on-screen, check to see where our
            // left-view limit should be
            ViewIndex = (int)strlen(TextBuffer) - RenderableLeftChars(CursorIndex);
        }
        
        // If left/right, move the cursor
        if(key == GLUT_KEY_LEFT && CursorIndex > 0)
        {
            // Move cursor to left
            CursorIndex--;
            
            // Move view left if we can
            if(CursorIndex < ViewIndex)
                ViewIndex--;
        }
        else if(key == GLUT_KEY_RIGHT && CursorIndex < (int)strlen(TextBuffer))
        {
            // Move cursor to right
            CursorIndex++;
            
            // If the movement will cause us to be offsreen..
            while(LengthToCursor() > Width)
                ViewIndex++;
        }
    }
    
    // Backspace
    else if(key == 8)
    {
        // Is there anything to delete?
        if(strlen(TextBuffer) <= 0)
            return;
        // Ignore if we are at the 0 position
        else if(CursorIndex <= 0)
            return;
        else
        {
            // Delete this character by shifting everything from right to left by 1
            // Note that this copies the null terminator
            for(size_t i = CursorIndex; i <= strlen(TextBuffer); i++)
                TextBuffer[i - 1] = TextBuffer[i];
            
            // Decrease the cursor position
            CursorIndex--;
            
            // Is the cursor now smaller than the current view index
            // Move view left if we can
            while(CursorIndex < ViewIndex)
            {
                ViewIndex -= 5;
                if(ViewIndex < 0)
                    ViewIndex = 0;
            }
        }
    }
    
    // Delete
    else if(key == 127)
    {
        // Is there anything to delete?
        if(CursorIndex >= (int)strlen(TextBuffer))
            return;
        else
        {
            // Delete this character by shifting everything from right to left by 1
            // Note that this copies the null terminator
            for(size_t i = CursorIndex; i < strlen(TextBuffer); i++)
                TextBuffer[i] = TextBuffer[i + 1];
            
            // Cursor does not move
        }
    }
    
    // Commit / enter
    else if(key == '\r')
    {
        DidUserReturn = true;
    }
    
    /*** Cut, Copy, or Paste ***/
    
    // Note that when doing a ctrl+key event, the given number
    // is offset from 'a', meaning true ascii = 'a' - key + 1
    
    // Cut text
    else if(key == ('x' - 'a' + 1) && glutGetModifiers() == GLUT_ACTIVE_CTRL)
    {
        // Copy into buffer, then set text to empty
        CopyBuffer();
        SetText("");
    }
    
    // Copy text
    else if(key == ('c' - 'a' + 1) && glutGetModifiers() == GLUT_ACTIVE_CTRL)
    {
        // Direct copy
        CopyBuffer();
    }
    
    // Paste text
    else if(key == ('v' - 'a' + 1) && glutGetModifiers() == GLUT_ACTIVE_CTRL)
    {
        // Direct paste
        PasteBuffer();
    }
    
    /*** Regular User Input ***/
    
    // Standard keyboard input; add character
    else if(isprint(key) != 0)
    {
        // Can we actually add anything?
        if(strlen(TextBuffer) < g2LabelEdit_TextBufferLength - 1 && !IsSpecial)
        {
            // Ignore if it isn't a valid character
            if(!InFilter(key))
                return;
            
            // If we are writing to the end, make sure to string-cap
            if(CursorIndex == (int)strlen(TextBuffer))
            {
                // Write to the old string-end and move the terminator a little further
                TextBuffer[CursorIndex + 0] = key;
                TextBuffer[CursorIndex + 1] = '\0';
            }
            // Offset one char to the right, then set
            else
            {
                // Null-terminate the end of the string
                int Length = (int)strlen(TextBuffer);
                for(int i = Length; i > CursorIndex; i--)
                    TextBuffer[i] = TextBuffer[i - 1];
                TextBuffer[CursorIndex] = key;
                TextBuffer[Length + 1] = '\0';
            }
            
            // Grow cursor position to be after the current char
            CursorIndex++;
        }
        
        // If the movement will cause us to be offsreen..
        while(LengthToCursor() > Width)
            ViewIndex++;
    }
    
    // All done for each type of event
}
Esempio n. 17
0
void g2LabelEdit::Render(int pX, int pY)
{
    // Ignore if not null
    if(TextBuffer == NULL)
        return;
    
    // Total offset from the far left
    int OffsetX = 0;
    
    // For each character...
    for(size_t i = ViewIndex; i < strlen(TextBuffer); i++)
    {
        // Get target character and width
        int CharWidth;
        GetTheme()->GetCharacterSize(TextBuffer[i], &CharWidth, NULL);
        
        // Stop drawing if this one or the next character is out of bounds
        if((OffsetX + CharWidth) >= Width)
            break;
        
        // Draw shadow if on
        if(Shadow)
        {
            // Get active color for shadow
            float Sr, Sg, Sb;
            GetColor(&Sr, &Sg, &Sb);
            DrawCharacter(pX + OffsetX + 1, pY + 1, 1.0f, 1.0f, Sr, Sg, Sb, 0.2f, TextBuffer[i]);
        }
        
        // Render text normally
        DrawCharacter(pX + OffsetX, pY, TextBuffer[i]);
        
        // Grow the offset
        OffsetX += CharWidth + g2LabelEdit_CharacterSpacing;
    }
    
    // Draw the blinking cursor
    if(( (GetActive() && !GetDisabled()) || CursorAlwaysVisible ) && CursorState)
    {
        // Reset offset for rendering again
        OffsetX = 0;
        
        // Go through each character attempting to render
        for(size_t i = ViewIndex; i <= strlen(TextBuffer); i++)
        {
            // Draw and stop at the cursor index
            if((int)i == CursorIndex)
            {
                DrawCharacter(pX + OffsetX - 1, pY, '|');
                break;
            }
            
            // Grow offset
            int CharWidth;
            GetTheme()->GetCharacterSize(TextBuffer[i], &CharWidth, NULL);
            OffsetX += CharWidth + g2LabelEdit_CharacterSpacing;
        }
    }
    
    // Done with rendering...
}
Esempio n. 18
0
void g2Controller::__MouseClick(g2MouseButton button, g2MouseClick state, int x, int y)
{
    // Ignore if not visible
    if(!GetVisibility())
        return;
    
    // Update mouse to localized positions
    x -= pX;
    y -= pY;
    
    // Are we in this object's volume and do we have a full left-click?
    if(InController(x, y) && button == g2MouseButton_Left && state == g2MouseClick_Down)
        ControllerState |= g2ControllerState_Pressed;
    
    // Check for full click, if there is a mouse release AND we are coming from a pressed state....
    if(InController(x, y) && button == g2MouseButton_Left && state == g2MouseClick_Up && ((ControllerState & g2ControllerState_Pressed) == g2ControllerState_Pressed))
        ControllerState |= g2ControllerState_Clicked;
    
    // Are we no longer holding the mouse button down anymore?
    if((button == g2MouseButton_Left && state == g2MouseClick_Up) && ((ControllerState & g2ControllerState_Pressed) == g2ControllerState_Pressed))
        ControllerState ^= g2ControllerState_Pressed;
    
    // Update mouse click; save an older version of the controller state,
    // in case the user destroys the clicked flag by calling GetControllerState()
    g2ControllerState OldControllerState = ControllerState;
    MouseClick(button, state, x, y);
    
    // If it's anything non-key-release
    if(state != g2MouseClick_Up)
    {
        // Apply update to all non-blocked objects
        // We must go from front-to-back ordering (which is the reverse
        // of what the rendering ordering is)
        for(ChildObjectsRevIt Child = ChildObjects.rbegin(); Child != ChildObjects.rend(); Child++)
        {
            // Child position
            int cx, cy;
            (*Child)->GetPos(&cx, &cy);
            
            // Stop applying on our first collision if we are in that controller
            // and it's on-screen (regardless of it being enabled or not)
            // Note that we must localize the coordinate for each controller
            if((*Child)->GetVisibility() && (*Child)->InController(x -cx , y - cy))
            {
                (*Child)->__MouseClick(button, state, x, y);
                break;
            }
        }
    }
    // Else, apply release to everyone
    else
    {
        // Allow the recieving function to figure it's own event
        for(ChildObjectsRevIt Child = ChildObjects.rbegin(); Child != ChildObjects.rend(); Child++)
            (*Child)->__MouseClick(button, state, x, y);
    }
    
    // Execute callback (releases button-click flag)
    if(!GetDisabled() && ((OldControllerState & g2ControllerState_Clicked) == g2ControllerState_Clicked) && PressedCallback != 0)
    {
        // Callback and xor the controller state's click-event out
        PressedCallback(this);
    }
}