• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ HIViewFindByID函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中HIViewFindByID函数的典型用法代码示例。如果您正苦于以下问题:C++ HIViewFindByID函数的具体用法?C++ HIViewFindByID怎么用?C++ HIViewFindByID使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了HIViewFindByID函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: NPServerDialogEventHandler

static pascal OSStatus NPServerDialogEventHandler (EventHandlerCallRef inHandlerRef, EventRef inEvent, void *inUserData)
{
	OSStatus	err, result = eventNotHandledErr;
	WindowRef	tWindowRef = (WindowRef) inUserData;

	switch (GetEventClass(inEvent))
	{
		case kEventClassCommand:
			switch (GetEventKind(inEvent))
			{
				HICommand	tHICommand;

				case kEventCommandUpdateStatus:
					err = GetEventParameter(inEvent, kEventParamDirectObject, typeHICommand, NULL, sizeof(HICommand), NULL, &tHICommand);
					if (err == noErr && tHICommand.commandID == 'clos')
					{
						UpdateMenuCommandStatus(false);
						result = noErr;
					}

					break;

				case kEventCommandProcess:
					err = GetEventParameter(inEvent, kEventParamDirectObject, typeHICommand, NULL, sizeof(HICommand), NULL, &tHICommand);
					if (err == noErr)
					{
						switch (tHICommand.commandID)
						{
							case 'OKAY':
								HIViewRef	ctl, root;
								HIViewID	cid;

								root = HIViewGetRoot(tWindowRef);
								cid.id = 0;
								cid.signature = 'OKAY';
								HIViewFindByID(root, cid, &ctl);
								DeactivateControl(ctl);
								cid.signature = 'CNSL';
								HIViewFindByID(root, cid, &ctl);
								DeactivateControl(ctl);

								npserver.dialogprocess = kNPSDialogProcess;
								result = noErr;
								break;

							case 'CNSL':
								npserver.dialogprocess = kNPSDialogCancel;
								result = noErr;
								break;
						}
					}

					break;
			}

			break;
	}

	return (result);
}
开发者ID:OV2,项目名称:snes9x-libsnes,代码行数:60,代码来源:mac-server.cpp


示例2: DeleteCheatItem

static void DeleteCheatItem (void)
{
	OSStatus	err;
	HIViewRef	ctl, root;
	HIViewID	cid;
	Handle		selectedItems;
	ItemCount	selectionCount;

	selectedItems = NewHandle(0);
	if (!selectedItems)
		return;

	err = GetDataBrowserItems(dbRef, kDataBrowserNoItem, true, kDataBrowserItemIsSelected, selectedItems);
	selectionCount = (GetHandleSize(selectedItems) / sizeof(DataBrowserItemID));

	if (selectionCount == 0)
	{
		DisposeHandle(selectedItems);
		return;
	}

	err = RemoveDataBrowserItems(dbRef, kDataBrowserNoItem, selectionCount, (DataBrowserItemID *) *selectedItems, kDataBrowserItemNoProperty);

	for (unsigned int i = 0; i < selectionCount; i++)
	{
		citem[((DataBrowserItemID *) (*selectedItems))[i] - 1].valid   = false;
		citem[((DataBrowserItemID *) (*selectedItems))[i] - 1].enabled = false;
		numofcheats--;
	}

	DisposeHandle(selectedItems);

	root = HIViewGetRoot(wRef);
	cid.id = 0;

	if (numofcheats < MAC_MAX_CHEATS)
	{
		cid.signature = kNewButton;
		HIViewFindByID(root, cid, &ctl);
		err = ActivateControl(ctl);
	}

	if (numofcheats == 0)
	{
		cid.signature = kAllButton;
		HIViewFindByID(root, cid, &ctl);
		err = DeactivateControl(ctl);
	}
}
开发者ID:libretro,项目名称:snes9x,代码行数:49,代码来源:mac-cheat.cpp


示例3: Prompt

