CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FWColumnLabelCellRenderer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: TableWidget
4 // Class : FWColumnLabelCellRenderer
5 //
6 // Implementation:
7 // <Notes on implementation>
8 //
9 // Original Author: Chris Jones
10 // Created: Mon Feb 2 16:44:04 EST 2009
11 // $Id: FWColumnLabelCellRenderer.cc,v 1.3 2012/02/22 00:15:44 amraktad Exp $
12 //
13 
14 #include <cassert>
15 
16 // system include files
17 #include "TVirtualX.h"
18 #include "TGFont.h"
19 
20 // user include files
22 
23 
24 //
25 // constants, enums and typedefs
26 //
27 
28 //
29 // static data member definitions
30 //
31 
32 //
33 // constructors and destructor
34 //
35 FWColumnLabelCellRenderer::FWColumnLabelCellRenderer(const TGGC* iContext, bool isSortable):
36 FWTextTableCellRenderer(iContext),
37 m_sortOrder(fireworks::table::kNotSorted),
38 m_sizeOfOrderIcon(height()),
39 m_isSortable(isSortable)
40 {
41  if (m_isSortable)
42  {
43  FontMetrics_t metrics;
44  font()->GetFontMetrics(&metrics);
45 
46  m_sizeOfOrderIcon -= 2*metrics.fDescent;
47  m_sizeOfOrderIconStartX = metrics.fDescent;
48  //we want the number to be even so that the point of the triangle
49  // will be right in the middle
50  if(1 == m_sizeOfOrderIcon % 2) {
52  }
53  }
54 }
55 
56 
57 // FWColumnLabelCellRenderer::FWColumnLabelCellRenderer(const FWColumnLabelCellRenderer& rhs)
58 // {
59 // // do actual copying here;
60 // }
61 
63 {
64 }
65 
66 //
67 // assignment operators
68 //
69 // const FWColumnLabelCellRenderer& FWColumnLabelCellRenderer::operator=(const FWColumnLabelCellRenderer& rhs)
70 // {
71 // //An exception safe implementation is
72 // FWColumnLabelCellRenderer temp(rhs);
73 // swap(rhs);
74 //
75 // return *this;
76 // }
77 
78 //
79 // member functions
80 //
82 
83  if (!m_isSortable) assert (iOrder == fireworks::table::kNotSorted);
84 
85  m_sortOrder = iOrder;
86 }
87 
88 void
89 FWColumnLabelCellRenderer::draw(Drawable_t iID, int iX, int iY, unsigned int iWidth, unsigned int iHeight)
90 {
91  if (m_isSortable)
92  {
93  using namespace fireworks::table;
95  const GContext_t c = graphicsContext()->GetGC();
96  int dY = m_sizeOfOrderIconStartX;
97 
99  gVirtualX->DrawLine(iID, c, iX+h/2, iY+2+dY, iX, iY+h-2+dY);
100  gVirtualX->DrawLine(iID, c, iX, iY+h-2+dY, iX+h, iY+h-2+dY);
101  gVirtualX->DrawLine(iID, c, iX+h/2, iY+2+dY, iX+h, iY+h-2+dY);
102  }
104  gVirtualX->DrawLine(iID, c, iX, iY+2+dY, iX+h, iY+2+dY);
105  gVirtualX->DrawLine(iID, c, iX+h/2, iY+h-2+dY, iX+h, iY+2+dY);
106  gVirtualX->DrawLine(iID, c, iX+h/2, iY+h-2+dY, iX, iY+2+dY);
107  }
108  FWTextTableCellRenderer::draw(iID,iX+kGap+h,iY,iWidth-kGap-h,iHeight);
109  }
110  else
111  {
112  return FWTextTableCellRenderer::draw(iID, iX+kGap, iY-kGap, iWidth, iHeight);
113  }
114 
115 }
116 
117 //
118 // const member functions
119 //
121 {
122  return m_sortOrder;
123 }
124 
126 {
127  if (m_isSortable)
129  else {
131  }
132 
133 }
134 
135 //
136 // static member functions
137 //
list table
Definition: asciidump.py:386
FWColumnLabelCellRenderer(const TGGC *iContext=&(getDefaultGC()), bool isSortable=true)
static const std::string kDescendingSort
Definition: FWTableView.cc:202
void setSortOrder(fireworks::table::SortOrder)
const TGFont * font() const
const TGGC * graphicsContext() const
unsigned int UInt_t
Definition: FUTypes.h:12
fireworks::table::SortOrder sortOrder() const
virtual UInt_t width() const
returns the minimum width of the cell to which the renderer is representing
virtual void draw(Drawable_t iID, int iX, int iY, unsigned int iWidth, unsigned int iHeight)
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4
fireworks::table::SortOrder m_sortOrder
virtual UInt_t width() const
returns the minimum width of the cell to which the renderer is representing
virtual void draw(Drawable_t iID, int iX, int iY, unsigned int iWidth, unsigned int iHeight)