00001 #ifndef MYTHUIGUIDEGRID_H_
00002 #define MYTHUIGUIDEGRID_H_
00003
00004
00005 #include <QPixmap>
00006 #include <QPen>
00007 #include <QBrush>
00008
00009
00010 #include "mythuiexp.h"
00011
00012
00013 #include "mythuitype.h"
00014
00015 #define ARROWIMAGESIZE 4
00016 #define RECSTATUSSIZE 8
00017 #define MAX_DISPLAY_CHANS 40
00018
00019 class MythFontProperties;
00020
00028 class MUI_PUBLIC MythUIGuideGrid : public MythUIType
00029 {
00030 public:
00031 MythUIGuideGrid(MythUIType *parent, const QString &name);
00032 ~MythUIGuideGrid();
00033
00034 virtual void DrawSelf(MythPainter *p, int xoffset, int yoffset,
00035 int alphaMod, QRect clipRect);
00036
00037 enum FillType { Alpha = 10, Dense, Eco, Solid };
00038
00039 bool isVerticalLayout(void) { return m_verticalLayout; }
00040 int getChannelCount(void) { return m_channelCount; }
00041 int getTimeCount(void) { return m_timeCount; }
00042
00043 void SetCategoryColors(const QMap<QString, QString> &catColors);
00044
00045 void SetTextOffset(const QPoint &to) { m_textOffset = to; }
00046 void SetArrow(int, const QString &file);
00047 void LoadImage(int, const QString &file);
00048 void SetProgramInfo(int row, int col, const QRect &area,
00049 const QString &title, const QString &category,
00050 int arrow, int recType, int recStat, bool selected);
00051 void ResetData();
00052 void ResetRow(int row);
00053 void SetProgPast(int ppast);
00054 void SetMultiLine(bool multiline);
00055
00056 protected:
00057 virtual void Finalize(void);
00058 virtual bool ParseElement(
00059 const QString &filename, QDomElement &element, bool showWarnings);
00060 virtual void CopyFrom(MythUIType *base);
00061 virtual void CreateCopy(MythUIType *parent);
00062
00063 bool parseDefaultCategoryColors(QMap<QString, QString> &catColors);
00064
00065 private:
00066
00067 class UIGTCon
00068 {
00069 public:
00070 UIGTCon() { arrow = recType = recStat = 0; };
00071 UIGTCon(const QRect &drawArea, const QString &title,
00072 const QString &category, int arrow, int recType, int recStat)
00073 {
00074 this->drawArea = drawArea;
00075 this->title = title;
00076 this->category = category.trimmed();
00077 this->arrow = arrow;
00078 this->recType = recType;
00079 this->recStat = recStat;
00080 }
00081
00082 UIGTCon(const UIGTCon &o)
00083 {
00084 drawArea = o.drawArea;
00085 title = o.title;
00086 category = o.category;
00087 categoryColor = o.categoryColor;
00088 arrow = o.arrow;
00089 recType = o.recType;
00090 recStat = o.recStat;
00091 }
00092
00093 QRect drawArea;
00094 QString title;
00095 QString category;
00096 QColor categoryColor;
00097 int arrow;
00098 int recType;
00099 int recStat;
00100 };
00101
00102 void drawBackground(MythPainter *p, UIGTCon *data, int alpaMod);
00103 void drawBox(MythPainter *p, UIGTCon *data, const QColor &color, int alpaMod);
00104 void drawText(MythPainter *p, UIGTCon *data, int alpaMod);
00105 void drawRecType(MythPainter *p, UIGTCon *data, int alpaMod);
00106 void drawCurrent(MythPainter *p, UIGTCon *data, int alpaMod);
00107
00108 QColor calcColor(const QColor &color, int alpha);
00109
00110 QList<UIGTCon*> *allData;
00111 UIGTCon selectedItem;
00112
00113 MythImage *m_recImages[RECSTATUSSIZE];
00114 MythImage *m_arrowImages[ARROWIMAGESIZE];
00115
00116
00117 int m_channelCount;
00118 int m_timeCount;
00119 bool m_verticalLayout;
00120 int m_categoryAlpha;
00121 QPoint m_textOffset;
00122 int m_justification;
00123 bool m_multilineText;
00124 MythFontProperties *m_font;
00125 QColor m_solidColor;
00126
00127 QString m_selType;
00128 QPen m_drawSelLine;
00129 QBrush m_drawSelFill;
00130
00131 QColor m_recordingColor;
00132 QColor m_conflictingColor;
00133
00134 int m_fillType;
00135 bool m_cutdown;
00136 bool m_drawCategoryColors;
00137 bool m_drawCategoryText;
00138
00139 QMap<QString, QColor> categoryColors;
00140
00141 int m_rowCount;
00142 int m_progPastCol;
00143 };
00144
00145 #endif