bool GUIAppListBox::MouseWheel(int params) { if ( IsSelected()) { if ( hscroll->IsSelected()) { hscroll->MouseWheel(params); return true; } if ( vscroll->IsSelected()) { vscroll->MouseWheel(params); return true; } selectIndex -= params; if ( selectIndex < 0 ) { selectIndex = 0; } if ( selectIndex >= objects.Count()) { selectIndex = objects.Count() - 1; } SetupSelection(); FocusSelection(); return true; } else { return false; } }
void DiskRipper::selectionChangedData() { int count=0; int last_track=0; bool contiguous=true; RDListViewItem *item=(RDListViewItem *)rip_track_list->firstChild(); while(item!=NULL) { int track=item->text(0).toInt(); if(item->isSelected()) { if(item->id()>0) { FocusSelection(item->id()); rip_setcut_button->setEnabled(false); rip_setall_button->setEnabled(false); rip_setsingle_button->setEnabled(false); rip_cartlabel_button->setEnabled(true); rip_clear_button->setEnabled(true); return; } if((last_track!=0)&&(last_track!=(track-1))) { contiguous=false; } last_track=track; count++; } item=(RDListViewItem *)item->nextSibling(); } rip_setcut_button->setEnabled(count==1); rip_setall_button->setEnabled(count>0); rip_setsingle_button->setEnabled((count>1)&&contiguous); rip_cartlabel_button->setEnabled(false); rip_clear_button->setEnabled(false); }
bool GUIAppListBox::KeyClick(int key, int chr) { if ( IsSelected()) { if ( vscroll->IsSelected()) { return vscroll->KeyClick(key,chr); } if ( hscroll->IsSelected()) { return hscroll->KeyClick(key,chr); } int oldIndex = selectIndex; // setting selection if ( key == HGEK_UP ) { selectIndex --; } if ( key == HGEK_DOWN ) { selectIndex ++; } if ( key == HGEK_PGUP ) { selectIndex = 0; } if ( key == HGEK_PGDN ) { if ( objects.Count()) { selectIndex = objects.Count() - 1;; } else { selectIndex = 0; } } if ( selectIndex < 0 ) { if ( objects.Count()) { selectIndex = objects.Count() - 1;; } else { selectIndex = 0; } } if ( selectIndex >= objects.Count()) { selectIndex = 0; } SetupSelection(); FocusSelection(); if ( oldIndex == selectIndex ) { if ( objects.Count()) { objects[selectIndex]->KeyClick(key,chr); } } return true; } else { return false; } }
bool GUIAppListBox::SetSelection ( int idx ) { if ( idx < objects.Count() && idx >= 0 ) { selectIndex = idx; selectObject = objects[selectIndex]; SetupSelection(); FocusSelection(); return true; } else { return false; } }
bool GUIAppListBox::MouseLButton(bool bDown) { float x,y; hge->Input_GetMousePos(&x,&y); if (hscroll->TestPoint(x,y)) { hscroll->Selected(true); hscroll->MouseLButton(bDown); vscroll->Selected(false); if ( objects.Count()) { objects[selectIndex]->Selected(false); } return true; } if (vscroll->TestPoint(x,y)) { vscroll->Selected(true); vscroll->MouseLButton(bDown); hscroll->Selected(false); if ( objects.Count()) { objects[selectIndex]->Selected(false); } return true; } if ( objects.Count()) { if (objects[selectIndex]->TestPoint(x,y)) { objects[selectIndex]->MouseLButton(bDown); return true; } } for ( int a = 0; a < objects.Count(); a ++ ) { hgeRect rect; rect.Set(objects[a]->rect.x1,objects[a]->rect.y1,objects[a]->rect.x1+listWidth,objects[a]->rect.y2); if ( rect.TestPoint(x,y)) { selectIndex = a; SetupSelection(); FocusSelection(); return true; } } return false; }