//-------------------------------------------------------------------------------------
//	Prompt
//-------------------------------------------------------------------------------------
//	Put up a modal panel and request some text.
//
CFStringRef
Prompt( CFStringRef inPrompt, CFStringRef inDefaultText )
{
    IBNibRef 			nibRef;
	OSStatus			err;
	WindowRef			window;
	EventTypeSpec		kEvents[] = { { kEventClassCommand, kEventCommandProcess } };
	PanelInfo			info;
	HIViewRef			view;
	
	info.window = window;
	info.string = NULL;

    err = CreateNibReference( CFSTR( "main" ), &nibRef );
    require_noerr( err, CantGetNibRef );
	
	err = CreateWindowFromNib( nibRef, CFSTR( "Prompt" ), &window );
	require_noerr( err, CantCreateWindow );
	
	DisposeNibReference( nibRef );

	if ( inPrompt )
	{
		HIViewFindByID( HIViewGetRoot( window ), kPromptLabelID, &view );
		SetControlData( view, 0, kControlStaticTextCFStringTag, sizeof( CFStringRef ), &inPrompt );
	}
	
	HIViewFindByID( HIViewGetRoot( window ), kTextFieldID, &view );

	if ( inDefaultText )
		SetControlData( view, 0, kControlEditTextCFStringTag, sizeof( CFStringRef ), &inDefaultText );	

	SetKeyboardFocus( window, view, kControlFocusNextPart );

	InstallWindowEventHandler( window, InputPanelHandler, GetEventTypeCount( kEvents ),
				kEvents, &info, NULL );	
	
	ShowWindow( window );
	
	info.window = window;

	RunAppModalLoopForWindow( window );

	DisposeWindow( window );

CantCreateWindow:
CantGetNibRef:
	return info.string;
}
开发者ID:fruitsamples,项目名称:SimpleCarbonWeb,代码行数:54,代码来源:Prompt.c


示例4: AspectRatioTextEventHandler

static pascal OSStatus AspectRatioTextEventHandler (EventHandlerCallRef inHandlerRef, EventRef inEvent, void *inUserData)
{
	OSStatus	err, result = eventNotHandledErr;
	HIViewRef	ctl, slider;
	HIViewID	cid;
	float		w, h, v;
	int			iw, ih;

	err = GetEventParameter(inEvent, kEventParamDirectObject, typeControlRef, NULL, sizeof(ControlRef), NULL, &ctl);
	if (err == noErr)
	{
		cid.signature = 'grap';
		cid.id = iNibGAspectRatio;
		HIViewFindByID(HIViewGetSuperview(ctl), cid, &slider);

		GetGameDisplay(&iw, &ih);
		w = (float) iw;
		h = (float) ih;

		v = (float) SNES_WIDTH / (float) SNES_HEIGHT * h;
		macAspectRatio = (int) (((4.0f / 3.0f) * h - v) / (w - v) * 10000.0f);

		SetControl32BitValue(slider, macAspectRatio);

		result = noErr;
	}

	return (result);
}
开发者ID:libretro,项目名称:snes9x,代码行数:29,代码来源:mac-prefs.cpp


示例5: timerCallback

            void timerCallback()
            {
                // Wait for the moment when PT deigns to allow our view to
                // take up its actual location (see rant above)
                HIViewRef content = 0;
                HIViewFindByID (HIViewGetRoot ((WindowRef) hostWindow), kHIViewWindowContentID, &content);
                HIPoint p = { 0.0f, 0.0f };

                HIViewRef v = HIViewGetFirstSubview (parentView);
                HIViewConvertPoint (&p, v, content);

                if (p.y > 12)
                {
                    if (p.x != titleW || p.y != titleH)
                    {
                        GrafPtr oldport;
                        GetPort (&oldport);
                        SetPort (owner->GetViewPort());
                        SetOrigin (-titleW, -titleH);
                        SetPort (oldport);
                    }

                    HIViewRef v = HIViewGetFirstSubview (parentView);
                    SetControlSupervisor (v, 0);
                    stopTimer();

                    forcedRepaintTimer = new RepaintCheckTimer (*this);
                }
            }
开发者ID:NonPlayerCharactor,项目名称:juce_pitcher,代码行数:29,代码来源:juce_RTASWrapper.cpp


