Ticket #3930: mythtv-mouse.diff
| File mythtv-mouse.diff, 29.6 KB (added by Anthony D'Alberto <afd1009@…>, 5 years ago) |
|---|
-
mythtv/libs/libmythui/myththemedmenu.cpp
103 103 void parseButtonDefinition(const QString &dir, QDomElement &element); 104 104 void parseButton(const QString &dir, QDomElement &element); 105 105 106 //added by Anthony D'Alberto to support back button 107 void parseBackButton(const QString &dir, QDomElement &element); 108 //end of added section 109 106 110 void parseText(TextAttributes &attributes, QDomElement &element); 107 111 void parseOutline(TextAttributes &attributes, QDomElement &element); 108 112 void parseShadow(TextAttributes &attributes, QDomElement &element); … … 146 150 MythImage *downarrow; 147 151 QRect downarrowRect; 148 152 153 //added by Anthony D'Alberto to support back button 154 MythImage *backbutton; 155 QRect backbuttonRect; 156 //end of added section 157 149 158 QPoint watermarkPos; 150 159 QRect watermarkRect; 151 160 … … 233 242 MythUIStateType *watermark; 234 243 MythUIImage *uparrow; 235 244 MythUIImage *downarrow; 245 246 //added by Anthony D'Alberto to support back button 247 MythUIImage *backbutton; 248 //end of added section 249 236 250 }; 237 251 238 252 ///////////////////////////////////////////////////////////////////////////// … … 249 263 downarrow = NULL; 250 264 buttonBackground = NULL; 251 265 266 //added by Anthony D'Alberto to support back button 267 backbutton = NULL; 268 //end of added section 269 252 270 loaded = false; 253 271 254 272 callback = NULL; … … 275 293 downarrow->DownRef(); 276 294 if (buttonBackground) 277 295 buttonBackground->DownRef(); 296 //added by Anthony D'Alberto to support back button 297 if (backbutton) 298 backbutton->DownRef(); 299 //end of added section 278 300 279 301 logo = NULL; 280 302 buttonnormal = NULL; … … 282 304 uparrow = NULL; 283 305 downarrow = NULL; 284 306 buttonBackground = NULL; 307 //added by Anthony D'Alberto to support back button 308 backbutton = NULL; 309 //end of added section 285 310 286 311 QMap<QString, ButtonIcon>::Iterator it; 287 312 for (it = allButtonIcons.begin(); it != allButtonIcons.end(); ++it) … … 958 983 } 959 984 else 960 985 { 961 downarrow = MythImage::FromQImage(&pix);962 downarrowRect = arrowrect;986 downarrow = MythImage::FromQImage(&pix); 987 downarrowRect = arrowrect; 963 988 } 964 989 } 965 990 991 //added by Anthony D'Alberto to support back button 992 void MythThemedMenuState::parseBackButton(const QString &dir, QDomElement &element) 993 { 994 QRect backrect; 995 QPoint backpos; 996 QImage *pix = NULL; 997 998 bool hasimage = false; 999 bool hasposition = false; 1000 1001 for (QDomNode child = element.firstChild(); !child.isNull(); 1002 child = child.nextSibling()) 1003 { 1004 QDomElement info = child.toElement(); 1005 if (!info.isNull()) 1006 { 1007 if (info.tagName() == "image") 1008 { 1009 QString backpath = dir + getFirstText(info); 1010 pix = gContext->LoadScaleImage(backpath); 1011 if (pix) 1012 hasimage = true; 1013 } 1014 else if (info.tagName() == "position") 1015 { 1016 backpos = parsePoint(info); 1017 hasposition = true; 1018 } 1019 else 1020 { 1021 VERBOSE(VB_GENERAL, QString("MythThemedMenuPrivate: Unknown tag %1 " 1022 "in back button").arg(info.tagName())); 1023 return; 1024 } 1025 } 1026 } 1027 1028 if (!hasimage) 1029 { 1030 VERBOSE(VB_IMPORTANT, "MythThemedMenuPrivate: Missing image tag in back button"); 1031 return; 1032 } 1033 1034 if (!hasposition) 1035 { 1036 VERBOSE(VB_IMPORTANT, "MythThemedMenuPrivate: Missing position tag in back button"); 1037 return; 1038 } 1039 1040 backrect = QRect(backpos.x(), backpos.y(), pix->width(), 1041 pix->height()); 1042 1043 backbutton = MythImage::FromQImage(&pix); 1044 backbuttonRect = backrect; 1045 } 1046 //end of added section 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 966 1057 void MythThemedMenuState::parseButton(const QString &dir, QDomElement &element) 967 1058 { 968 1059 bool hasname = false; … … 1108 1199 titleText = ""; 1109 1200 uparrow = NULL; 1110 1201 downarrow = NULL; 1202 //added by Anthony D'Albeto to support back button 1203 backbutton = NULL; 1204 //end of added section 1205 1111 1206 watermarkPos = QPoint(0, 0); 1112 1207 watermarkRect = QRect(0, 0, 0, 0); 1113 1208 } … … 1183 1278 { 1184 1279 parseArrow(dir, e, false); 1185 1280 } 1281 //added by Anthony D'Alberto to support back button 1282 else if (e.tagName() == "backbutton") 1283 { 1284 parseBackButton(dir, e); 1285 } 1286 //end of added section 1186 1287 else if (e.tagName() == "font") 1187 1288 { 1188 1289 if (parseFonts) … … 1513 1614 downarrow->SetVisible(false); 1514 1615 downarrow->SetCanTakeFocus(true); 1515 1616 1617 //added by Anthony D'Alberto to support back button 1618 backbutton = new MythUIImage(parent, "menu back button"); 1619 if (m_state->backbutton) 1620 { 1621 backbutton->SetArea(m_state->backbuttonRect); 1622 backbutton->SetImage(m_state->backbutton); 1623 } 1624 backbutton->SetVisible(true); 1625 backbutton->SetCanTakeFocus(true); 1626 //end of added section 1627 1516 1628 checkScrollArrows(); 1517 1629 } 1518 1630 … … 2035 2147 QStringList action = "PAGEDOWN"; 2036 2148 keyHandler(action, false); 2037 2149 } 2150 //added by Anthony D'Alberto to support back button 2151 else if (origtype == backbutton) 2152 { 2153 QStringList action = "ESCAPE"; 2154 keyHandler(action, true); 2155 return(true); 2156 } 2157 //end of added section 2038 2158 else 2039 2159 { 2040 2160 if (ThemedButton *button = reinterpret_cast<ThemedButton*>(origtype)) -
mythtv/libs/libmyth/uilistbtntype.h
27 27 class UIListBtnType; 28 28 class UIListBtnTypeItem; 29 29 30 //added by Anthony D'Alberto to support the mouse press 31 enum MouseMove{ListMoveLeft=1, ListMoveRight=2, ClickCheck=4, ListMoveUp=8, ListMoveDown=16, ListPageUp=32, ListPageDown=64}; 32 //end of added section 33 30 34 class MPUBLIC UIListGenericTree : public GenericTree 31 35 { 32 36 public: … … 123 127 public slots: 124 128 bool takeFocus(); 125 129 void looseFocus(); 126 130 131 //Added by Anthony D'Alberto to support mouse press 132 int mousePressHandler(QMouseEvent *e); 133 //end of added section 134 127 135 private: 128 136 void FillLevelFromTree(UIListGenericTree *item, UIListBtnType *list); 129 137 void ClearLevel(UIListBtnType *list); … … 220 228 bool takeFocus(); 221 229 void looseFocus(); 222 230 231 //added by Anthony D'Alberto to support mouse press 232 int mousePressHandler(QMouseEvent *e); 233 //end if added section 234 223 235 private: 224 236 void Init(); 225 237 void LoadPixmap(QPixmap& pix, const QString& fileName); … … 337 349 bool moveUpDown(bool flag); 338 350 339 351 void paint(QPainter *p, fontProp *font, int x, int y, bool active_on); 340 352 353 //added by Anthony D'Alberto to support mouse presses 354 int MouseClicked(int x, int y); 355 //end of added section 356 341 357 protected: 342 358 void CalcDimensions(void); 343 359 -
mythtv/libs/libmyth/mythdialogs.cpp
528 528 popup.addLabel(message, Medium, true); 529 529 530 530 MythRemoteLineEdit* textEdit = new MythRemoteLineEdit(&popup, "chooseEdit"); 531 531 532 textEdit->setText(text); 532 533 popup.addWidget(textEdit); 533 534 … … 1323 1324 widget_with_current_focus->takeFocus(); 1324 1325 } 1325 1326 1327 //added by Anthony D'Alberto to support back button...and mouse presses 1328 void MythThemedDialog::mouseReleaseEvent(QMouseEvent *e) 1329 { 1330 if(e->button() == QMouseEvent::RightButton) 1331 { 1332 e->accept(); 1333 reject(); 1334 return; 1335 } 1336 else if(e->button() == QMouseEvent::LeftButton) 1337 { 1338 int x=e->x(); 1339 int y=e->y(); 1340 //qDebug("MythThemedDialog::mouseReleaseEvent %d %d", x, y); 1341 1342 UIType *type = widget_with_current_focus; 1343 1344 if(type) 1345 { 1346 QRect rc = type->getScreenArea(); 1347 if(rc.contains(x,y)) 1348 { 1349 // qDebug("target %p %s %d %d \n", 1350 // type, 1351 // type->getName().local8Bit().data(), 1352 // rc.x(), 1353 // rc.y()); 1354 type->activate(); 1355 e->accept(); 1356 return; 1357 } 1358 }else 1359 { 1360 //qDebug("Widget not defined"); 1361 } 1362 } 1363 MythDialog::mouseReleaseEvent(e); 1364 } 1365 1366 1367 void MythThemedDialog::mousePressEvent(QMouseEvent *e) 1368 { 1369 if(e->button() != QMouseEvent::LeftButton) 1370 { 1371 // MythDialog::mouseReleaseEvent(e); 1372 return; 1373 } 1374 int x=e->x(); 1375 int y=e->y(); 1376 //printf("MythThemedDialog::mousePressEvent %d %d", x, y); 1377 QPtrListIterator<LayerSet> an_it(my_containers); 1378 LayerSet *looper; 1379 1380 while((looper= an_it.current()) != 0) 1381 { 1382 QRect container_area = looper->GetAreaRect(); 1383 if(container_area.isValid() && 1384 container_area.contains(x,y) && 1385 looper->GetName().lower() != "background") 1386 { 1387 //loop over UI types within each container 1388 vector<UIType *> *all_ui_type_objects = looper->getAllTypes(); 1389 vector<UIType *>::iterator i=all_ui_type_objects->begin(); 1390 for(; i!=all_ui_type_objects->end();i++) 1391 { 1392 UIType *type = (*i); 1393 QRect rc = type->getScreenArea(); 1394 //if the UI element is under the mouse 1395 if(rc.contains(x,y)) 1396 { 1397 printf("target %p %s %d %d\n", 1398 type, 1399 type->getName().local8Bit().data(), 1400 rc.x(), 1401 rc.y()); 1402 1403 if(type->canTakeFocus()) 1404 { 1405 if(widget_with_current_focus) 1406 { 1407 widget_with_current_focus->looseFocus(); 1408 } 1409 widget_with_current_focus=type; 1410 widget_with_current_focus->takeFocus(); 1411 } 1412 else 1413 { 1414 //qDebug("Cannot Take Focus"); 1415 //type->mousePressHandler(e); 1416 //the child class should take care of this 1417 } 1418 1419 e->accept(); 1420 return; 1421 } 1422 } 1423 } 1424 ++an_it; 1425 } 1426 MythDialog::mousePressEvent(e); 1427 } 1428 1429 //end of added section 1430 1326 1431 UIManagedTreeListType* MythThemedDialog::getUIManagedTreeListType(const QString &name) 1327 1432 { 1328 1433 QPtrListIterator<LayerSet> an_it(my_containers); … … 1753 1858 QStringList actions; 1754 1859 if (gContext->GetMainWindow()->TranslateKeyPress("qt", e, actions)) 1755 1860 { 1756 for (unsigned int i = 0; i < actions.size() && !handled; i++) 1861 for (unsigned int i = 0; i < actions.size() && !handled; i++) 1757 1862 { 1758 1863 QString action = actions[i]; 1759 1864 if (action == "ESCAPE") -
mythtv/libs/libmyth/mythwidgets.cpp
736 736 { 737 737 bool handled = false; 738 738 QStringList actions; 739 739 740 740 if ((!popup || !popup->isShown()) && 741 741 gContext->GetMainWindow()->TranslateKeyPress("qt", e, actions, false)) 742 742 { … … 769 769 { 770 770 if (gContext->GetNumSetting("UseVirtualKeyboard", 1) == 1) 771 771 { 772 printf("UseVirtualKeyboard\n"); 772 773 popup = new VirtualKeyboard(gContext->GetMainWindow(), this); 773 774 gContext->GetMainWindow()->detach(popup); 774 775 popup->exec(); -
mythtv/libs/libmyth/uilistbtntype.cpp
853 853 UIType::looseFocus(); 854 854 } 855 855 856 //added by Anthony D'Alberto to support mouse press 857 int UIListTreeType::mousePressHandler(QMouseEvent *e) 858 { 859 int iReturnValue = -1; 860 QRect rect; 861 QRect arearect; 862 863 if(currentlevel != NULL) 864 { 865 //get screen area where widget resides 866 arearect = currentlevel->GetArea(); 867 int iDrawOffset = currentlevel->GetDrawOffset(); 868 869 //now create a new rectangle, adjusting for the offset 870 rect.setRect(arearect.x() + iDrawOffset + screen_area.x(), 871 arearect.y() + screen_area.y(), 872 arearect.width(), 873 arearect.height() ); 874 875 if(rect.contains(e->x(), e->y())) 876 { 877 //define a new point with the screen offset taken out 878 //to get relative position in widget 879 QPoint pt(e->x() - rect.x(), e->y() - rect.y()); 880 881 //now define a new event with our new point 882 QMouseEvent NewEvent(QEvent::MouseButtonPress, 883 pt, 884 e->button(), 885 e->state()); 886 iReturnValue = currentlevel->mousePressHandler(&NewEvent); 887 SetCurrentPosition(); 888 RedrawCurrent(); 889 890 if((iReturnValue & ListMoveRight) == ListMoveRight) 891 { 892 MoveRight(true); 893 } 894 895 if((iReturnValue & ListPageDown) == ListPageDown) 896 { 897 MoveDown(MovePage); 898 } 899 900 if((iReturnValue & ListPageUp) == ListPageUp) 901 { 902 MoveUp(MovePage); 903 } 904 } 905 else 906 { 907 //if the Y position is good, and we are just not 908 //in on the X, we are probably going back a menu 909 if(e->y() >= rect.y() && e->y() <= rect.y() + rect.height()) 910 { 911 MoveLeft(true); 912 }else 913 { 914 //indicate we did not handle this case 915 iReturnValue = -1; 916 } 917 } 918 } 919 else 920 { 921 iReturnValue = -2; 922 } 923 924 return(iReturnValue); 925 } 926 //end of added section 927 856 928 ////////////////////////////////////////////////////////////////////////////// 857 929 858 930 UIListBtnType::UIListBtnType(const QString& name, const QRect& area, … … 1920 1992 UIType::looseFocus(); 1921 1993 } 1922 1994 1995 //added by Anthony D'Alberto to support mouse press 1996 int UIListBtnType::mousePressHandler(QMouseEvent *e) 1997 { 1998 int mousepos; 1999 int iReturnValue = 0; 2000 if(m_arrowsRect.contains(e->x(), e->y())) 2001 { 2002 iReturnValue = 0; 2003 if( ((e->x() - m_arrowsRect.x()) <= m_upArrowRegPix.width()) && 2004 m_showUpArrow == true) 2005 { 2006 iReturnValue = ListPageUp; 2007 } 2008 else if( (e->x()-m_arrowsRect.x() >= m_upArrowRegPix.width() + 2009 m_itemMargin) && 2010 m_showDnArrow == true) 2011 { 2012 iReturnValue = ListPageDown; 2013 } 2014 } 2015 else 2016 { 2017 //the x and y positions were already adjusted by previous 2018 //ListType 2019 //now attempt to calculate which item the mouse is over 2020 2021 mousepos = (e->y() / (m_itemHeight + m_itemSpacing)) + 2022 m_topPosition; 2023 2024 if(mousepos < m_itemCount) 2025 { 2026 if(mousepos > m_selPosition) 2027 { 2028 for(int i=0;i<mousepos - m_selPosition;i++) 2029 ++(*m_selIterator); 2030 } 2031 else if(mousepos < m_selPosition) 2032 { 2033 for(int i=0;i<m_selPosition - mousepos;i++) 2034 --(*m_selIterator); 2035 } 2036 2037 if(m_selIterator->current()) 2038 { 2039 m_selItem = m_selIterator->current(); 2040 } 2041 m_selPosition = mousepos; 2042 } 2043 2044 mousepos -= m_topPosition; 2045 2046 iReturnValue = m_selItem->MouseClicked(e->x(), 2047 e->y() - (mousepos * (m_itemHeight+m_itemSpacing))); 2048 2049 emit itemSelected(m_selItem); 2050 } 2051 2052 return(iReturnValue); 2053 } 2054 //end of added section 2055 1923 2056 ////////////////////////////////////////////////////////////////////////////// 1924 2057 1925 2058 UIListBtnTypeItem::UIListBtnTypeItem(UIListBtnType* lbtype, const QString& text, … … 2155 2288 p->drawText(tr, Qt::AlignLeft|Qt::AlignVCenter, text); 2156 2289 } 2157 2290 2291 //added by Anthony D'Alberto to support mouse press 2292 int UIListBtnTypeItem::MouseClicked(int x, int y) 2293 { 2294 int iReturnValue = 0; 2295 QRect NewArrowRect(m_arrowRect.x() - 50, 2296 m_arrowRect.y() - 50, 2297 m_arrowRect.width() + 100, 2298 m_arrowRect.height() + 100); 2299 2300 QRect NewCheckRect(m_checkRect.x() - 50, 2301 m_checkRect.y() - 50, 2302 m_checkRect.width() + 100, 2303 m_checkRect.height() + 100); 2304 2305 if(NewArrowRect.contains(x,y)) 2306 iReturnValue |= ListMoveRight; 2307 2308 if(NewCheckRect.contains(x,y)) 2309 iReturnValue |= ClickCheck; 2310 2311 return(iReturnValue); 2312 } 2313 2314 //end of added section 2315 2316 -
mythtv/libs/libmyth/uitypes.cpp
3358 3358 rightArrowOffset.setX(0); 3359 3359 rightArrowOffset.setY(0); 3360 3360 incSearch = ""; 3361 3362 //added by Anhtony D'Alberto to support mouse presses 3363 iMapUsed = -1; 3364 x_map_location = 0; 3365 y_map_location = 0; 3366 boHasChildren = false; 3367 boHasParent = false; 3368 //end of added section 3369 3361 3370 } 3362 3371 3363 3372 UIManagedTreeListType::~UIManagedTreeListType() … … 3434 3443 return; 3435 3444 } 3436 3445 3446 //added by Anthony D'Alberto to support mouse press 3447 //initialize this each time the screen is drawn 3448 boHasChildren = false; 3449 boHasParent = false; 3450 //end of added section 3437 3451 // 3438 3452 // Put something on the LCD device (if one exists) 3439 3453 // … … 3557 3571 int x_location = bin_corners[i].left(); 3558 3572 int y_location = bin_corners[i].top() + (bin_corners[i].height() / 2) 3559 3573 + (QFontMetrics(tmpfont->face).height() / 2); 3560 3561 3574 if (!show_whole_tree) 3562 3575 { 3563 3576 x_location = area.left(); … … 3658 3671 p->drawPixmap(x_location + selectPoint.x(), y_location - QFontMetrics(tmpfont->face).height() + QFontMetrics(tmpfont->face).descent() + selectPoint.y(), (*highlight_map[i])); 3659 3672 //p->drawPixmap(x_location, y_location - QFontMetrics(tmpfont->face).height() + QFontMetrics(tmpfont->face).descent(), (*highlight_map[i])); 3660 3673 3674 //added by Anthony D'Alberto to support mouse presses 3675 x_map_location = x_location + selectPoint.x() + screen_area.left(); 3676 3677 y_map_location = y_location - QFontMetrics(tmpfont->face).height() + 3678 QFontMetrics(tmpfont->face).descent() + selectPoint.y() + 3679 screen_area.top(); 3680 3681 iMapUsed = i; 3682 3683 //end of added section 3684 3661 3685 // 3662 3686 // Left or right arrows 3663 3687 // 3664 3688 if (i == bins && hotspot_node->childCount() > 0) 3665 3689 { 3690 //added by Anthony D'Alberto to support mouse press 3691 //see if there is a child node 3692 boHasChildren = true; 3693 //end of added section 3694 3666 3695 p->drawPixmap(x_location + (*highlight_map[i]).width() - right_arrow_image.width() + rightArrowOffset.x(), 3667 3696 y_location + rightArrowOffset.y() - QFontMetrics(tmpfont->face).height() + right_arrow_image.height() / 2, 3668 3697 right_arrow_image); 3669 3698 } 3670 3699 if (i == 1 && hotspot_node->getParent()->getParent()) 3671 3700 { 3701 //added by Anthony D'Alberto to support mouse press 3702 //see if there is a parent node 3703 boHasParent = true; 3704 //end of added section 3672 3705 p->drawPixmap(x_location + leftArrowOffset.x(), 3673 3706 y_location + leftArrowOffset.y() - QFontMetrics(tmpfont->face).height() + left_arrow_image.height() / 2, 3674 3707 left_arrow_image); … … 3677 3710 else 3678 3711 { 3679 3712 p->drawPixmap(x_location + selectPoint.x(), y_location - QFontMetrics(tmpfont->face).height() + QFontMetrics(tmpfont->face).descent() + selectPoint.y(), (*highlight_map[0])); 3713 3714 //added by Anthony D'Alberto to support mouse presses 3715 x_map_location = x_location + selectPoint.x() + screen_area.left(); 3716 y_map_location = y_location - QFontMetrics(tmpfont->face).height() + 3717 QFontMetrics(tmpfont->face).descent() + selectPoint.y() + 3718 screen_area.top(); 3719 3720 iMapUsed = 0; 3721 //end of added section 3722 3680 3723 } 3681 3724 } 3682 3725 … … 4754 4797 QRect r = (*it); 4755 4798 r.moveBy(m_parent->GetAreaRect().left(), 4756 4799 m_parent->GetAreaRect().top()); 4800 4757 4801 ++i; 4758 4802 screen_corners[i] = r; 4759 4803 } … … 4761 4805 screen_area = m_parent->GetAreaRect(); 4762 4806 } 4763 4807 4808 //added by Anthony D'Alberto to support mouse presses 4809 4810 int UIManagedTreeListType::mousePressHandler(QMouseEvent *e) 4811 { 4812 int iReturnValue = -1; 4813 4814 //printf("X: %i - Y: %i\n", e->x(), e->y()); 4815 4816 //see if we are inside the control// 4817 if(screen_area.contains(e->x(), e->y())) 4818 { 4819 4820 4821 QRect BinRect(bin_corners[active_bin].left(), 4822 bin_corners[active_bin].top() + 4823 screen_corners[active_bin].top(), 4824 bin_corners[active_bin].right(), 4825 bin_corners[active_bin].bottom() - 4826 screen_corners[active_bin].top()); 4827 4828 4829 //if I'm inside the active bin 4830 if(BinRect.contains(e->x(), e->y())) 4831 { 4832 //if I'm in the active bin, I might want out 4833 //this is identified by going over the next bin's 4834 //left edge. Bins can overlap. Therefore... 4835 4836 //check to see if there is another higher bin 4837 if( ((active_bin +1) <= bins) && 4838 (e->x() >= bin_corners[active_bin+1].left()) ) 4839 { 4840 pushDown(); 4841 } 4842 4843 //get the height of the selection rectangle 4844 //to try to figure out how many items to move 4845 int iItemHeight = highlight_map[iMapUsed]->height(); 4846 4847 int iItems; 4848 4849 //create a temp rectangle the size of the selection map 4850 QRect tmpRect(x_map_location, 4851 y_map_location, 4852 highlight_map[iMapUsed]->width(), 4853 highlight_map[iMapUsed]->height()); 4854 4855 //if I'm not in the rectangle 4856 if(!tmpRect.contains(e->x(), e->y())) 4857 { 4858 //if I'm above the rectangle 4859 if(e->y() < tmpRect.top()) 4860 { 4861 iItems = (tmpRect.top() - e->y()) / (iItemHeight) + 1; 4862 4863 //now move the number of items 4864 for(int i=0;i<iItems;i++) 4865 { 4866 moveUp(false); 4867 } 4868 } 4869 4870 //now check for being below the rectangle 4871 if(e->y() > tmpRect.bottom()) 4872 { 4873 iItems = (e->y() - tmpRect.bottom()) / (iItemHeight) + 1; 4874 4875 //now move the number of items 4876 for(int i=0;i<iItems;i++) 4877 { 4878 moveDown(false); 4879 } 4880 } 4881 }else 4882 { 4883 //I'm in the selection rectangle 4884 //but first, check for a next higher bin 4885 //if I'm near the edge of the rectangle, 4886 //go to the next higher bin 4887 4888 //if I've drawn the right hand arrow 4889 if(boHasChildren == true) 4890 { 4891 //if I've clicked within 25% of the right edge 4892 if(e->x() >= (0.85 * (x_map_location + highlight_map[iMapUsed]->width())) ) 4893 { 4894 pushDown(); 4895 }else 4896 { 4897 select(); 4898 } 4899 }else if(boHasParent == true) //if there is a left arrow 4900 { 4901 if(e->x() <= (x_map_location + (0.15 * highlight_map[iMapUsed]->width()))) 4902 { 4903 popUp(); 4904 }else 4905 { 4906 select(); 4907 } 4908 4909 }else 4910 { 4911 select(); 4912 } 4913 } 4914 4915 iReturnValue = 0; 4916 }else //I'm not inside the active bin 4917 { 4918 4919 //I'm to the left of the active bin 4920 if(e->x() < BinRect.left()) 4921 { 4922 popUp(); 4923 iReturnValue = 0; 4924 } 4925 4926 //I'm to the right of the active bin 4927 if(e->x() > BinRect.right()) 4928 { 4929 pushDown(); 4930 iReturnValue = 0; 4931 } 4932 } 4933 4934 refresh(); 4935 4936 } 4937 4938 return(iReturnValue); 4939 } 4940 4941 //end of added section 4942 4764 4943 // ******************************************************************** 4765 4944 4766 4945 UIPushButtonType::UIPushButtonType(const QString &name, QPixmap on, QPixmap off, QPixmap pushed) -
mythtv/libs/libmyth/uitypes.h
125 125 virtual void hide(); 126 126 virtual bool toggleShow(); 127 127 128 //added by Anthony D'Alberto to support mouse presses in UITypes 129 //this is done by making calling the handler function in 130 //the event handler. 131 //for some reason, the uipushbutton already has this. 128 132 133 //this is the default handler, do nothing 134 virtual int mousePressHandler(QMouseEvent *e){return (-1);} 135 //end of added section 136 129 137 signals: 130 138 131 139 // … … 1113 1121 bool incSearchStart(); 1114 1122 bool incSearchNext(); 1115 1123 1124 //added by Anthony D'Alberto to support mouse press in Managed List 1125 int mousePressHandler(QMouseEvent *e); 1126 //end of added section 1127 1116 1128 signals: 1117 1129 1118 1130 void nodeSelected(int, IntVector*); // emit int and attributes when user selects a node … … 1159 1171 QPoint rightArrowOffset; 1160 1172 QString incSearch; 1161 1173 bool bIncSearchContains; 1174 1175 //added by Anthony D'Alberto to support mouse presses in List box 1176 1177 int iMapUsed; 1178 int x_map_location; 1179 int y_map_location; 1180 bool boHasChildren; 1181 bool boHasParent; 1182 //end of added section 1162 1183 }; 1163 1184 1164 1185 class MPUBLIC UIPushButtonType : public UIType -
mythtv/libs/libmyth/mythdialogs.h
322 322 QPixmap my_background; 323 323 QPixmap my_foreground; 324 324 325 //added by Anthony D'Alberto to support back button 326 virtual void mousePressEvent(QMouseEvent *e); 327 virtual void mouseReleaseEvent(QMouseEvent *e); 328 //end of added section 329 325 330 private: 326 331 327 332 void ReallyUpdateForeground(const QRect &);
