void TOutlineViewer::draw() { ushort nrmColor = getColor(0x0401); firstThat(drawTree); dBuf.moveChar(0, ' ', nrmColor, size.x); writeLine(0, auxPos + 1, size.x, size.y - (auxPos - delta.y), dBuf); }
void TProgram::getEvent(TEvent& event) { if( pending.what != evNothing ) { event = pending; pending.what = evNothing; } else { event.getMouseEvent(); if( event.what == evNothing ) { event.getKeyEvent(); if( event.what == evNothing ) idle(); } } if( statusLine != 0 ) { if( (event.what & evKeyDown) != 0 || ( (event.what & evMouseDown) != 0 && firstThat( hasMouse, &event ) == statusLine ) ) statusLine->handleEvent( event ); } }
/* Updates the limits of the outline viewer. Should be called whenever the data of the outline viewer changes. This includes during the initalization of base classes. TOutlineViewer assumes that the outline is empty. If the outline becomes non-empty during the initialization, Update must be called. Also, if during the operation of the TOutlineViewer the data being displayed changes, Update and DrawView must be called. } */ void TOutlineViewer::update() { updateCount = 0; updateMaxX = 0; firstThat(countNode); setLimit(updateMaxX, updateCount); adjustFocus(foc); }
void TGroup::handleEvent( TEvent& event ) { TView::handleEvent( event ); handleStruct hs( event, *this ); if( (event.what & focusedEvents) != 0 ) { phase = phPreProcess; forEach( doHandleEvent, &hs ); phase = phFocused; doHandleEvent( current, &hs ); phase = phPostProcess; forEach( doHandleEvent, &hs ); } else { phase = phFocused; if( (event.what & positionalEvents) != 0 ) { doHandleEvent( firstThat( hasMouse, &event ), &hs ); } else forEach( doHandleEvent, &hs ); } }
void TGroup::handleEvent(TEvent &event) { TView::handleEvent(event); handleStruct hs(event, *this); if ((event.what & focusedEvents) != 0) { phase = phPreProcess; forEach(doHandleEvent, &hs); phase = phFocused; doHandleEvent(current, &hs); phase = phPostProcess; forEach(doHandleEvent, &hs); } else { phase = phFocused; if ((event.what & positionalEvents) != 0) { // get pointer to topmost view holding mouse TView *p = firstThat(hasMouse, &event); if (p) // we have a view; send event to it doHandleEvent(p, &hs); } else forEach(doHandleEvent, &hs); } }
Boolean TGroup::valid(ushort command) { if (command == cmReleasedFocus) { if (current && (current->options & ofValidate)) return current->valid(command); else return True; } return Boolean(firstThat(isInvalid, &command) == 0); }
void TClientCollection::searchArea( char *areaToFind ) { TClient *foundClient = (TClient *)firstThat( &areaMatch, areaToFind ); if( !foundClient ) cout << "No client met the search requirement" << endl; else { cout << "Found client:" << endl; print( foundClient, 0 ); } }
void ScrollGroup::handleEvent(TEvent& event) { TGroup::handleEvent(event); if(event.what == evBroadcast) { if(event.message.command == cmScrollBarChanged && (event.message.infoPtr == hScrollBar || event.message.infoPtr == vScrollBar)) scrollDraw(); else if(event.message.command == cmReceivedFocus && firstThat(isView, event.message.infoPtr) != 0) focusSubView((TView*) event.message.infoPtr); } }
void TOutlineViewer::handleEvent(TEvent &event) { const int mouseAutoToSkip = 3; TPoint mouse; TNode *cur; int newFocus; int count; char *graph; uchar dragged; TScroller::handleEvent(event); switch (event.what) { case evMouseDown: count = 0; dragged = 0; do { if (dragged < 2) dragged++; mouse = makeLocal(event.mouse.where); if (mouseInView(event.mouse.where)) newFocus = delta.y + mouse.y; else { if (event.what == evMouseAuto) count++; if (count == mouseAutoToSkip) { count = 0; if (mouse.y < 0) newFocus--; if (mouse.y >= size.y) newFocus++; } } if (foc != newFocus) { adjustFocus(newFocus); drawView(); } } while (!(event.mouse.eventFlags & meDoubleClick) && mouseEvent(event, evMouseMove + evMouseAuto)); if (event.mouse.eventFlags & meDoubleClick) selected(foc); else { if (dragged < 2) { cur = firstThat(isFocused); graph = getGraph(focLevel, focLines, focFlags); if (mouse.x < strlen(graph)) { adjust(cur, ! isExpanded(cur) ? True : False); update(); drawView(); } delete graph; } } break; case evKeyboard: newFocus = foc; switch (ctrlToArrow(event.keyDown.keyCode)) { case kbUp: case kbLeft: newFocus--; break; case kbDown: case kbRight: newFocus++; break; case kbPgDn: newFocus += size.y - 1; break; case kbPgUp: newFocus -= size.y - 1; break; case kbHome: newFocus = delta.y; break; case kbEnd: newFocus = delta.y + size.y - 1; break; case kbCtrlPgUp: newFocus = 0; break; case kbCtrlPgDn: newFocus = limit.y - 1; break; case kbCtrlEnter: case kbEnter: selected(newFocus); break; default: uchar code = event.keyDown.charScan.charCode; switch (code) { case '-': case '+': adjust(getNode(newFocus), code == '+' ? True : False); break; case '*': expandAll(getNode(newFocus)); break; default: return; } update(); } clearEvent(event); adjustFocus(newFocus); drawView(); }; };
TNode *TOutlineViewer::getNode(int i) { auxPos = i; return firstThat(isNode); }
void TProgram::getEvent(TEvent& event) { if( pending.what != evNothing ) { event = pending; pending.what = evNothing; } else { #ifdef __MSDOS__ event.getMouseEvent(); if( event.what == evNothing ) { event.getKeyEvent(); if( event.what == evNothing ) idle(); } #else // __MSDOS__ #ifdef __OS2__ ULONG which; int delay = TEventQueue::lastMouse.buttons != 0 ? TEventQueue::autoDelay : event_delay; APIRET rc = DosWaitMuxWaitSem(TThreads::hmuxMaster,delay,&which); if (rc==0 || TEventQueue::lastMouse.buttons != 0) { if (which==0 || TEventQueue::lastMouse.buttons != 0) { event.getMouseEvent(); } else if (which==1) { event.getKeyEvent(); } } else { event.what = evNothing; idle(); } #else #ifdef __NT__ DWORD rc; int delay = TEventQueue::lastMouse.buttons != 0 ? TEventQueue::autoDelay : event_delay; rc = TThreads::ispending() ? WAIT_OBJECT_0 : WaitForSingleObject(TThreads::chandle[0],delay); switch ( rc ) { default: case WAIT_OBJECT_0: event.getMouseEvent(); if ( event.what == evNothing ) { event.getKeyEvent(); if ( event.what == evNothing ) idle(); } break; case WAIT_TIMEOUT: event.what = evNothing; if ( TEventQueue::lastMouse.buttons != 0 ) event.getMouseEvent(); if ( event.what == evNothing ) idle(); break; } #else #error Unknown platform! #endif // __NT__ #endif // __OS2__ #endif // __MSDOS__ } if( statusLine != 0 ) { if( (event.what & evKeyDown) != 0 || ( (event.what & evMouseDown) != 0 && firstThat( hasMouse, &event ) == statusLine ) ) statusLine->handleEvent( event ); } }
JObject* JList::operator[](int index) { return firstThat(DoIndexHas, (void**)&index); }
JObject* JList::operator[](const JObject& o) { return firstThat(DoHas, (void**)&o); }
int JList::indexOf(const JObject& o) { int index = -1, count = -1; void* arg[] = { &index, &count, (void*)&o}; *firstThat(DoIndexOf, arg); return index; }