示例6: InputRateTextEventHandler

static pascal OSStatus InputRateTextEventHandler (EventHandlerCallRef inHandlerRef, EventRef inEvent, void *inUserData)
{
	OSStatus	err, result = eventNotHandledErr;
	HIViewRef	ctl, slider;
	HIViewID	cid;
	SInt32		value;
	char		num[10];

	err = GetEventParameter(inEvent, kEventParamDirectObject, typeControlRef, NULL, sizeof(ControlRef), NULL, &ctl);
	if (err == noErr)
	{
		cid.signature = 'snd_';
		cid.id = iNibSInputRate;
		HIViewFindByID(HIViewGetSuperview(ctl), cid, &slider);
		value = GetControl32BitValue(slider);

		value /= 50;
		value *= 50;
		if (value > 33000)
			value = 33000;
		if (value < 31000)
			value = 31000;

		SetControl32BitValue(slider, value);
		sprintf(num, "%ld", value);
		SetEditTextCStr(ctl, num, true);

		result = noErr;
	}

	return (result);
}
开发者ID:libretro,项目名称:snes9x,代码行数:32,代码来源:mac-prefs.cpp


示例7: Handle_ControlValueFieldOrHiliteChanged

/*****************************************************
*
* 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
开发者ID:fruitsamples,项目名称:Custom_HIView_Tutorial,代码行数:42,代码来源:HICustomView_Tester.c


示例8: NPClientBeginPlayerListSheet

static void NPClientBeginPlayerListSheet (void)
{
	OSStatus	err;
	CFStringRef	ref;
	HIViewRef	ctl, root;
	HIViewID	cid;

	root = HIViewGetRoot(sRef);
	cid.signature = 'PLNM';

	for (int i = 0; i < NP_MAX_PLAYERS; i++)
	{
		if (npcinfo[i].ready)
		{
			cid.id = npcinfo[i].player;
			HIViewFindByID(root, cid, &ctl);
			ref = CFStringCreateWithCString(kCFAllocatorDefault, npcinfo[i].name, kCFStringEncodingUTF8);
			if (ref)
			{
				SetStaticTextCFString(ctl, ref, false);
				CFRelease(ref);
			}
			else
				SetStaticTextCFString(ctl, CFSTR("unknown"), false);
		}
	}

	err = ShowSheetWindow(sRef, mRef);
}
开发者ID:RedGuyyyy,项目名称:snes9x,代码行数:29,代码来源:mac-client.cpp


示例9: InputPanelHandler

//-------------------------------------------------------------------------------------
//	InputPanelHandler
//-------------------------------------------------------------------------------------
//	Deal with events in our prompt panel. We merely respond to the cancel and OK commands
// 	that are sent from the push buttons and terminate our modal loop. If OK is pressed,
//	we get the string and store it in our PanelInfo structure.
//
static OSStatus
InputPanelHandler( EventHandlerCallRef inCallRef, EventRef inEvent, void* inUserData )
{
	HICommand			command;
	OSStatus			result = eventNotHandledErr;
	PanelInfo*			info = (PanelInfo*)inUserData;
	
	GetEventParameter( inEvent, kEventParamDirectObject, typeHICommand, NULL,
			sizeof( HICommand ), NULL, &command );

	if ( command.commandID == kHICommandCancel )
	{
		QuitAppModalLoopForWindow( info->window );
		result = noErr;
	}
	else if ( command.commandID == kHICommandOK )
	{
		HIViewRef		textField;
		
		HIViewFindByID( HIViewGetRoot( info->window ), kTextFieldID, &textField );
		GetControlData( textField, 0, kControlEditTextCFStringTag, sizeof( CFStringRef ), &info->string, NULL );
		QuitAppModalLoopForWindow( info->window );
	}
	
	return result;
}
开发者ID:fruitsamples,项目名称:SimpleCarbonWeb,代码行数:33,代码来源:Prompt.c


示例10: SelectTabPane

static void SelectTabPane (HIViewRef tabControl, SInt16 index)
{
	HIViewRef	sup, userPane, selectedPane = NULL;
	HIViewID	cid;

	lastTabIndex = index;

	sup = HIViewGetSuperview(tabControl);
	cid.signature = 'tabs';

	for (int i = 1; i < tabList[0] + 1; i++)
	{
		cid.id = tabList[i];
		HIViewFindByID(sup, cid, &userPane);

		if (i == index)
			selectedPane = userPane;
		else
			HIViewSetVisible(userPane, false);
	}

	if (selectedPane != NULL)
		HIViewSetVisible(selectedPane, true);

	HIViewSetNeedsDisplay(tabControl, true);
}
开发者ID:libretro,项目名称:snes9x,代码行数:26,代码来源:mac-prefs.cpp


示例11: MacOSXDialogCommandProcess

static pascal OSStatus MacOSXDialogCommandProcess(EventHandlerCallRef inHandlerCallRef, EventRef inEvent, void* inUserData)
{
	HICommand aCommand;
	OSStatus status = eventNotHandledErr;
	
	GetEventParameter(inEvent, kEventParamDirectObject, typeHICommand, NULL, sizeof(HICommand), NULL, &aCommand);
	
	switch (aCommand.commandID)
	{
		case kHICommandOK:
			// we got a valid click on the OK button so let's quit our local run loop
			QuitAppModalLoopForWindow((WindowRef) inUserData);
			break;
		case 'CBED':
		{
			// we still enable or disable the custom spot view depending on whether the box is checked or not
			HIViewRef checkBox = ((HICommandExtended *)&aCommand)->source.control;
			SInt32 enable = GetControl32BitValue(checkBox);
			HIViewID hidcsv = {0, 13};
			HIViewRef customSpotView;
			HIViewFindByID(HIViewGetRoot(GetControlOwner(checkBox)), hidcsv, &customSpotView);
			if (enable)
				ActivateControl(customSpotView);
			else
				DeactivateControl(customSpotView);
			HIViewSetNeedsDisplay(customSpotView, true);
		}
			break;
	}
	
	return status;
}
开发者ID:fruitsamples,项目名称:DialogsToHIViews,代码行数:32,代码来源:main.c


示例12: Handle_PostLittleArrowsClick

/*****************************************************
*
* 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
开发者ID:fruitsamples,项目名称:LittleArrowsShowcase,代码行数:40,代码来源:main.c


示例13: SetExtraStyle

bool wxDialog::Create( wxWindow *parent,
    wxWindowID id,
    const wxString& title,
    const wxPoint& pos,
    const wxSize& size,
    long style,
    const wxString& name )
{
    SetExtraStyle( GetExtraStyle() | wxTOPLEVEL_EX_DIALOG );

    // All dialogs should really have this style...
    style |= wxTAB_TRAVERSAL;

    // ...but not these styles
    style &= ~(wxYES | wxOK | wxNO); // | wxCANCEL

    if ( !wxTopLevelWindow::Create( parent, id, title, pos, size, style, name ) )
        return false;

#if TARGET_API_MAC_OSX
    HIViewRef growBoxRef = 0 ;
    OSStatus err = HIViewFindByID( HIViewGetRoot( (WindowRef)m_macWindow ), kHIViewWindowGrowBoxID, &growBoxRef  );
    if ( err == noErr && growBoxRef != 0 )
        HIGrowBoxViewSetTransparent( growBoxRef, true ) ;
#endif

    return true;
}
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:28,代码来源:dialog.cpp


示例14: AddCheatItem

static void AddCheatItem (void)
{
	OSStatus			err;
	HIViewRef			ctl, root;
	HIViewID			cid;
	DataBrowserItemID	id[1];
	unsigned int		i;

	if (numofcheats == MAC_MAX_CHEATS)
		return;

	for (i = 0; i < MAC_MAX_CHEATS; i++)
		if (citem[i].valid == false)
			break;

	if (i == MAC_MAX_CHEATS)
		return;

	numofcheats++;
	citem[i].valid   = true;
	citem[i].enabled = false;
	citem[i].address = 0;
	citem[i].value   = 0;
	sprintf(citem[i].description, "Cheat %03" PRIu32, citem[i].id);

	id[0] = citem[i].id;
	err = AddDataBrowserItems(dbRef, kDataBrowserNoItem, 1, id, kDataBrowserItemNoProperty);
	err = RevealDataBrowserItem(dbRef, id[0], kCmAddress, true);

	root = HIViewGetRoot(wRef);
	cid.id = 0;

	if (numofcheats == MAC_MAX_CHEATS)
	{
		cid.signature = kNewButton;
		HIViewFindByID(root, cid, &ctl);
		err = DeactivateControl(ctl);
	}

	if (numofcheats)
	{
		cid.signature = kAllButton;
		HIViewFindByID(root, cid, &ctl);
		err = ActivateControl(ctl);
	}
}
开发者ID:libretro,项目名称:snes9x,代码行数:46,代码来源:mac-cheat.cpp


示例15: GetTextViewFromWindow

//---------------------------------------------------------------------
// Returns the HITextView ref from one of our windows.
//
HIViewRef GetTextViewFromWindow(WindowRef window)
{
	HIViewRef textView = NULL;

	if( window != NULL )
		verify_noerr( HIViewFindByID(HIViewGetRoot(window), gTextViewID, &textView) );

	return textView;
}
开发者ID:fruitsamples,项目名称:HITextViewDemo,代码行数:12,代码来源:document_window.c


示例16: InstallWindowEventHandler

/* initialize the status window (used to show console messages in the graphic environment */
void CARBON_GUI::setupStatusWindow() 
{
	OSStatus err=CreateWindowFromNib(nibRef,CFSTR("StatusWindow"),&statusWindow);
	if(err!=noErr) msg->error("Can't create status window (%d)!!",err);
	//SetDrawerParent(statusWindow,window);
	//SetDrawerPreferredEdge(statusWindow,kWindowEdgeBottom);
	//SetDrawerOffsets(statusWindow,20,20);
	
	/* install an eventHandler to intercept close requests */
	err = InstallWindowEventHandler (statusWindow, 
		NewEventHandlerUPP (StatusWindowEventHandler), 
		GetEventTypeCount(statusEvents), statusEvents, this, NULL);
	if(err != noErr) msg->error("Can't install status window eventHandler");
	
	/* and then install a command handler (to handle "clear" requests) */
	err=InstallWindowEventHandler(statusWindow,NewEventHandlerUPP(StatusWindowCommandHandler),
		GetEventTypeCount(commands),commands,this,NULL);
		
	/* obtain an HIViewRef for the status text box ... we have to use it 
	 * to setup various properties and to obain a TXNObject needed to manage its content */
	const ControlID txtid={ CARBON_GUI_APP_SIGNATURE, STATUS_TEXT_ID };
	err= HIViewFindByID(HIViewGetRoot(statusWindow), txtid, &statusTextView);
	if(err!=noErr) return;// msg->warning("Can't get textView for status window (%d)!!",err);
	statusText = HITextViewGetTXNObject(statusTextView);
	if(!statusText) {
		msg->error("Can't get statusText object from status window!!");
	}
//	TXNControlTag iControlTags[1] = { kTXNAutoScrollBehaviorTag };
//	TXNControlData iControlData[1] = { kTXNAutoScrollNever }; //kTXNAutoScrollWhenInsertionVisible };
//	err = TXNSetTXNObjectControls(statusText,false,1,iControlTags,iControlData);
	//TextViewSetObjectControlData
	//TextViewSetObjectControlData(statusText,kTXNAutoScrollBehaviorTag,kUn kTXNAutoScrollWhenInsertionVisible)
	/* setup status text font size and color */
	// Create type attribute data structure
	UInt32   fontSize = 10 << 16; // needs to be in Fixed format
	TXNAttributeData fsData,fcData;
	fsData.dataValue=fontSize;
	fcData.dataPtr=(void *)&black;
	TXNTypeAttributes attributes[] = {
		//{ kTXNQDFontStyleAttribute, kTXNQDFontStyleAttributeSize, bold },
		{ kTXNQDFontColorAttribute, kTXNQDFontColorAttributeSize,fcData}, //&lgrey },
		{ kTXNQDFontSizeAttribute, kTXNFontSizeAttributeSize,fsData }
	};
	err= TXNSetTypeAttributes( statusText, 2, attributes,
		kTXNStartOffset,kTXNEndOffset );
		
	/* block user input in the statusText box */
	TXNControlTag tags[] = { kTXNNoUserIOTag };
	TXNControlData vals[] = { kTXNReadOnly };
	err=TXNSetTXNObjectControls(statusText,false,1,tags,vals);
	if(err!=noErr) msg->error("Can't set statusText properties (%d)!!",err);
	// TXNSetScrollbarState(statusText,kScrollBarsAlwaysActive);
		
	//struct TXNBackground bg = {  kTXNBackgroundTypeRGB, black };
	//TXNSetBackground(statusText,&bg);
}
开发者ID:dyne,项目名称:MuSE,代码行数:57,代码来源:carbon_gui.cpp


