Example #1
0
void OpenUserDataRec::EventProcCBEventMouseDown(NavCBRecPtr callBackParms)
{
    EventRecord *evt = callBackParms->eventData.eventDataParms.event;
    Point where = evt->where;
    QDGlobalToLocalPoint(GetWindowPort(callBackParms->window), &where);

    ControlRef whichControl = FindControlUnderMouse(where, callBackParms->window, NULL);
    if (whichControl != NULL)
    {
        ControlKind theKind;
        GetControlKind(whichControl, &theKind);

        // Moving the focus if we clicked in an focusable control
        if ((theKind.kind == kControlKindEditUnicodeText) ||
            (theKind.kind == kControlKindEditText) ||
            (theKind.kind == kControlKindDataBrowser) ||
            (theKind.kind == kControlKindListBox))
        {
            ControlRef currentlyFocusedControl;
            GetKeyboardFocus(callBackParms->window, &currentlyFocusedControl);
            if (currentlyFocusedControl != whichControl)
                SetKeyboardFocus(callBackParms->window, whichControl, kControlFocusNextPart);
        }
        HandleControlClick(whichControl, where, evt->modifiers, NULL);
    }
}
Example #2
0
AUI_ERRCODE aui_Control::ResetThis( void )
{
	if ( GetMouseOwnership() == this ) ReleaseMouseOwnership();
	if ( GetKeyboardFocus() == this ) ReleaseKeyboardFocus();

	ResetCurrentRenderFlags();

	return aui_Region::ResetThis();
}
Example #3
0
aui_Control *aui_Control::SetKeyboardFocus( void )
{
	aui_Control *   prevFocus = GetKeyboardFocus();
	if ( prevFocus ) prevFocus->ReleaseKeyboardFocus();

	if (!IsDisabled())
	{
		s_whichHasFocus = this;
		m_draw |= m_drawMask & k_AUI_REGION_DRAWFLAG_KEYBOARDFOCUSCHANGE;
	}

	return prevFocus;
}
Example #4
0
AUI_ERRCODE aui_Control::ReleaseKeyboardFocus(void)
{
	if (GetKeyboardFocus() != this)
	    return AUI_ERRCODE_NOCONTROL;

	s_whichHasFocus = NULL;
    m_draw |= m_drawMask & k_AUI_REGION_DRAWFLAG_KEYBOARDFOCUSCHANGE;

    if (g_ui)
    {
#ifdef WIN32
	    SetFocus(g_ui->TheHWND());
#else
        extern class aui_Win* g_winFocus;
        g_winFocus = 0;
#endif
    }

    return AUI_ERRCODE_OK;
}
Example #5
0
static void RunDialogTheMacOS8or9Way(DialogRef theDialog)
{
	SInt16 itemHit;
	ControlRef theControl;
	ControlRef  theTextControl;
	
	BringToFront(GetDialogWindow(theDialog));
	
	do {
		ModalDialog(MyMacOS8or9DialogFilter, &itemHit);
		switch (itemHit)
		{
			case 2:
			{
				// we still enable or disable the user pane depending on whether the box is checked or not
				GetDialogItemAsControl(theDialog, itemHit, &theControl);
				SInt32 enable = GetControl32BitValue(theControl);
				SetControl32BitValue(theControl, 1 - enable);
				GetDialogItemAsControl(theDialog, 13, &theControl);
				if (!enable)
					ActivateControl(theControl);
				else
					DeactivateControl(theControl);
			}
				break;
			case 9: case 10:
			{
				// we got a click in an edit text control, if didn't have the focus, let's set it
				GetDialogItemAsControl(theDialog, itemHit, &theTextControl);
				ControlRef currentFocus;
				GetKeyboardFocus(GetDialogWindow(theDialog), &currentFocus);
				if (currentFocus != theTextControl)
					SetKeyboardFocus(GetDialogWindow(theDialog), theTextControl, kControlFocusNextPart);
			}
				break;
		}
	} while (!(itemHit == ok));
	
	DisposeDialog(theDialog);
}