// -------------------------------------------------------------------------------------- void HandleContentClick(WindowRef window, Point mouseLocation, EventModifiers modifiers) { ListHandle iconList; Rect iconListRect; Boolean isDoubleClick; Cell theCell; GetWindowProperty(window, kAppSignature, kIconListTag, sizeof(ListHandle), NULL, &iconList); GetListViewBounds(iconList, &iconListRect); iconListRect.right += kScrollBarWidth; SetPortWindowPort(window); GlobalToLocal(&mouseLocation); if (PtInRect(mouseLocation, &iconListRect)) { SInt16 pixelDepth; Boolean isColorDevice; GetWindowDeviceDepthAndColor(window, &pixelDepth, &isColorDevice); SetThemeBackground(kThemeBrushWhite, pixelDepth, isColorDevice); // if LClick causes the list selection to change, or the isDoubleClick = LClick(mouseLocation, modifiers, iconList); // scroll bar SetPt(&theCell, 0, 0); // to change, the affected cells are LGetSelect(true, &theCell, iconList); // immediately drawn (no update event) if ((theCell.v + 1) != gPanelNumber) changePanel(window, theCell.v + 1); } }
void mac_clickeventlog(WindowPtr window, EventRecord *event) { Session *s = mac_windowsession(window); Point mouse; GrafPtr saveport; GetPort(&saveport); SetPort((GrafPtr)GetWindowPort(window)); mouse = event->where; GlobalToLocal(&mouse); LClick(mouse, event->modifiers, s->eventlog); SetPort(saveport); }
static void click_ListWin(Point local, short modifiers) { Boolean doubleclick; Cell cell; SetPortWindowPort(win.ref); doubleclick=LClick(local, modifiers, gPlaylist); if(doubleclick){ mac_rc=RC_LOAD_FILE; cell = LLastClick(gPlaylist); nPlaying=cell.v; mac_HandleControl(); } }
extern pascal Boolean LClickWhite(Point pt, SInt16 modifiers, ListHandle lHandle) { OSStatus err; MoreThemeDrawingState state; Boolean result; err = MoreGetThemeDrawingState(&state); if (err == noErr) { err = MoreNormalizeThemeDrawingState(); assert(err == noErr); result = LClick(pt, modifiers, lHandle); err = MoreSetThemeDrawingState(state, true); } assert(err == noErr); return result; }
void InAdditionsContent(EventRecord* evt, WindowPtr wCurrPtr) { Point localPt; Rect r, currCellRect, checkbox; ControlPartCode part; int i; Cell currCell; UInt8 hiliteVal; PixPatHandle ppH; GrafPtr oldPort; GetPort(&oldPort); SetPort(wCurrPtr); localPt = evt->where; GlobalToLocal( &localPt); /* Mouse Up */ /* scroll */ SetRect(&r, gControls->aw->compListBox.right, gControls->aw->compListBox.top, gControls->aw->compListBox.right + kScrollBarWidth, gControls->aw->compListBox.bottom); if ((evt->what == mouseUp) && (PtInRect( localPt, &r))) { LClick(localPt, evt->modifiers, gControls->aw->compList); SetRect(&r, gControls->aw->compListBox.left, gControls->aw->compListBox.top, gControls->aw->compListBox.right + 1, gControls->aw->compListBox.bottom); FrameRect(&r); } /* or un/check components */ if ((evt->what == mouseUp) && (PtInRect( localPt, &gControls->aw->compListBox))) { LClick(localPt, evt->modifiers, gControls->aw->compList); AddUpdateRowHighlight(localPt); /* invert the checkbox rect */ for (i=0; i<numRows; i++) { SetPt(&currCell, 0, i); LRect(&currCellRect, currCell, gControls->aw->compList); if (PtInRect(localPt, &currCellRect)) { SetRect(&checkbox, currCellRect.left+4, currCellRect.top+2, currCellRect.left+16, currCellRect.top+14); INVERT_HIGHLIGHT(&checkbox); break; } } AddSetOptInfo(false); } /* Mouse Down */ if ((evt->what == mouseDown) && (PtInRect( localPt, &gControls->aw->compListBox))) { /* show depressed button state */ for (i=0; i<numRows; i++) { SetPt(&currCell, 0, i); LRect(&currCellRect, currCell, gControls->aw->compList); if (PtInRect(localPt, &currCellRect)) { SetRect(&checkbox, currCellRect.left+4, currCellRect.top+2, currCellRect.left+16, currCellRect.top+14); ppH = GetPixPat(rGrayPixPattern); FillCRect(&checkbox, ppH); FrameRect(&checkbox); if (gControls->cfg->comp[rowToComp[i]].selected) { /* draw check mark */ MoveTo(checkbox.left+1, checkbox.top+1); LineTo(checkbox.right-2, checkbox.bottom-2); MoveTo(checkbox.right-2, checkbox.top+1); LineTo(checkbox.left+1, checkbox.bottom-2); } /* create 3D depression */ MoveTo(checkbox.left+1, checkbox.top+1); LineTo(checkbox.left+1, checkbox.bottom-1); MoveTo(checkbox.left+1, checkbox.top+1); LineTo(checkbox.right-1, checkbox.top+1); ForeColor(whiteColor); MoveTo(checkbox.right-1, checkbox.top+1); LineTo(checkbox.right-1, checkbox.bottom-1); MoveTo(checkbox.left+1, checkbox.bottom-1); LineTo(checkbox.right-1, checkbox.bottom-1); ForeColor(blackColor); if (ppH) DisposePixPat(ppH); break; } } } HLock((Handle)gControls->backB); r = (**(gControls->backB)).contrlRect; HUnlock((Handle)gControls->backB); if (PtInRect( localPt, &r)) { /* reset all rows to be not highlighted */ for (i=1; i<numRows; i++) gControls->cfg->comp[rowToComp[i]].highlighted = false; part = TrackControl(gControls->backB, evt->where, NULL); if (part) { /* extra handling since we used DrawString for static text msg * and framed our own listbox etc. */ gControls->aw->compListBox.top = 0; EraseRect(&gControls->aw->compListBox); ClearDiskSpaceMsgs(); KillControls(gWPtr); ShowComponentsWin(); return; } } HLock((Handle)gControls->nextB); r = (**(gControls->nextB)).contrlRect; HUnlock((Handle)gControls->nextB); if (PtInRect( localPt, &r)) { /* reset all rows to be not highlighted */ for (i=0; i<numRows; i++) gControls->cfg->comp[rowToComp[i]].highlighted = false; part = TrackControl(gControls->nextB, evt->where, NULL); if (part) { if (!VerifyDiskSpace()) return; gControls->aw->compListBox.top = 0; EraseRect(&gControls->aw->compListBox); ClearDiskSpaceMsgs(); KillControls(gWPtr); ShowTerminalWin(); return; } } SetPort(oldPort); }