Ticket #5465: adds_onwhenpushed_to_pushbuttons.diff
File adds_onwhenpushed_to_pushbuttons.diff, 3.9 KB (added by , 16 years ago) |
---|
-
libmyth/xmlparse.cpp
2922 2922 QPixmap *image_on = NULL; 2923 2923 QPixmap *image_off = NULL; 2924 2924 QPixmap *image_pushed = NULL; 2925 QPixmap *image_pushedon = NULL; 2925 2926 2926 2927 QString name = element.attribute("name", ""); 2927 2928 if (name.isNull() || name.isEmpty()) … … 2996 2997 cerr << "xmparse.o: I can't find a file called " << (const char *)file << endl ; 2997 2998 } 2998 2999 } 3000 if (imgname.lower() == "pushedon") 3001 { 3002 image_pushedon = gContext->LoadScalePixmap(file); 3003 if (!image_pushedon) 3004 { 3005 cerr << "xmparse.o: I can't find a file called " << (const char *)file << endl ; 3006 } 3007 } 2999 3008 } 3000 3009 else 3001 3010 { … … 3011 3020 image_off = new QPixmap(); 3012 3021 if (!image_pushed) 3013 3022 image_pushed = new QPixmap(); 3023 if (!image_pushedon) 3024 image_pushedon = new QPixmap(); 3014 3025 3015 3026 UIPushButtonType *pbt = new UIPushButtonType(name, *image_on, *image_off, 3016 *image_pushed); 3027 *image_pushed, 3028 *image_pushedon); 3017 3029 3018 3030 delete image_on; 3019 3031 delete image_off; 3020 3032 delete image_pushed; 3033 delete image_pushedon; 3021 3034 3022 3035 pbt->SetScreen(wmult, hmult); 3023 3036 pbt->setPosition(pos); -
libmyth/uitypes.cpp
4830 4830 4831 4831 // ******************************************************************** 4832 4832 4833 UIPushButtonType::UIPushButtonType(const QString &name, QPixmap on, QPixmap off, QPixmap pushed )4833 UIPushButtonType::UIPushButtonType(const QString &name, QPixmap on, QPixmap off, QPixmap pushed, QPixmap pushedon) 4834 4834 : UIType(name) 4835 4835 { 4836 4836 on_pixmap = on; 4837 4837 off_pixmap = off; 4838 4838 pushed_pixmap = pushed; 4839 pushedon_pixmap = pushedon; 4839 4840 currently_pushed = false; 4840 4841 takes_focus = true; 4841 4842 m_lockOn = false; … … 4864 4865 4865 4866 if (currently_pushed) 4866 4867 { 4867 p->drawPixmap(m_displaypos.x(), m_displaypos.y(), pushed_pixmap); 4868 if (has_focus && !!pushedon_pixmap) 4869 { 4870 p->drawPixmap(m_displaypos.x(), m_displaypos.y(), pushedon_pixmap); 4871 } 4872 else 4873 { 4874 p->drawPixmap(m_displaypos.x(), m_displaypos.y(), pushed_pixmap); 4875 } 4868 4876 } 4869 4877 else 4870 4878 { … … 4931 4939 { 4932 4940 width = pushed_pixmap.width(); 4933 4941 } 4942 if (pushedon_pixmap.width() > width) 4943 { 4944 width = pushedon_pixmap.width(); 4945 } 4934 4946 4935 4947 height = off_pixmap.height(); 4936 4948 if (on_pixmap.height() > height) … … 4941 4953 { 4942 4954 height = pushed_pixmap.height(); 4943 4955 } 4956 if (pushedon_pixmap.height() > height) 4957 { 4958 height = pushedon_pixmap.height(); 4959 } 4944 4960 4945 4961 screen_area = QRect(x, y, width, height); 4946 4962 } -
libmyth/uitypes.h
1182 1182 1183 1183 public: 1184 1184 1185 UIPushButtonType(const QString &name, QPixmap on, QPixmap off, QPixmap pushed );1186 1185 UIPushButtonType(const QString &name, QPixmap on, QPixmap off, QPixmap pushed, QPixmap pushedon=QPixmap()); 1186 1187 1187 virtual void Draw(QPainter *, int drawlayer, int context); 1188 1188 void setPosition(QPoint pos){m_displaypos = pos;} 1189 1189 virtual void calculateScreenArea(); … … 1206 1206 QPixmap on_pixmap; 1207 1207 QPixmap off_pixmap; 1208 1208 QPixmap pushed_pixmap; 1209 QPixmap pushedon_pixmap; 1209 1210 bool currently_pushed; 1210 1211 QTimer push_timer; 1211 1212 bool m_lockOn;