示例17: HIViewGetFrame

IPopupMenu* IGraphicsCarbon::CreateIPopupMenu(IPopupMenu* pMenu, IRECT* pAreaRect)
{
  // Get the plugin gui frame rect within the host's window
  HIRect rct;
  HIViewGetFrame(this->mView, &rct);

  // Get the host's window rect within the screen
  Rect wrct;
  GetWindowBounds(this->mWindow, kWindowContentRgn, &wrct);

  #ifdef RTAS_API
  int xpos = wrct.left + this->GetLeftOffset() + pAreaRect->L;
  int ypos = wrct.top + this->GetTopOffset() + pAreaRect->B + 5;
  #else
  HIViewRef contentView;
  HIViewFindByID(HIViewGetRoot(this->mWindow), kHIViewWindowContentID, &contentView);
  HIViewConvertRect(&rct, HIViewGetSuperview((HIViewRef)this->mView), contentView);

  int xpos = wrct.left + rct.origin.x + pAreaRect->L;
  int ypos = wrct.top + rct.origin.y + pAreaRect->B + 5;
  #endif

  MenuRef menuRef = CreateMenu(pMenu);

  if (menuRef)
  {
    int32_t popUpItem = 1;
    int32_t PopUpMenuItem = PopUpMenuSelect(menuRef, ypos, xpos, popUpItem);

    short result = LoWord(PopUpMenuItem) - 1;
    short menuIDResult = HiWord(PopUpMenuItem);
    IPopupMenu* resultMenu = 0;

    if (menuIDResult != 0)
    {
      MenuRef usedMenuRef = GetMenuHandle(menuIDResult);

      if (usedMenuRef)
      {
        if (GetMenuItemRefCon(usedMenuRef, 0, (URefCon*)&resultMenu) == noErr)
        {
          resultMenu->SetChosenItemIdx(result);
        }
      }
    }

    CFRelease(menuRef);

    return resultMenu;
  }
  else
  {
    return 0;
  }
}
开发者ID:Brado231,项目名称:Faderport_XT,代码行数:55,代码来源:IGraphicsCarbon.cpp


