コード例 #1
0
// --------------------------------------------------------------------------------------
void AddRowsAndDataToIconList(ListHandle iconList, SInt16 iconFamilyBaseID)
{
	short dataLength, rowNumber;
	IconListCellDataRec cellData;
	Cell theCell;
	
	if (!gIconsRegistered)		// if we didn't register our icons already, we need to
	{
		OSErr error;
		FSSpec iconResFile;
		
			/* The first thing we need to do to register an IconRef is to get the FSSpec 
			   for the file containing the icon resources.  This could be the 
			   application file itself or a flattened resource file in a bundle.  Either 
			   way, in this program it's the "current" resource file so we call our 
			   utility function that converts the file reference number returned by 
			   CurResFile to an FSSpec. */
		error = getCurrentResourceFSSpec(&iconResFile);
		
		if (error != noErr)		// if we can't get our icons, this program is kind of useless
			ExitToShell();
		
			// we've got the FSSpec, now get the icons out of it
		dataLength = sizeof(IconListCellDataRec);
		
		for (rowNumber = 0; rowNumber < kNumberOfRows; rowNumber++)
		{
			RegisterIconRefFromResource(kAppSignature, 'LIc0' + rowNumber, &iconResFile, 
										iconFamilyBaseID + rowNumber, &cellData.icon);
			GetIndString(cellData.name, rIconListStrings, rowNumber + 1);
			
			rowNumber = LAddRow(1, rowNumber, iconList);	// add each row to the 
			SetPt(&theCell, 0, rowNumber);					// bottom of the List
			LSetCell(&cellData, dataLength, theCell, iconList);
		}
		
		gIconsRegistered = true;
	}
	else	// the icons are already registered so we just have to get them
	{
		dataLength = sizeof(IconListCellDataRec);
		
		for (rowNumber = 0; rowNumber < kNumberOfRows; rowNumber++)
		{
			GetIconRef(kOnSystemDisk, kAppSignature, 'LIc0' + rowNumber, &cellData.icon);
			
			GetIndString(cellData.name, rIconListStrings, rowNumber + 1);
				
			rowNumber = LAddRow(1, rowNumber, iconList);	// add each row to the 
			SetPt(&theCell, 0, rowNumber);					// bottom of the List
			LSetCell(&cellData, dataLength, theCell, iconList);
		}
	}
}
コード例 #2
0
ファイル: macevlog.c プロジェクト: rdebath/sgt
void logevent(void *frontend, const char *str)
{
    Session *s = frontend;
    ListBounds bounds, visible;
    Cell cell = { 0, 0 };

    if (s->eventlog == NULL)
	mac_createeventlog(s);
    if (s->eventlog == NULL)
	return;

#if TARGET_API_MAC_CARBON
    GetListDataBounds(s->eventlog, &bounds);
    GetListVisibleCells(s->eventlog, &visible);
#else
    bounds = (*s->eventlog)->dataBounds;
    visible = (*s->eventlog)->visible;
#endif

    cell.v = bounds.bottom;
    LAddRow(1, cell.v, s->eventlog);
    LSetCell(str, strlen(str), cell, s->eventlog);
    /* ">=" and "2" because there can be a blank cell below the last one. */
    if (visible.bottom >= bounds.bottom)
	LScroll(0, 2, s->eventlog);
}
コード例 #3
0
ファイル: listbox.cpp プロジェクト: Bluehorn/wxPython
void wxListBox::MacAppend( const wxString& text)
{
    Cell cell = { 0 , 0 } ;
    cell.v = (**(ListHandle)m_macList).dataBounds.bottom ;
    LAddRow( 1 , cell.v , (ListHandle)m_macList ) ;
    //   LSetCell(text, strlen(text), cell, m_macList);
    Refresh();
}
コード例 #4
0
ファイル: listbox.cpp プロジェクト: Bluehorn/wxPython
void wxListBox::MacInsert( int n , const wxString& text)
{
    Cell cell = { 0 , 0 } ;
    cell.v = n ;
    LAddRow( 1 , cell.v , (ListHandle)m_macList ) ;
    //    LSetCell(text, strlen(text), cell, m_macList);
    Refresh();
}
コード例 #5
0
ファイル: msDrivers.c プロジェクト: AntonLanghoff/whitecatlib
/* -----------------------------------------------------------------------------*/
void FillLists (void)
{
	TDriverInfos drvInfo; TSlotInfos slotInfo; SlotRefNum sref;
	Cell srcCell, dstCell; Boolean visible;
	short ref, i, j, p, n = MidiCountDrivers();
	
	srcCell.h = srcCell.v = dstCell.h = dstCell.v = 0;
	LDelRow(0, 0, theList[SrcL]);
	LDelRow(0, 0, theList[DstL]);
	ResetPortMap ();
	for (i = 1; i <= n; i++) {
		ref = MidiGetIndDriver (i);
		if (MidiGetDriverInfos (ref, &drvInfo)) {
			for (j = 1; j <= drvInfo.slots; j++) {
				sref = MidiGetIndSlot (ref, j);
				if (MidiGetSlotInfos (sref, &slotInfo)) {
					visible = false;
					if (slotInfo.direction & MidiInputSlot) {
						LAddRow(1, srcCell.v, theList[SrcL]);
						LSetCell(&slotInfo.name[1], slotInfo.name[0], srcCell, theList[SrcL]);
						srcCell.v++; visible = true;
					}
					if (slotInfo.direction & MidiOutputSlot) {
						LAddRow(1, dstCell.v, theList[DstL]);
						LSetCell(&slotInfo.name[1], slotInfo.name[0], dstCell, theList[DstL]);
						dstCell.v++; visible = true;
					}
					if (visible) {
						for (p = 0; p < 32; p++) PortsMap[p] |= slotInfo.cnx[p];
					}
				}
			}
			if (i <= 64) {
				InListMap[i-1] = srcCell.v;
				OutListMap[i-1] = dstCell.v;
			}
		}
	}
	InvalPortArea();
	LUpdate(myWindow->visRgn, theList[SrcL]);
	LUpdate(myWindow->visRgn, theList[DstL]);
}
コード例 #6
0
void add_ListWin(MidiFile * file)
{
	short	rowNum=1;
	//Str255	fullPath;
	
	//GetFullPath(&file->spec, fullPath);
	file->mfn=make_new_MFnode_entry(file->filename);
	rowNum = (**gPlaylist).dataBounds.bottom;	
	rowNum = LAddRow(1, rowNum, gPlaylist);
	change_ListRow(  rowNum, file);
}
コード例 #7
0
ファイル: MoreLists.c プロジェクト: fruitsamples/MoreIsBetter
extern pascal SInt16 	LAddRowWhite(SInt16 count, SInt16 rowNum, ListHandle lHandle)
{
	OSStatus err;
	MoreThemeDrawingState state;
	SInt16 result;

	err = MoreGetThemeDrawingState(&state);
	if (err == noErr) {
		err = MoreNormalizeThemeDrawingState();
		assert(err == noErr);
		result = LAddRow(count, rowNum, lHandle);
		err = MoreSetThemeDrawingState(state, true);
	}
	assert(err == noErr);
	return result;
}