void ChangeDisplay() { for (int i = 0; i < Length(notetops[0]); i++) { for (int j = 0; j < Length(notetops[0][0]); j++) { int k; switch (i) { case 0: k = (reverse)? Length(notetops[0][i]) - j - 2: j; break; case 1: k = (reverse)? Length(notetops[0][i]) - j - 1: j; break; case 2: k = (reverse)? Length(notetops[0][i]) - j - 2: j; break; } if (display[i][j] != NULL) { if (shownotes) { CFStringRef s = CFStringCreateWithCString(kCFAllocatorDefault, notetops[key][i][k], kCFStringEncodingMacRoman); HIViewSetText(display[i][j], s); CFRelease(s); } else HIViewSetText(display[i][j], CFSTR("")); if ((type == CHROMATIC) && (hilites[key][i][k] == true)) HIViewSetValue(display[i][j], true); else HIViewSetValue(display[i][j], false); } } } }
/***************************************************** * * Handle_PostLittleArrowsClick(inHandlerCallRef, inEvent, inUserData) * * Purpose: called to update the static text with the current value of the little arrows control * * Inputs: inHandlerCallRef - reference to the current handler call chain * inEvent - the event * inUserData - app-specified data you passed in the call to InstallEventHandler * * Returns: OSStatus - noErr indicates the event was handled * eventNotHandledErr indicates the event was not handled and the Toolbox should take over */ static pascal OSStatus Handle_PostLittleArrowsClick(EventHandlerCallRef inHandlerCallRef, EventRef inEvent, void *inUserData) { OSStatus status = eventNotHandledErr; ControlRef littleArrows = (ControlRef)inUserData; SInt32 value = GetControl32BitValue(littleArrows); HIViewID staticTextID = { 'STTC', 100 }; HIViewRef staticText; status = HIViewFindByID(HIViewGetRoot(GetControlOwner(littleArrows)), staticTextID, &staticText); require_noerr(status, HIViewFindByID); require(littleArrows != NULL, HIViewFindByID); CFStringRef theValueStr = CFStringCreateWithFormat(NULL, NULL, CFSTR("%ld"), value); require(theValueStr != NULL, CFStringCreateWithFormat); HIViewSetText(staticText, theValueStr); CFRelease(theValueStr); CFStringCreateWithFormat: HIViewFindByID: if (status == noErr) status = eventNotHandledErr; return status; } // Handle_PostLittleArrowsClick
/***************************************************** * * Handle_ControlValueFieldOrHiliteChanged(inHandlerCallRef, inEvent, inUserData) * * Purpose: called to handle the change of the value or hilite of our custom view, we update the static text field * * Inputs: inHandlerCallRef - reference to the current handler call chain * inEvent - the event * inUserData - app-specified data you passed in the call to InstallEventHandler * * Returns: OSStatus - noErr indicates the event was handled * eventNotHandledErr indicates the event was not handled and the Toolbox should take over */ static pascal OSStatus Handle_ControlValueFieldOrHiliteChanged(EventHandlerCallRef inHandlerCallRef, EventRef inEvent, void *inUserData) { OSStatus status; HIViewRef customView = (HIViewRef)inUserData; // Finding our static text control HIViewRef statText; status = HIViewFindByID(HIViewGetRoot(GetControlOwner(customView)), kStaticTextID, &statText); require_noerr(status, ExitValueFieldChanged); // Grabbing the fields that we are interested in CFStringRef theCFString = CFStringCreateWithFormat(NULL, NULL, CFSTR("Value: %ld, Min: %ld, Max: %ld, Hilite: %d"), GetControl32BitValue(customView), GetControl32BitMinimum(customView), GetControl32BitMaximum(customView), GetControlHilite(customView)); require(theCFString != NULL, ExitValueFieldChanged); // Setting the text in the control #ifdef MAC_OS_X_VERSION_10_4 status = HIViewSetText(statText, theCFString); #else status = SetControlData(statText, kControlEntireControl, kControlStaticTextCFStringTag, sizeof(theCFString), &theCFString); #endif require_noerr(status, ExitValueFieldChanged); CFRelease(theCFString); ExitValueFieldChanged: if (status == noErr) status = eventNotHandledErr; return status; } // Handle_ControlValueFieldOrHiliteChanged
void FilterWidget::setText(const QString &text) { CFRelease(searchFieldText); searchFieldText = CFStringCreateWithCString(0, (const char *)text.toAscii(), 0); HIViewSetText(searchField, searchFieldText); emit textChanged(text); }