static void setgrcg(ControlHandle *btn, UINT grcg) { SetControlValue(btn[0], (grcg == 0)?1:0); SetControlValue(btn[1], (grcg == 1)?1:0); SetControlValue(btn[2], (grcg == 2)?1:0); SetControlValue(btn[3], (grcg == 3)?1:0); }
static DialogRef DrawDialogTheSystem6or7Way(void) { DialogItemType itemType; Handle itemHandle; Rect itemBox; DialogRef theDialog = GetNewDialog(256, NULL, (WindowRef)-1L); if (theDialog == NULL) return(NULL); // Move it! MoveWindow(GetDialogWindow(theDialog), 10, 271, false); // Setting the check box GetDialogItem(theDialog, 2, &itemType, &itemHandle, &itemBox); SetControlValue((ControlHandle)itemHandle, 1); // Setting a radio button GetDialogItem(theDialog, 3, &itemType, &itemHandle, &itemBox); SetControlValue((ControlHandle)itemHandle, 1); // Setting the draw proc for the user item GetDialogItem(theDialog, 13, &itemType, &itemHandle, &itemBox); gUserH = (itemBox.left + itemBox.right) / 2; gUserV = (itemBox.top + itemBox.bottom) / 2; SetDialogItem(theDialog, 13, itemType, (Handle)&MyDrawUserItem, &itemBox); // Setting the action proc for the scroll bar so that the PageUp/PageDown/Up/Down buttons work GetDialogItem(theDialog, 14, &itemType, &itemHandle, &itemBox); SetControlAction((ControlHandle)itemHandle, ScrollBarActionProc); ShowWindow(GetDialogWindow(theDialog)); return(theDialog); }
void structGuiRadioButton :: f_set () { /* * The value should be set without calling the valueChanged callback. */ #if gtk g_signal_handler_disconnect (GTK_TOGGLE_BUTTON (d_widget), d_valueChangedHandlerId); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (d_widget), TRUE); d_valueChangedHandlerId = g_signal_connect (GTK_TOGGLE_BUTTON (d_widget), "toggled", G_CALLBACK (_GuiGtkRadioButton_handleToggle), this); #elif cocoa #elif win Button_SetCheck (d_widget -> window, BST_CHECKED); /* * Deselect the sister buttons. */ for (GuiRadioButton sibling = d_previous; sibling != NULL; sibling = sibling -> d_previous) { Button_SetCheck (sibling -> d_widget -> window, BST_UNCHECKED); } for (GuiRadioButton sibling = d_next; sibling != NULL; sibling = sibling -> d_next) { Button_SetCheck (sibling -> d_widget -> window, BST_UNCHECKED); } #elif mac SetControlValue (d_widget -> nat.control.handle, true); /* * Deselect the sister buttons. */ for (GuiRadioButton sibling = d_previous; sibling != NULL; sibling = sibling -> d_previous) { SetControlValue (sibling -> d_widget -> nat.control.handle, false); } for (GuiRadioButton sibling = d_next; sibling != NULL; sibling = sibling -> d_next) { SetControlValue (sibling -> d_widget -> nat.control.handle, false); } #endif }
void MPU98DialogProc(void) { DialogPtr hDlg; int done; short item; ControlHandle lst[2]; UINT8 mpu; short value; hDlg = GetNewDialog(IDD_MPU98II, NULL, (WindowPtr)-1); if (!hDlg) { return; } lst[0] = (ControlHandle)GetDlgItem(hDlg, IDC_MPUPORT); lst[1] = (ControlHandle)GetDlgItem(hDlg, IDC_MPUIRQ); mpu = np2cfg.mpuopt; SetControlValue(lst[0], ((mpu >> 4) & 15) + 1); SetControlValue(lst[1], (mpu & 3) + 1); SetDialogDefaultItem(hDlg, IDOK); done = 0; while(!done) { ModalDialog(NULL, &item); switch(item) { case IDOK: mpu = np2cfg.mpuopt; value = GetControlValue(lst[0]); if (value) { mpu &= ~0xf0; mpu |= (UINT8)((value - 1) << 4); } value = GetControlValue(lst[1]); if (value) { mpu &= ~0x03; mpu |= (UINT8)((value - 1) & 3); } if (np2cfg.mpuopt != mpu) { np2cfg.mpuopt = mpu; sysmng_update(SYS_UPDATEOSCFG); } done = IDOK; break; case IDCANCEL: done = IDCANCEL; break; case IDC_MPUDEF: SetControlValue(lst[0], ((0x82 >> 4) & 15) + 1); SetControlValue(lst[1], (0x82 & 3) + 1); break; } } DisposeDialog(hDlg); }
void tool_wind_switch_vertex_mode(void) { vertex_mode++; if (vertex_mode>vm_snap) vertex_mode=vm_none; SetControlValue(tool_ctrl[0],(vertex_mode==vm_none)?1:0); SetControlValue(tool_ctrl[1],(vertex_mode==vm_lock)?1:0); SetControlValue(tool_ctrl[2],(vertex_mode==vm_snap)?1:0); }
static int CreateApplicationWindow (AWindowRecord *wr, char *fname, short h, short v, short dh, short dv) { Rect r; GrafPtr myPort; PaletteHandle myPalette; char name[80]; /* init AWindowRecord */ wr->theWindow = (WindowPtr) wr; /* read in resources */ if (GetNewCWindow(appWinId,(Ptr)wr,(WindowPtr) -1)==NULL) { return(1); } myPalette = GetNewPalette(defaultPaletteId); SetPalette(wr->theWindow,myPalette,false); /* move and size window */ myPort = (GrafPtr) wr->theWindow; SetPort(myPort); MoveWindow(wr->theWindow,h,v,false); SizeWindow(wr->theWindow,dh+15,dv+15,false); strcpy(name,fname); SetWTitle(wr->theWindow,c2pstr(name)); ShowWindow(wr->theWindow); SelectWindow(wr->theWindow); DrawGrowIcon(wr->theWindow); r = myPort->portRect; TextFont(kFontIDMonaco); /* get the scroll bars */ wr->vScrollBar = GetNewControl(vScrollBarId,wr->theWindow); wr->hScrollBar = GetNewControl(hScrollBarId,wr->theWindow); /* set correct size of the scroll bars */ MoveControl(wr->vScrollBar,r.right-15,-1); SizeControl(wr->vScrollBar,16,r.bottom-13); SetControlMinimum(wr->vScrollBar,0); SetControlMaximum(wr->vScrollBar,0); SetControlValue(wr->vScrollBar,0); ShowControl(wr->vScrollBar); MoveControl(wr->hScrollBar,-1,r.bottom-15); SizeControl(wr->hScrollBar,r.right-13,16); SetControlMinimum(wr->hScrollBar,0); SetControlMaximum(wr->hScrollBar,0); SetControlValue(wr->hScrollBar,0); ShowControl(wr->hScrollBar); DrawControls(wr->theWindow); SetRect(&(wr->usableRect),0,0,dh,dv); return(0); }
static void ScrollBarActionProc(ControlRef theControl, ControlPartCode partCode) { SInt16 oldValue = GetControlValue(theControl); switch (partCode) { case kControlUpButtonPart: SetControlValue(theControl, oldValue - 1); break; case kControlDownButtonPart: SetControlValue(theControl, oldValue + 1); break; case kControlPageUpPart: SetControlValue(theControl, oldValue - 10); break; case kControlPageDownPart: SetControlValue(theControl, oldValue + 10); break; } }
static void RunDialogTheSystem6or7Way(DialogRef theDialog) { SInt16 itemHit; DialogItemType itemType; Handle itemHandle; Rect itemBox; BringToFront(GetDialogWindow(theDialog)); do { ModalDialog(MySystem6or7DialogFilter, &itemHit); switch (itemHit) { case 2: { // we enable or disable the user item depending on whether the box is checked or not GetDialogItem(theDialog, itemHit, &itemType, &itemHandle, &itemBox); SInt16 enable = GetControlValue((ControlHandle)itemHandle); SetControlValue((ControlHandle)itemHandle, 1 - enable); GetDialogItem(theDialog, 13, &itemType, &itemHandle, &itemBox); SetDialogItem(theDialog, 13, enable?userItem+itemDisable:userItem, itemHandle, &itemBox); HideDialogItem(theDialog, 13); ShowDialogItem(theDialog, 13); } break; case 3: case 4: case 5: case 6: case 7: { // one radio button was chosen, let's adjust them all (we could also remember the last one...) int i; for (i = 3; i <= 7; i++) { GetDialogItem(theDialog, i, &itemType, &itemHandle, &itemBox); SetControlValue((ControlHandle)itemHandle, (i == itemHit)?1:0); } } break; case 14: { // the indicator of the scroll bar was moved so let's display the value in the first edit box // this is System 6 or 7 style so the controls can only handle 16 bits value (hence a max of 32767) GetDialogItem(theDialog, itemHit, &itemType, &itemHandle, &itemBox); SInt16 newValue = GetControlValue((ControlHandle)itemHandle); Str255 theStr; NumToString(newValue, theStr); GetDialogItem(theDialog, 9, &itemType, &itemHandle, &itemBox); SetDialogItemText(itemHandle, theStr); SelectDialogItemText(theDialog, 9, 0, 32767); } break; } } while (!(itemHit == ok)); DisposeDialog(theDialog); }
bool CARBON_GUI::init_controls() { int i; for(i=0;i<MAIN_CONTROLS_NUM;i++) { err = GetControlByID(window,&mainControlsID[i],&mainControls[i]); if(err != noErr) { // printf("%d - %d - %d \n",i,mainControlsID[i].id,err); msg->error("Can't get control for button %d (%d)",i,err); } } /* By default start with live output enabled */ jmix->set_lineout(true); SetControlValue(mainControls[SNDOUT_BUT],1); /* install main event handler+ */ err = InstallWindowEventHandler (window, NewEventHandlerUPP (MainWindowEventHandler), GetEventTypeCount(events), events, this, NULL); if(err != noErr) msg->error("Can't install main eventHandler"); /* install main command handler */ err = InstallWindowEventHandler (window, NewEventHandlerUPP (MainWindowCommandHandler), GetEventTypeCount(commands), commands, this, NULL); if(err != noErr) msg->error("Can't install main commandHandler"); }
void PreferencesDialog::initDialog() { ControlHandle popupButtonControl; ControlID popupButtonControlID = {kAppSignature, 130}; MenuRef menu; GetControlByID(preferencesWindow, &popupButtonControlID, &popupButtonControl); GetControlData(popupButtonControl, kControlEntireControl, kControlPopupButtonMenuRefTag, sizeof(menu), &menu, NULL); unsigned int nPorts = midiin ? midiin->getPortCount() : 0; if (nPorts) { UInt32 numItems = CountMenuItems(menu); DeleteMenuItems(menu, 1, numItems); // Check inputs. std::string portName; unsigned int nSelectedDevice = 0; for (unsigned int i = 0; i < nPorts; i++ ) { try { portName = midiin->getPortName(i); } catch (RtMidiError &error) { error.printMessage(); } if (strcmp(portName.c_str(), m_dataBase->restore(KEY_MIDIDEVICE)->getStringValue()) == 0) nSelectedDevice = i; CFStringRef CFStrPortName = CFStringCreateWithCString(NULL, portName.c_str(), kCFStringEncodingASCII); AppendMenuItemTextWithCFString(menu, CFStrPortName, 0, kMIDIDeviceBaseCommand + i, 0); CFRelease(CFStrPortName); } /*AppendMenuItemTextWithCFString(menu, CFSTR("Temp1"), 0, kMIDIDeviceBaseCommand + 1, 0); AppendMenuItemTextWithCFString(menu, CFSTR("Temp2"), 0, kMIDIDeviceBaseCommand + 2, 0); nPorts+=2;*/ SetControlMaximum(popupButtonControl, nPorts); SetControlValue(popupButtonControl, nSelectedDevice + 1); storeMidiDeviceName(nSelectedDevice); EnableControl(popupButtonControl); } else { DisableControl(popupButtonControl); } updateControls(); updateSliderVelocityAmplify(); }
CV_IMPL void cvSetTrackbarPos(const char* trackbar_name, const char* window_name, int pos) { CV_FUNCNAME( "cvSetTrackbarPos" ); __BEGIN__; CvWindow* window; CvTrackbar* trackbar = 0; if( trackbar_name == 0 || window_name == 0 ) CV_ERROR( CV_StsNullPtr, "NULL trackbar or window name" ); window = icvFindWindowByName( window_name ); if( window ) trackbar = icvFindTrackbarByName( window, trackbar_name ); if( trackbar ) { if( pos < 0 ) pos = 0; if( pos > trackbar->maxval ) pos = trackbar->maxval; // Set new value and redraw the trackbar SetControlValue( trackbar->trackbar, pos ); Draw1Control( trackbar->trackbar ); } __END__; return ; }
void View::UpdateControl(int index, int update_type) { if (update_type == URT_INDIRECT) { double value = _listener->GetParamValue(index); SetControlValue(index, value); OnUpdate(index, value); } else if (update_type == URT_DIRECT) { ControlPtr c = GetControl(index); if (c != NULL) { Redraw(c); double value; c->GetNormalValue(&value); OnUpdate(index, value); } } else if (update_type == URT_DIRECT2) { ControlPtr c = GetControl(index); if (c != NULL) { double value; value = c->GetValue(); OnUpdate(index, value); //Redraw(c); } } }
void XGProgress::SetMinValue (long min) { if (fMin == min) return; fMin = min; if (fValue < fMin) fValue = fMin; #if OPT_MACOS if (fControl) { XGDraw draw(this, false); SetControlMinimum(fControl, fMin / fScale); SetControlValue(fControl, fValue / fScale); return; } #endif #if OPT_WINOS if (fControl) { ::SendMessage(fControl, PBM_SETRANGE, 0, MAKELPARAM(fMin / fScale, fMax / fScale)); return; } #endif InvalView(); }
/* SetPopMatch(theDialog, popupItemNumber, selStr) Sets currently selected item to that which matches string (case insensitive). Returns item number or zero if there is no match. Thread Safety: SetPopMatch is not thread-safe. */ int SetPopMatch(DialogPtr theDialog, int popupItemNumber, const char *selStr) { ControlHandle controlH; MenuHandle mH; int numMenuItems; int i; unsigned char temp[256]; char itemText[256]; int result; int err; if (err = XOPGetDialogItemAsControl(theDialog, popupItemNumber, &controlH)) return 0; mH = GetPopMenuHandle(theDialog, popupItemNumber); if (mH == NULL) return 0; result = 0; numMenuItems = CountMenuItems(mH); for (i=1; i<=numMenuItems; i++) { GetMenuItemText(mH, i, temp); CopyPascalStringToC(temp, itemText); if (CmpStr(itemText,selStr) == 0) { result = i; SetControlValue(controlH, result); InvalDBox(theDialog, popupItemNumber); // This can move heap. break; } } return result; }
OSStatus setProgress(int cur, int max) { OSStatus err; ControlRef progressBar = NULL; ControlID id; id.signature = 'prog'; id.id = 0; err = GetControlByID(gWindow, &id, &progressBar); if(err == noErr) { Boolean indeterminate; if(max == 0) { indeterminate = true; err = SetControlData(progressBar, kControlEntireControl, kControlProgressBarIndeterminateTag, sizeof(Boolean), (Ptr)&indeterminate); } else { double percentage = (double)cur / (double)max; SetControlMinimum(progressBar, 0); SetControlMaximum(progressBar, 100); SetControlValue(progressBar, (SInt16)(percentage * 100)); indeterminate = false; err = SetControlData(progressBar, kControlEntireControl, kControlProgressBarIndeterminateTag, sizeof(Boolean), (Ptr)&indeterminate); Draw1Control(progressBar); } } return(err); }
void XGProgress::SetMaxValue (long max) { if (fMax == max) return; fMax = max; if (fValue > fMax) fValue = fMax; if (fMax <= 16384) fScale = 1; else fScale = fMax / 16384; #if OPT_MACOS if (fControl) { XGDraw draw(this, false); SetControlMaximum(fControl, fMax / fScale); SetControlValue(fControl, fValue / fScale); return; } #endif #if OPT_WINOS if (fControl) { ::SendMessage(fControl, PBM_SETRANGE, 0, MAKELPARAM(fMin / fScale, fMax / fScale)); return; } #endif InvalView(); }
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Name: MyPDEInitialize Input Parameters: context : The plugins context parentUserPane : the user pane to your your controls into ref : the reference to this PDE printSession : this holds the PM tickets Output Parameters: flags : feature flags that are supported by this PDE err : returns the error status Description: Initializes client interface. Creates controls and sets initial values Change History (most recent first): ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ static OSStatus MyPDEInitialize( PMPDEContext context, PMPDEFlags* flags, PMPDERef ref, ControlRef parentUserPane, PMPrintSession printSession) { OSStatus err = noErr; PrintDialogPDEOnlyContextPtr myContext = NULL; // Pointer to our context data. DebugMessage("PrintDialogPDE MyPDEInitialize called\n"); myContext = (PrintDialogPDEOnlyContextPtr) context; if ((myContext != NULL) && (printSession != NULL)) { WindowRef theWindow = NULL; short savedResFile = CurResFile(); UseResFile(myContext->theResFile); theWindow = GetControlOwner(parentUserPane); // get the windowref from the user pane // the user panes rect is the rect we should use to draw our // controls into. The printing system calculates the user pane // size based on the maxh and maxv sizes returned from the // Prologue function // Note that we are using the AutoToggleProc variant of the Radio Button control // This allows a hit on this control to be automatically processed by the ControlMgr // get controls myContext->thePrintSelTextOnlyControlRef = GetNewControl(kPrintDialogPDEControlID, theWindow); // embed controls EmbedControl(myContext->thePrintSelTextOnlyControlRef, parentUserPane); // set controls as visible SetControlVisibility(myContext->thePrintSelTextOnlyControlRef, true, false); // Set default value SetControlValue(myContext->thePrintSelTextOnlyControlRef, 0); // Set flags *flags = kPMPDENoFlags; // Initialize this plugins controls based on the information in the // PageSetup or PrintSettings ticket. err = MyPDESync(context, printSession, kSyncDirectionSetUserInterface); if (err == kPMKeyNotFound) err = noErr; UseResFile(savedResFile); } else err = kPMInvalidPDEContext; DebugPrintErr(err, "PrintDialogPDE Error from MyPDEInitialize returned %d\n"); return (err); }
/**************************************************************************** * 名 称: SetTextValue() * 功 能: 设置文本控件的显示文字 * 入口参数: screen_id,控件所在的画面ID * 入口参数: control_id,目标控件ID * 入口参数: str,显示文字 * 出口参数: 无 ****************************************************************************/ void SetTextValue(uint16 screen_id,uint16 control_id,uchar *str) { uint16 len = 0; uchar *p = str; while(*p++) ++len; SetControlValue(screen_id,control_id,str,len); }
ComponentResult IPlugProcess::SetChunk(OSType chunkID, SFicPlugInChunk *chunk) { TRACE; if (chunkID == mPluginID) { int dataSize = chunk->fSize - sizeof(SFicPlugInChunkHeader); ByteChunk IPlugChunk; IPlugChunk.PutBytes(chunk->fData, dataSize); mPlug->UnserializeState(&IPlugChunk, 0); for (int i = 0; i< mPlug->NParams(); i++) { IParam *p = mPlug->GetParam(i); int idx = i+kPTParamIdxOffset; switch (p->Type()) { case IParam::kTypeDouble: { CPluginControl_Continuous *control = dynamic_cast<CPluginControl_Continuous*>(GetControl(idx)); SetControlValue(idx, control->ConvertContinuousToControl( p->Value() )); break; } case IParam::kTypeInt: case IParam::kTypeEnum: case IParam::kTypeBool: { CPluginControl_Discrete *control = dynamic_cast<CPluginControl_Discrete*>(GetControl(idx)); SetControlValue(idx, control->ConvertDiscreteToControl( p->Int() )); break; } default: break; } } fNumPlugInChanges++; return noErr; } return kChunkRangeErr; }
/* SetCheckBox(theDialog, itemNumber, val) Sets state of check box. Returns the new value. Thread Safety: SetCheckBox is not thread-safe. */ int SetCheckBox(DialogPtr theDialog, int itemNumber, int val) { ControlHandle controlH; if (XOPGetDialogItemAsControl(theDialog, itemNumber, &controlH) == 0) SetControlValue(controlH, val); return val; }
static void progress_update(void *param, int action, int phase, int iprogress) { struct progress *p = (struct progress *) param; unsigned progress = iprogress; int position; if (action < PROGFN_READY && p->nphases < phase) p->nphases = phase; switch (action) { case PROGFN_INITIALISE: p->nphases = 0; break; case PROGFN_LIN_PHASE: p->phases[phase-1].exponential = 0; p->phases[phase-1].mult = p->phases[phase].total / progress; break; case PROGFN_EXP_PHASE: p->phases[phase-1].exponential = 1; p->phases[phase-1].param = 0x10000 + progress; p->phases[phase-1].current = p->phases[phase-1].total; p->phases[phase-1].n = 0; break; case PROGFN_PHASE_EXTENT: p->phases[phase-1].total = progress; break; case PROGFN_READY: { unsigned total = 0; int i; for (i = 0; i < p->nphases; i++) { p->phases[i].startpoint = total; total += p->phases[i].total; } p->total = total; p->divisor = ((p->total + PROGRESSRANGE - 1) / PROGRESSRANGE); p->range = p->total / p->divisor; SetControlMaximum(p->progbar, p->range); } break; case PROGFN_PROGRESS: if (p->phases[phase-1].exponential) { while (p->phases[phase-1].n < progress) { p->phases[phase-1].n++; p->phases[phase-1].current *= p->phases[phase-1].param; p->phases[phase-1].current /= 0x10000; } position = (p->phases[phase-1].startpoint + p->phases[phase-1].total - p->phases[phase-1].current); } else { position = (p->phases[phase-1].startpoint + progress * p->phases[phase-1].mult); } SetControlValue(p->progbar, position / p->divisor); break; } }
void TabbedWindow::SelectTabViewItemAtIndex( int tabIndex ) { OSStatus status; SetControlValue( fTabControlRef, tabIndex ); status = this->SwitchTabPane( fTabControlRef ); DrawOneControl( fTabControlRef ); this->ForceUpdate(); }
/* SetRadBut(theDialog, first, last, theButton) Given a dialog pointer, a range of items, and a number (theButton) in that range, turns theButton on and turns all other buttons in range off. Thread Safety: SetRadBut is not thread-safe. */ void SetRadBut(DialogPtr theDialog, int first, int last, int theButton) { ControlHandle controlH; int i; for (i = first; i <= last; i++){ if (XOPGetDialogItemAsControl(theDialog, i, &controlH) == 0) SetControlValue(controlH, i==theButton); } }
void tool_wind_magnify_scroll(int delta) { magnify_factor-=delta; if (magnify_factor<5) magnify_factor=5; if (magnify_factor>210) magnify_factor=210; SetControlValue(magnify_slider,magnify_factor); top_view_reset(); main_wind_draw(); }
void TActiveScroller::SetScrollBarValue(short value) { #if TARGET_API_MAC_CARBON==1 Rect rect; GetControlBounds(scrollBar,&rect); UClipSaver safe(rect); #else UClipSaver safe((**scrollBar).contrlRect); #endif SetControlValue(scrollBar,value); }
/* ToggleCheckBox(theDialog, itemNumber) Toggles state of check box and returns new value. Thread Safety: ToggleCheckBox is not thread-safe. */ int ToggleCheckBox(DialogPtr theDialog, int itemNumber) { ControlHandle controlH; int val=0; if (XOPGetDialogItemAsControl(theDialog, itemNumber, &controlH) == 0) { val = !GetControlValue(controlH); SetControlValue(controlH, val); } return val; }
void _GuiMacRadioButton_handleClick (GuiObject widget, EventRecord *macEvent) { iam_radiobutton; _GuiMac_clipOnParent (widget); bool clicked = HandleControlClick (widget -> nat.control.handle, macEvent -> where, macEvent -> modifiers, NULL); GuiMac_clipOff (); if (clicked) { /* * Deselect the sister buttons. */ for (GuiRadioButton sibling = my d_previous; sibling != NULL; sibling = sibling -> d_previous) { SetControlValue (sibling -> d_widget -> nat.control.handle, 0); } for (GuiRadioButton sibling = my d_next; sibling != NULL; sibling = sibling -> d_next) { SetControlValue (sibling -> d_widget -> nat.control.handle, 0); } if (my d_valueChangedCallback != NULL) { struct structGuiRadioButtonEvent event = { me }; event. position = _GuiRadioButton_getPosition (me); my d_valueChangedCallback (my d_valueChangedBoss, & event); } } }
void SetServiceTypePopupMenu(UInt16 serviceMenuItem) { ControlID controlID = { kNSLSample, kServicesTypePopup }; ControlRef control; OSStatus err; err = GetControlByID(gMainWindow, &controlID, &control); if (err == noErr) { SetControlValue(control, serviceMenuItem); gPreviousItem = serviceMenuItem; } }
void structGuiCheckButton :: f_setValue (bool value) { /* * The value should be set without calling the valueChanged callback. */ #if gtk g_signal_handler_disconnect (GTK_TOGGLE_BUTTON (d_widget), d_valueChangedHandlerId); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (d_widget), value); d_valueChangedHandlerId = g_signal_connect (GTK_TOGGLE_BUTTON (d_widget), "toggled", G_CALLBACK (_GuiGtkCheckButton_valueChangedCallback), this); #elif cocoa #elif win Button_SetCheck (d_widget -> window, value ? BST_CHECKED : BST_UNCHECKED); #elif mac SetControlValue (d_widget -> nat.control.handle, value); #endif }
/****adjusttext()************************************************************/ void adjusttext(int iforce) /*must call this with iforce==0 before iforce==1 to get calc right*/ { if (Lquiet == 0) { if (iforce > 0) { if(thenoldLines+iforce >= theviewLines) /* would be off the bottom now*/ {/*force a scroll if line would be off bottom from earlier calculation*/ /*m*/ TEScroll(0,-(iforce*textHeight),textText); /* scroll iforce number of lines */ /*m*/ SetControlValue(vtextScroll,maxValue); } thenoldLines = thenoldLines + iforce; } else /*calculate number of lines needed for a scroll to stay on screen*/ { /*m*/ TECalText(textText); thenLines = (*textText)->nLines; /* total lines of text */ thendiff = thenLines - thenoldLines; /*number of lines moved since last adjustment*/ theviewLines = (textdRect.bottom - textdRect.top)/textHeight; /* lines viewed in window */ thenoldLines = thenLines; if (thenLines >= (theviewLines)) { /*m*/ TEScroll(0,-(thendiff*textHeight),textText); /* scroll ndiff lines */ /*m*/ SetControlValue(vtextScroll,maxValue); } } } }