示例18: NPServerDialog

bool8 NPServerDialog (void)
{
	OSStatus	err;
	IBNibRef	nibRef;

	npserver.dialogcancel = true;

	err = CreateNibReference(kMacS9XCFString, &nibRef);
	if (err == noErr)
	{
		WindowRef	tWindowRef;

		err = CreateWindowFromNib(nibRef, CFSTR("ClientList"), &tWindowRef);
		if (err == noErr)
		{
			EventHandlerRef		eref;
			EventLoopTimerRef	tref;
			EventHandlerUPP		eventUPP;
			EventLoopTimerUPP	timerUPP;
			EventTypeSpec		windowEvents[] = { { kEventClassCommand, kEventCommandProcess      },
												   { kEventClassCommand, kEventCommandUpdateStatus } };
			HIViewRef			ctl;
			HIViewID			cid = { 'Chse', 0 };

			npserver.dialogprocess = kNPSDialogInit;

			eventUPP = NewEventHandlerUPP(NPServerDialogEventHandler);
			err = InstallWindowEventHandler(tWindowRef, eventUPP, GetEventTypeCount(windowEvents), windowEvents, (void *) tWindowRef, &eref);

			timerUPP = NewEventLoopTimerUPP(NPServerDialogTimerHandler);
			err = InstallEventLoopTimer(GetCurrentEventLoop(), 0.0f, 0.1f, timerUPP, (void *) tWindowRef, &tref);

			HIViewFindByID(HIViewGetRoot(tWindowRef), cid, &ctl);
			HIViewSetVisible(ctl, false);

			MoveWindowPosition(tWindowRef, kWindowServer, false);
			ShowWindow(tWindowRef);
			err = RunAppModalLoopForWindow(tWindowRef);
			HideWindow(tWindowRef);
			SaveWindowPosition(tWindowRef, kWindowServer);

			err = RemoveEventLoopTimer(tref);
			DisposeEventLoopTimerUPP(timerUPP);

			err = RemoveEventHandler(eref);
			DisposeEventHandlerUPP(eventUPP);

			CFRelease(tWindowRef);
		}

		DisposeNibReference(nibRef);
	}

	return (!npserver.dialogcancel);
}
开发者ID:OV2,项目名称:snes9x-libsnes,代码行数:55,代码来源:mac-server.cpp


