Пример #1
0
static pascal OSStatus ring_list_item_proc(ControlRef ctrl,DataBrowserItemID itemID,DataBrowserPropertyID property,DataBrowserItemDataRef itemData,Boolean changeValue)
{
	int						idx;
	CFStringRef				cfstr;
	model_ring_type			*ring;
	
	idx=itemID-1;
	ring=&model.animates[dialog_animate_idx].pose_moves[dialog_pose_move_idx].ring.rings[idx];

	switch (property) {
	
		case kAnimationRingListNameColumn:
			cfstr=CFStringCreateWithCString(kCFAllocatorDefault,ring->name,kCFStringEncodingMacRoman);
			SetDataBrowserItemDataText(itemData,cfstr);
			CFRelease(cfstr);
			return(noErr);
			
		case kAnimationRingListBoneColumn:
			if (ring->bone_idx==-1) return(noErr);
			
			cfstr=CFStringCreateWithCString(kCFAllocatorDefault,model.bones[ring->bone_idx].name,kCFStringEncodingMacRoman);
			SetDataBrowserItemDataText(itemData,cfstr);
			CFRelease(cfstr);
			return(noErr);			

	}

	return(errDataBrowserPropertyNotSupported);
}
Пример #2
0
static pascal OSStatus
dsnsetup_getset_item (ControlRef browser,
    DataBrowserItemID itemID, DataBrowserPropertyID property,
    DataBrowserItemDataRef itemData, Boolean changeValue)
{
  OSStatus err = noErr;

  if (!changeValue)
    switch (property)
      {
      case GSKEYWORD_ID:
	SetDataBrowserItemDataText (itemData,
	    DSNSETUP_array[0][itemID - DBITEM_ID - 1]);
	break;

      case GSVALUE_ID:
	SetDataBrowserItemDataText (itemData,
	    DSNSETUP_array[1][itemID - DBITEM_ID - 1]);
	break;

      case kDataBrowserItemIsActiveProperty:
	if (itemID > DBITEM_ID && itemID <= DBITEM_ID + DSNSETUP_nrows)
	  err = SetDataBrowserItemDataBooleanValue (itemData, true);
	break;

      case kDataBrowserItemIsEditableProperty:
	err = SetDataBrowserItemDataBooleanValue (itemData, true);
	break;

      case kDataBrowserItemIsContainerProperty:
	err =
	    SetDataBrowserItemDataBooleanValue (itemData,
	    itemID == DBITEM_ID);
	break;

      case kDataBrowserContainerAliasIDProperty:
	break;

      case kDataBrowserItemParentContainerProperty:
	break;

      default:
	err = errDataBrowserPropertyNotSupported;
	break;
      }
  else
    err = errDataBrowserPropertyNotSupported;

  return err;
}
Пример #3
0
static OSStatus infoGSID(ControlRef cRef, DataBrowserItemID item, DataBrowserPropertyID prop, DataBrowserItemDataRef itemData, Boolean setValue)
{
    CFStringRef string = CFSTR("");
    UInt32 index = ((UInt32) item) - 1;

    if (FOUR_CHAR_CODE('name') == prop)
    {
        if ((NULL != g_psTags) && (index >= 0) && (index < g_iNumTags))
        {
            string = g_psTags[2 * index];
        }
    }
    else if (FOUR_CHAR_CODE('data') == prop)
    {
        if ((NULL != g_psTags) && (index >= 0) && (index < g_iNumTags))
        {
            string = g_psTags[(2 * index) + 1];
        }
    }
    else
    {
        return errDataBrowserPropertyNotSupported;
    }

    return SetDataBrowserItemDataText(itemData, string);
}
Пример #4
0
static pascal OSStatus pose_list_item_proc(ControlRef ctrl,DataBrowserItemID itemID,DataBrowserPropertyID property,DataBrowserItemDataRef itemData,Boolean changeValue)
{
	int				idx,pose_idx,loop_start_idx,loop_end_idx;
	char			str[256];
	CFStringRef		cfstr;
	
	switch (property) {
	
		case kAniamtionPostListNameColumn:
			idx=itemID-1;
			
			pose_idx=model.animates[dialog_animate_idx].pose_moves[idx].pose_idx;
			
			loop_start_idx=model.animates[dialog_animate_idx].loop_start;
			loop_end_idx=model.animates[dialog_animate_idx].loop_end;
			
			sprintf(str,"  %s (%d)",model.poses[pose_idx].name,model.animates[dialog_animate_idx].pose_moves[idx].msec);
			if ((idx>=loop_start_idx) && (idx<=loop_end_idx)) str[0]='¥';
			
			cfstr=CFStringCreateWithCString(kCFAllocatorDefault,str,kCFStringEncodingMacRoman);
			SetDataBrowserItemDataText(itemData,cfstr);
			CFRelease(cfstr);
			return(noErr);

	}

	return(errDataBrowserPropertyNotSupported);
}
Пример #5
0
OSStatus
MySimpleDataCallback(ControlRef browser, DataBrowserItemID itemID, DataBrowserPropertyID property, DataBrowserItemDataRef itemData, Boolean changeValue)
{
    static IconRef neighborhoodIcon = 0;
    static IconRef servicesIcon = 0;
    CFStringRef name;
        
    switch (property)
    {
        case kNameColumn:
            if (itemID <= kMaxNeighborhoods)
            {
                if (neighborhoodIcon == 0) GetIconRef(kOnSystemDisk, kSystemIconsCreator, kGenericNetworkIcon, &neighborhoodIcon);
                SetDataBrowserItemDataIcon(itemData, neighborhoodIcon);
                SetDataBrowserItemDataText(itemData, gData[itemID-1]);
            }
            else
            {
                if (servicesIcon == 0)
                {
                    if (gSystemIsMacOSX) GetIconRef(kOnSystemDisk, kSystemIconsCreator, kGenericIDiskIcon, &servicesIcon);
                    else GetIconRef(kOnSystemDisk, kSystemIconsCreator, kIPFileServerIcon, &servicesIcon);
                }
                
                SetDataBrowserItemDataIcon(itemData, servicesIcon);
                
                ParseURL(gData[itemID - 1], &name);
                if (name)
                {
                    SetDataBrowserItemDataText(itemData, name);
                    CFRelease(name);
                }
            }
            break;
        case kDataBrowserItemIsSelectableProperty:
            if (itemID <= kMaxNeighborhoods) SetDataBrowserItemDataBooleanValue(itemData, false);
            else SetDataBrowserItemDataBooleanValue(itemData, true);
            break;
        case kDataBrowserItemIsContainerProperty:
            if (itemID <= kMaxNeighborhoods) SetDataBrowserItemDataBooleanValue(itemData, true);
            else SetDataBrowserItemDataBooleanValue(itemData, false);
            break;
    }
    
    return noErr;
}
Пример #6
0
OSStatus MyDataBrowserItemDataCallback(ControlRef browser, DataBrowserItemID item, DataBrowserPropertyID property, DataBrowserItemDataRef itemData, Boolean setValue)
{
	if (!setValue && property=='blah') {
		CFStringRef cs=CFStringCreateWithCString(0,(char*)item,kCFStringEncodingUTF8);
		SetDataBrowserItemDataText(itemData,cs);
		CFRelease(cs);
	}
	return noErr;
}
// ---------------------------------------------------------------------------
// 
// -----------
pascal OSStatus bToolGeomWithJoin::dtb_proc(	ControlRef browser, 
												DataBrowserItemID itemID, 
												DataBrowserPropertyID property, 
												DataBrowserItemDataRef itemData, 
												Boolean changeValue){
bToolGeomWithJoin*	t=(bToolGeomWithJoin*)GetControlReference(browser);
CFStringRef			cfs;
bGenericMacMapApp*	gapp=(bGenericMacMapApp*)t->getapp();
bGenericType*		tp=NULL;
char				name[256];
Boolean				b;

	switch(property){
		case kToolGeomWithJoinTypesCheckProperty:
			if(!changeValue){
				if(!t->_tp_use.get(itemID,&tp)){
				}
				SetDataBrowserItemDataBooleanValue(itemData,(tp!=NULL));
			}
			else{
				GetDataBrowserItemDataBooleanValue(itemData,&b);
				if(b){
					tp=gapp->typesMgr()->get(itemID);
				}
				else{
					tp=NULL;
				}
				t->_tp_use.put(itemID,&tp);
			}
			break;
			
		case kToolGeomWithJoinTypesNameProperty:
			if(!changeValue){
				tp=gapp->typesMgr()->get(itemID);
				tp->name(name);
				cfs=CFStringCreateWithCString(kCFAllocatorDefault,name,CFStringGetSystemEncoding());
				SetDataBrowserItemDataText(itemData,cfs);
				CFRelease(cfs);
			}
			break;
	
		case kDataBrowserItemIsEditableProperty:
			if(SetDataBrowserItemDataBooleanValue(itemData,true)){
			}
			break;
			
		case kDataBrowserItemIsSelectableProperty:
			if(SetDataBrowserItemDataBooleanValue(itemData,true)){
			}
			break;
			
		default:
			break;			
	}
	return(noErr);
}
Пример #8
0
static pascal OSStatus
fdsn_getset_item (ControlRef browser,
    DataBrowserItemID itemID, DataBrowserPropertyID property,
    DataBrowserItemDataRef itemData, Boolean changeValue)
{
  static IconRef folderIcon = 0;
  static IconRef dsnIcon = 0;
  OSStatus err = noErr;

  if (!changeValue)
    switch (property)
      {
      case DBNAME_ID:
        if (folderIcon == 0)
          GetIconRef(kOnSystemDisk, kSystemIconsCreator, kGenericFolderIcon, &folderIcon);
        if (dsnIcon == 0)
          GetIconRef(kOnSystemDisk, kSystemIconsCreator, kGenericDocumentIcon, &dsnIcon);
	
	SetDataBrowserItemDataText (itemData, FDSN_array[itemID - DBITEM_ID - 1]);
	if (FDSN_type[itemID - DBITEM_ID - 1])
          SetDataBrowserItemDataIcon(itemData, dsnIcon);
	else
          SetDataBrowserItemDataIcon(itemData, folderIcon);
	break;

      case kDataBrowserItemIsActiveProperty:
	if (itemID > DBITEM_ID && itemID <= DBITEM_ID + FDSN_nrows)
	  err = SetDataBrowserItemDataBooleanValue (itemData, true);
	break;

      case kDataBrowserItemIsEditableProperty:
	err = SetDataBrowserItemDataBooleanValue (itemData, true);
	break;

      case kDataBrowserItemIsContainerProperty:
	err =
	    SetDataBrowserItemDataBooleanValue (itemData,
	    itemID == DBITEM_ID);
	break;

      case kDataBrowserContainerAliasIDProperty:
	break;

      case kDataBrowserItemParentContainerProperty:
	break;

      default:
	err = errDataBrowserPropertyNotSupported;
	break;
      }
  else
    err = errDataBrowserPropertyNotSupported;

  return err;
}
Пример #9
0
static pascal OSStatus DBClientDataCallback (HIViewRef browser, DataBrowserItemID itemID, DataBrowserPropertyID property, DataBrowserItemDataRef itemData, Boolean changeValue)
{
	OSStatus 	err, result;
	CFStringRef	str;
	Boolean		r;
	uint32		address;
	uint8		value;
	char		code[256];

	result = noErr;

	switch (property)
	{
		case kCmCheckBox:
			ThemeButtonValue	buttonValue;

            if (changeValue)
			{
				err = GetDataBrowserItemDataButtonValue(itemData, &buttonValue);
				citem[itemID - 1].enabled = (buttonValue == kThemeButtonOn) ? true : false;
 	        }
			else
				err = SetDataBrowserItemDataButtonValue(itemData, citem[itemID - 1].enabled ? kThemeButtonOn : kThemeButtonOff);

			break;

		case kCmAddress:
			if (changeValue)
			{
				err = GetDataBrowserItemDataText(itemData, &str);
				r = CFStringGetCString(str, code, 256, CFStringGetSystemEncoding());
				CFRelease(str);
				if (r)
				{
					Boolean	translated;

					if (S9xProActionReplayToRaw(code, address, value) == NULL)
						translated = true;
					else
					if (S9xGameGenieToRaw(code, address, value) == NULL)
						translated = true;
					else
					{
						translated = false;
						if (sscanf(code, "%" SCNx32, &address) != 1)
							address = 0;
						else
							address &= 0xFFFFFF;
					}

					citem[itemID - 1].address = address;
					sprintf(code, "%06" PRIX32, address);
					str = CFStringCreateWithCString(kCFAllocatorDefault, code, CFStringGetSystemEncoding());
					err = SetDataBrowserItemDataText(itemData, str);
					CFRelease(str);

					if (translated)
					{
						DataBrowserItemID	id[1];

						citem[itemID - 1].value = value;
						id[0] = itemID;
						err = UpdateDataBrowserItems(browser, kDataBrowserNoItem, 1, id, kDataBrowserItemNoProperty, kCmValue);
					}
				}
			}
			else
			{
				sprintf(code, "%06" PRIX32, citem[itemID - 1].address);
				str = CFStringCreateWithCString(kCFAllocatorDefault, code, CFStringGetSystemEncoding());
				err = SetDataBrowserItemDataText(itemData, str);
				CFRelease(str);
			}

			break;

		case kCmValue:
			if (changeValue)
			{
				err = GetDataBrowserItemDataText(itemData, &str);
				r = CFStringGetCString(str, code, 256, CFStringGetSystemEncoding());
				CFRelease(str);
				if (r)
				{
					uint32	byte;

					if (sscanf(code, "%" SCNx32, &byte) == 1)
						citem[itemID - 1].value = (uint8) byte;
					else
					{
						citem[itemID - 1].value = 0;
						err = SetDataBrowserItemDataText(itemData, CFSTR("00"));
					}
				}
			}
			else
			{
				sprintf(code, "%02" PRIX8, citem[itemID - 1].value);
				str = CFStringCreateWithCString(kCFAllocatorDefault, code, CFStringGetSystemEncoding());
				err = SetDataBrowserItemDataText(itemData, str);
				CFRelease(str);
			}

			break;

		case kCmDescription:
			if (changeValue)
			{
				code[0] = 0;
				err = GetDataBrowserItemDataText(itemData, &str);
				strcpy(code, GetMultiByteCharacters(str, 19));
				CFRelease(str);

				if (code[0] == 0)
				{
					code[0] = ' ';
					code[1] = 0;
				}

				strcpy(citem[itemID - 1].description, code);
			}
			else
			{
				str = CFStringCreateWithCString(kCFAllocatorDefault, citem[itemID - 1].description, CFStringGetSystemEncoding());
				err = SetDataBrowserItemDataText(itemData, str);
				CFRelease(str);
			}

			break;

		case kDataBrowserItemIsActiveProperty:
			err = SetDataBrowserItemDataBooleanValue(itemData, true);
			break;

		case kDataBrowserItemIsEditableProperty:
			err = SetDataBrowserItemDataBooleanValue(itemData, true);
			break;

		default:
			result = errDataBrowserPropertyNotSupported;
	}

	return (result);
}
Пример #10
0
void wxMacDataBrowserCellValue::Set( const wxString& value )
{
    wxCFStringRef cf(value);
    SetDataBrowserItemDataText( m_data, (CFStringRef) cf);
}
Пример #11
0
void wxMacDataBrowserCellValue::Set( CFStringRef value )
{
    SetDataBrowserItemDataText( m_data, value );
}
static pascal OSStatus DataBrowserDataCallback(
	ControlRef 				browser, 
	DataBrowserItemID 		item, 
	DataBrowserPropertyID 	property, 
	DataBrowserItemDataRef	itemData, 
	Boolean 				setValue
)
	// Called by the data browser control to get information about the 
	// data that it's displaying.  item is the row in the list, which in this 
	// case is the index (plus one) into the gItems CFArray that represents 
	// the login items list.  property is the column in the list; these values 
	// are set in the .nib file.  When asked for data, the routine looks up 
	// the item'th element of gItems and then extracts the appropriate key 
	// from that dictionary.
{
	OSStatus		err;
	CFDictionaryRef	dict;
	CFBooleanRef	hidden;
	CFURLRef		url;
	CFStringRef		str;
	
	assert(browser == gDataControl);
	assert( (item != kDataBrowserNoItem) && (item <= CFArrayGetCount(gItems)) );
	assert( (property < 1024) || (property == 'hidn') || (property == 'URL ') );
	assert( ! setValue );
	
	// gItems can only be NULL before the first call to DoRefresh as the 
	// application starts up.  Data browser should never be calling us to 
	// get information about items during that time, because we haven't 
	// added any items to the data browser.  Thus, we shouldn't be called 
	// when gItems is NULL.

	assert( gItems != NULL );
	
	switch (property) {
		case 'hidn':
			dict = (CFDictionaryRef) CFArrayGetValueAtIndex(gItems, (CFIndex) (item - 1));
			assert( (dict != NULL) && (CFGetTypeID(dict) == CFDictionaryGetTypeID()) );
			
			hidden = (CFBooleanRef) CFDictionaryGetValue(dict, kLIAEHidden);
			assert( (hidden != NULL) && (CFGetTypeID(hidden) == CFBooleanGetTypeID()) );

			err = SetDataBrowserItemDataText(
				itemData, 
				(CFBooleanGetValue(hidden) ? CFSTR("yes") : CFSTR("no"))
			);
			break;
		case 'URL ':
			dict = (CFDictionaryRef) CFArrayGetValueAtIndex(gItems, (CFIndex) (item - 1));
			assert( (dict != NULL) && (CFGetTypeID(dict) == CFDictionaryGetTypeID()) );

			url = (CFURLRef) CFDictionaryGetValue(dict, kLIAEURL);
			assert( (url != NULL) && (CFGetTypeID(url) == CFURLGetTypeID()) );

			str = CFURLGetString(url);
			
			err = SetDataBrowserItemDataText(itemData, str);
			break;
		default:
			err = noErr;
			break;
	}

	assert(err == noErr);

	return err;
}
Пример #13
0
static OSStatus
OPL_DSNItemViewItemDataCallback(ControlRef itemView, DataBrowserItemID itemID,
                                DataBrowserPropertyID property, DataBrowserItemDataRef itemData,
                                Boolean changeValue)
{
    OSStatus err;
    CFStringRef dsn;
    static IconRef folderIcon = 0;
    static IconRef dsnIcon = 0;
    IconRef icon = 0;

    if (changeValue)
        return errDataBrowserPropertyNotSupported;

    // Get TestPool instance
    OPL_DSNList *dsnlist = OPL_DSNList::get(itemView);
    if (!dsnlist)
        return errDataBrowserPropertyNotSupported;

    // Get test item
    dsn = dsnlist->getItem(itemID);
    CFStringRef str;

    switch (property) {
    case kItemViewDSNL:
        str = dsn;
        break;

    case kItemViewFDSNL:
        if (folderIcon == 0)
            GetIconRef(kOnSystemDisk, kSystemIconsCreator, kGenericFolderIcon, &folderIcon);
        if (dsnIcon == 0)
            GetIconRef(kOnSystemDisk, kSystemIconsCreator, kGenericDocumentIcon, &dsnIcon);

        icon = dsnlist->getItemType(itemID) ? folderIcon : dsnIcon;
        str = dsn;
        break;

    default:
        return errDataBrowserPropertyNotSupported;
    }

    // resize columns
    SInt16 outBaseline;
    Point ioBound;
    err = GetThemeTextDimensions(str, kThemeSystemFont, kThemeStateActive,
                                 false, &ioBound, &outBaseline);
    require_noerr(err, error);

    UInt16 width;
    err = GetDataBrowserTableViewNamedColumnWidth(itemView, property, &width);
    require_noerr(err, error);

    if (width < ioBound.h + 20) {
        err = SetDataBrowserTableViewNamedColumnWidth(itemView,
                property, ioBound.h + 20);
        require_noerr(err, error);
    }

    // set item data text
    err = SetDataBrowserItemDataText(itemData, str);
    require_noerr(err, error);

    if (icon)
        SetDataBrowserItemDataIcon(itemData, icon);

error:
    return err;
}
Пример #14
0
static pascal OSStatus
drivers_getset_item (ControlRef browser,
    DataBrowserItemID itemID, DataBrowserPropertyID property,
    DataBrowserItemDataRef itemData, Boolean changeValue)
{
  OSStatus err = noErr;

  if (!changeValue)
    switch (property)
      {
      case DBNAME_ID:
	SetDataBrowserItemDataText (itemData,
	    Drivers_array[0][itemID - DBITEM_ID - 1]);
	break;

      case DBFILE_ID:
	SetDataBrowserItemDataText (itemData,
	    Drivers_array[1][itemID - DBITEM_ID - 1]);
	break;

      case DBVERSION_ID:
	SetDataBrowserItemDataText (itemData,
	    Drivers_array[2][itemID - DBITEM_ID - 1]);
	break;

      case DBSIZE_ID:
	SetDataBrowserItemDataText (itemData,
	    Drivers_array[3][itemID - DBITEM_ID - 1]);
	break;

      case DBDATE_ID:
	SetDataBrowserItemDataText (itemData,
	    Drivers_array[4][itemID - DBITEM_ID - 1]);
	break;

      case kDataBrowserItemIsActiveProperty:
	if (itemID > DBITEM_ID && itemID <= DBITEM_ID + Drivers_nrows)
	  err = SetDataBrowserItemDataBooleanValue (itemData, true);
	break;

      case kDataBrowserItemIsEditableProperty:
	err = SetDataBrowserItemDataBooleanValue (itemData, true);
	break;

      case kDataBrowserItemIsContainerProperty:
	err =
	    SetDataBrowserItemDataBooleanValue (itemData,
	    itemID == DBITEM_ID);
	break;

      case kDataBrowserContainerAliasIDProperty:
	break;

      case kDataBrowserItemParentContainerProperty:
	break;

      default:
	err = errDataBrowserPropertyNotSupported;
	break;
      }
  else
    err = errDataBrowserPropertyNotSupported;

  return err;
}