// -------------------------------------------------------------------------------------- static ListHandle createIconList(WindowRef window, Rect listRect) { ListBounds dataBounds; Point cellSize; ListHandle iconList; Cell theCell; ListDefSpec listSpec; OSStatus error; SetRect(&dataBounds, 0, 0, 1, 0); // initially there are no rows SetPt(&cellSize, kListWidth, kCellHeight); #if TARGET_API_MAC_OS8 #pragma unused (listSpec, error) iconList = LNew(&listRect, &dataBounds, cellSize, kIconListLDEF, window, true, false, false, true); #else // we could use RegisterListDefinition and LNew in Carbon instead // but we already show how to do that in PrefsDialog.c gIconListDef = NewListDefUPP(IconListDef); listSpec.defType = kListDefUserProcType; listSpec.u.userProc = gIconListDef; error = CreateCustomList(&listRect, &dataBounds, cellSize, &listSpec, window, true, false, false, true, &iconList); if (error && (iconList != NULL)) { LDispose(iconList); DisposeListDefUPP(gIconListDef); iconList = NULL; } #endif if (iconList != NULL) { SetListSelectionFlags(iconList, lOnlyOne); AddRowsAndDataToIconList(iconList, rIconListIconBaseID); SetPt(&theCell, 0, 0); LSetSelect(true, theCell, iconList); // select the first Cell drawFrameAndFocus(iconList, true, window); } return iconList; }
static int open_ListWin() /*success-> return 0;*/ { Rect listRect, dataBounds; Point cSize; open_window(&win, kListWinID); position_window(&win); setsize_window(&win); SetPortWindowPort(win.ref); TextSize(10); listRect=win.ref->portRect; listRect.right-=14; listRect.bottom-=14; dataBounds.top=dataBounds.left=0; dataBounds.right=1; dataBounds.bottom=0; cSize.h=1024; cSize.v=14; gPlaylist = LNew(&listRect, &dataBounds, cSize, 0, win.ref, 1, 1, 0, 1); return 0; }
static void mac_createeventlog(Session *s) { Rect view; ListBounds bounds = { 0, 0, 0, 1 }; /* 1 column, 0 rows */ Point csize = { 0, 0 }; GrafPtr saveport; long fondsize; WinInfo *wi; s->eventlog_window = GetNewWindow(wEventLog, NULL, (WindowPtr)-1); wi = snew(WinInfo); memset(wi, 0, sizeof(*wi)); wi->s = s; wi->wtype = wEventLog; wi->click = &mac_clickeventlog; wi->activate = &mac_activateeventlog; wi->grow = &mac_groweventlog; wi->update = &mac_updateeventlog; wi->close = &mac_closeeventlog; SetWRefCon(s->eventlog_window, (long)wi); GetPort(&saveport); SetPort((GrafPtr)GetWindowPort(s->eventlog_window)); fondsize = GetScriptVariable(smRoman, smScriptSmallFondSize); TextFont(HiWord(fondsize)); TextSize(LoWord(fondsize)); SetPort(saveport); #if TARGET_API_MAC_CARBON GetPortBounds(GetWindowPort(s->eventlog_window), &view); #else view = s->eventlog_window->portRect; #endif view.right -= 15; /* Scrollbar */ s->eventlog = LNew(&view, &bounds, csize, 0, s->eventlog_window, TRUE, TRUE, FALSE, TRUE); mac_adjusteventlogscrollbar(s); #if TARGET_API_MAC_CARBON SetListSelectionFlags(s->eventlog, lExtendDrag | lNoDisjoint | lNoExtend); #else (*s->eventlog)->selFlags = lExtendDrag | lNoDisjoint | lNoExtend; #endif }
static LObject *cam2obj(CameraStruct **x) { CameraStruct *copy = camcopy(*x); return LNew( LCAMERA, © ); }
void ShowAdditionsWin(void) { Str255 next, back; Str255 compDescTitle; StringPtr selCompMsg; Handle listBoxRect; Rect dataBounds, listBoxFrame, viewRect; short reserr; int totalRows = 0, i, instChoice; Point cSize; Boolean bCellSelected; GrafPtr oldPort; GetPort(&oldPort); SetPort(gWPtr); gCurrWin = kAdditionsID; /* gControls->aw = (CompWin *) NewPtrClear(sizeof(CompWin)); */ GetResourcedString(next, rInstList, sNextBtn); GetResourcedString(back, rInstList, sBackBtn); // get controls listBoxRect = Get1Resource('RECT', rCompListBox); reserr = ResError(); if (reserr == noErr && listBoxRect != NULL) { HLock((Handle)listBoxRect); SetRect(&gControls->aw->compListBox, ((Rect*)*listBoxRect)->left, ((Rect*)*listBoxRect)->top, ((Rect*)*listBoxRect)->right, ((Rect*)*listBoxRect)->bottom); HUnlock((Handle)listBoxRect); } else { ErrorHandler(reserr, nil); return; } gControls->aw->compDescBox = NULL; gControls->aw->compDescBox = GetNewControl(rCompDescBox, gWPtr); if (!gControls->aw->compDescBox) { ErrorHandler(eMem, nil); return; } gControls->aw->compListBox.right -= kScrollBarWidth; instChoice = gControls->opt->instChoice-1; for (i=0; i<kMaxComponents; i++) { if (totalRows >= gControls->cfg->numComps) break; if (!gControls->cfg->comp[i].invisible && gControls->cfg->comp[i].additional && (gControls->cfg->st[instChoice].comp[i] == kInSetupType)) totalRows++; } SetRect(&dataBounds, 0, 0, 1, totalRows); SetPt( &cSize, 0, 0); gControls->aw->compList = LNew((const Rect*)&gControls->aw->compListBox, (const Rect*)&dataBounds, cSize, rCheckboxLDEF, gWPtr, true, false, false, true); (*gControls->aw->compList)->selFlags = lExtendDrag + lUseSense + lDoVAutoscroll; HLock((Handle)gControls->aw->compDescBox); SetRect(&viewRect, (*gControls->aw->compDescBox)->contrlRect.left, (*gControls->aw->compDescBox)->contrlRect.top, (*gControls->aw->compDescBox)->contrlRect.right, (*gControls->aw->compDescBox)->contrlRect.bottom); HUnlock((Handle)gControls->aw->compDescBox); viewRect.top += kInterWidgetPad; SetRect(&viewRect, viewRect.left + kTxtRectPad, viewRect.top + kTxtRectPad, viewRect.right - kTxtRectPad, viewRect.bottom - kTxtRectPad); TextFont(applFont); TextSize(9); gControls->aw->compDescTxt = TENew(&viewRect, &viewRect); TextFont(systemFont); TextSize(12); // populate controls bCellSelected = AddPopulateCompInfo(); // show controls GetResourcedString(compDescTitle, rInstList, sCompDescTitle); SetControlTitle(gControls->aw->compDescBox, compDescTitle); MoveTo( gControls->aw->compListBox.left, gControls->aw->compListBox.top - kInterWidgetPad); HLock(gControls->cfg->selCompMsg); selCompMsg = CToPascal(*gControls->cfg->selAddMsg); if (selCompMsg) DrawString( selCompMsg ); HUnlock(gControls->cfg->selCompMsg); SetRect(&listBoxFrame, gControls->aw->compListBox.left, --gControls->aw->compListBox.top, gControls->aw->compListBox.right + kScrollBarWidth, ++gControls->aw->compListBox.bottom); FrameRect(&listBoxFrame); ShowNavButtons( back, next ); if (bCellSelected) AddSetOptInfo(true); else DrawDiskSpaceMsgs( gControls->opt->vRefNum ); // default highlight first row AddInitRowHighlight(0); #if 0 RGBColor backColorOld; Rect adjustedRect, *clRect = &gControls->aw->compListBox; SetRect(&adjustedRect, clRect->left, clRect->top+1, clRect->right, clRect->bottom-1); GetBackColor(&backColorOld); BackColor(whiteColor); EraseRect(&adjustedRect); RGBBackColor(&backColorOld); #endif SetPort(oldPort); }