示例19: main

int main(int argc, char* argv[])
{
    IBNibRef 		nibRef;
    WindowRef 		window;
    HIViewRef		textView;
	OSStatus		err;

    // Create a Nib reference passing the name of the nib file (without the .nib extension)
    // CreateNibReference only searches into the application bundle.
    err = CreateNibReference(CFSTR("main"), &nibRef);
    require_noerr( err, CantGetNibRef );
    
    // Once the nib reference is created, set the menu bar. "MainMenu" is the name of the menu bar
    // object. This name is set in InterfaceBuilder when the nib is created.
    err = SetMenuBarFromNib(nibRef, CFSTR("MenuBar"));
    require_noerr( err, CantSetMenuBar );
    
    // Then create a window. "MainDocumentWindow" is the name of the window object. This name is set in 
    // InterfaceBuilder when the nib is created.
    err = CreateWindowFromNib(nibRef, CFSTR("MainDocumentWindow"), &window);
    require_noerr( err, CantCreateWindow );

    // We don't need the nib reference anymore.
    DisposeNibReference(nibRef);

	// Make the window's content area transparent
	err = MakeWindowTransparent(window);
    require_noerr( err, CantMakeWindowTransparent );

	// Get a reference to the TextView in the main window
	err = HIViewFindByID(HIViewGetRoot(window), gTextViewID, &textView);
	require_noerr( err, CantGetTextView );

	// Install our default options in the TextView
	err = MySetTextViewOptions(textView);
	require_noerr( err, CantSetTextViewOptions );

	// Make the TextView partially transparent
	err = TextViewSetAlpha(textView, 0.25);
	require_noerr( err, CantSetTextViewOptions );
	
    // The window was created hidden so show it.
    ShowWindow( window );

    // Call the event loop
    RunApplicationEventLoop();

CantSetTextViewOptions:
CantGetTextView:
CantMakeWindowTransparent:
CantCreateWindow:
CantSetMenuBar:
CantGetNibRef:
	return err;
}
开发者ID:fruitsamples,项目名称:HITextViewDemo,代码行数:55,代码来源:main.c


示例20: GetTextViewFromWindow

OSStatus
GetTextViewFromWindow( WindowRef window, HIViewRef& textView )
{
	OSStatus status = paramErr;
	if( window != NULL )
	{
		status = HIViewFindByID(HIViewGetRoot(window), kTextViewControlID, &textView);
		check_noerr( status );
	}
	return status;
}
开发者ID:arnelh,项目名称:Examples,代码行数:11,代码来源:TextView.cpp



注:本文中的HIViewFindByID函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ HIWORD函数代码示例发布时间:2022-05-30
下一篇:
C++ HIP_DEBUG函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap