-/* TPPaneFocusProc is called when every the focus changes to or
-from our control. Herein, switch the focus appropriately
-according to the parameters and redraw the control as
-necessary. */
-static pascal ControlPartCode TPPaneFocusProc(ControlRef theControl, ControlFocusPart action) {
- ControlPartCode focusResult;
-
- focusResult = kControlFocusNoPart;
- wxTextCtrl* textctrl = (wxTextCtrl*) GetControlReference(theControl);
- if ( textctrl == NULL )
- return 0;
- TPUpdateVisibility( theControl ) ;
- STPTextPaneVars *varsp = (STPTextPaneVars *) ((wxMacMLTEClassicControl*)textctrl->GetPeer())->m_macTXNvars ;
- /* if kControlFocusPrevPart and kControlFocusNextPart are received when the user is
- tabbing forwards (or shift tabbing backwards) through the items in the dialog,
- and kControlFocusNextPart will be received. When the user clicks in our field
- and it is not the current focus, then the constant kUserClickedToFocusPart will
- be received. The constant kControlFocusNoPart will be received when our control
- is the current focus and the user clicks in another control. In your focus routine,
- you should respond to these codes as follows:
-
- kControlFocusNoPart - turn off focus and return kControlFocusNoPart. redraw
- the control and the focus rectangle as necessary.
-
- kControlFocusPrevPart or kControlFocusNextPart - toggle focus on or off
- depending on its current state. redraw the control and the focus rectangle
- as appropriate for the new focus state. If the focus state is 'off', return the constant
- kControlFocusNoPart, otherwise return a non-zero part code.
- kUserClickedToFocusPart - is a constant defined for this example. You should
- define your own value for handling click-to-focus type events. */
- /* calculate the next highlight state */
- switch (action) {
- default:
- case kControlFocusNoPart:
- TPFocusPaneText(varsp, false);
- focusResult = kControlFocusNoPart;
- break;
- case kUserClickedToFocusPart:
- TPFocusPaneText(varsp, true);
- focusResult = 1;
- break;