~ubuntu-branches/ubuntu/precise/nux/precise

« back to all changes in this revision

Viewing changes to Nux/PropertyItem/CheckBoxProperty.cpp

  • Committer: Package Import Robot
  • Author(s): Didier Roche, Aurélien Gâteau
  • Date: 2012-01-13 09:04:48 UTC
  • mfrom: (1.1.34)
  • Revision ID: package-import@ubuntu.com-20120113090448-gtw9g6kfo1sui1f1
Tags: 2.0.0-0ubuntu1
[ Aurélien Gâteau ]
* New upstream release:
  - compiz crashed with SIGSEGV in nux::ROProperty<std::string>::operator
    std::string() (LP: #881106)
  - compiz crashed with SIGSEGV in
    nux::WindowCompositor::FindKeyFocusAreaFrom() (LP: #860852)
  - compiz crashed with SIGSEGV in nux::Area::FindKeyFocusArea()
    (LP: #848952)
  - compiz crashed with SIGILL in typeinfo for std::ostream() (LP: #849881)
  - compiz crashed with SIGSEGV in nux::WindowThread::IsInsideLayoutCycle()
    (LP: #864686)
  - Select quicklist items with just one right click (LP: #688830)
  - OnMouseDoubleClick in InputArea isn't working (LP: #708020)
  - Menubar - horizontal scroll over a menu opens it (LP: #775872)
  - Clicking on a dash category header should not give it keyboard focus
    (LP: #905921)
  - Horizontal scroll on maximize/restore window control restores window.
    (LP: #809717)
  - Horizontally scrolling while highlighting an item in the dash or on an
    indicator will open the item. (LP: #837004)
  - compiz crashed with SIGSEGV in free() (LP: #864446)
  - Mouse wheel doesn't works if the mouse pointer is inside dash scrollbar.
    (LP: #888819)
* debian/rules, debian/control:
  - add nuxabiversion capability as upstream is breaking a lot the ABI
    wasn't bumping the soname. Create a virtual package similar to what
    we already do in compiz to ensure we dep on the right version.
    Remove the makeshlibs override then as not needed anymore.
  - bump to nux 2.0 with new libnux-2.0-0, libnux-2.0-common, libnux-2.0-dev
    packages. Make the necessary changes in .install files as well
  - don't ship anymore the -doc package.
* debian/nux-tools.install:
  - move the apport file there instead of the -common package to enable
    co-instability

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 * Copyright 2010 Inalogic® Inc.
3
 
 *
4
 
 * This program is free software: you can redistribute it and/or modify it
5
 
 * under the terms of the GNU Lesser General Public License, as
6
 
 * published by the  Free Software Foundation; either version 2.1 or 3.0
7
 
 * of the License.
8
 
 *
9
 
 * This program is distributed in the hope that it will be useful, but
10
 
 * WITHOUT ANY WARRANTY; without even the implied warranties of
11
 
 * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
12
 
 * PURPOSE.  See the applicable version of the GNU Lesser General Public
13
 
 * License for more details.
14
 
 *
15
 
 * You should have received a copy of both the GNU Lesser General Public
16
 
 * License along with this program. If not, see <http://www.gnu.org/licenses/>
17
 
 *
18
 
 * Authored by: Jay Taoko <jaytaoko@inalogic.com>
19
 
 *
20
 
 */
21
 
 
22
 
 
23
 
#include "Nux.h"
24
 
#include "PropertyList.h"
25
 
 
26
 
#include "CheckBox.h"
27
 
#include "CheckBoxProperty.h"
28
 
 
29
 
namespace nux
30
 
{
31
 
 
32
 
  CheckBoxPropertyItem::CheckBoxPropertyItem (std::string label, NUX_FILE_LINE_DECL)
33
 
    :   SectionProperty (label.c_str(), NODE_TYPE_CHECKBOX)
34
 
    ,   CheckBox (label, NUX_FILE_LINE_PARAM)
35
 
  {
36
 
    //FIXME - needs updating to the latest Button codebase
37
 
    //SetState (on);
38
 
    SetUsingStyleDrawing (false);
39
 
    //FIXME needs to be updated to the latest button codebase
40
 
    //NODE_SIG_CONNECT (sigStateToggled, CheckBoxPropertyItem, RecvPropertyChange);
41
 
  }
42
 
 
43
 
  CheckBoxPropertyItem::~CheckBoxPropertyItem()
44
 
  {
45
 
 
46
 
  }
47
 
 
48
 
  long CheckBoxPropertyItem::ProcessPropertyEvent (IEvent &ievent, long TraverseInfo, long ProcessEventInfo)
49
 
  {
50
 
    long ret = TraverseInfo;
51
 
 
52
 
    ret = ProcessEvent (ievent, TraverseInfo, ProcessEventInfo);
53
 
    return ret;
54
 
  }
55
 
 
56
 
  void CheckBoxPropertyItem::DrawProperty (GraphicsEngine &GfxContext, TableCtrl *table, bool force_draw, Geometry ItemGeo, const BasePainter &Painter,
57
 
      RowHeader *row, const std::vector<ColumnHeader>& column_vector, Color ItemBackgroundColor)
58
 
  {
59
 
    Geometry geo2 = m_FirstColumnUsableGeometry;
60
 
 
61
 
    if (isDirtyItem() || IsRedrawNeeded() )
62
 
    {
63
 
      t_u32 nBackground = table->PushItemBackground (GfxContext, this);
64
 
      Painter.PaintTextLineStatic (GfxContext, GetFont (), m_FirstColumnUsableGeometry, row->_table_item->GetName(), GetItemTextColor() );
65
 
 
66
 
      if (m_ItemGeometryVector.size() >= 2)
67
 
      {
68
 
        Geometry geo2 = m_ItemGeometryVector[1];
69
 
        Geometry prop_geo;
70
 
        prop_geo.SetX (ItemGeo.x + ItemGeo.GetWidth() );
71
 
        prop_geo.SetY (ItemGeo.y);
72
 
        prop_geo.SetWidth (column_vector[1].m_header_area->GetBaseWidth() );
73
 
        prop_geo.SetHeight (ItemGeo.GetHeight() );
74
 
 
75
 
        geo2.Expand (-PROPERTY_BORDER_X, -PROPERTY_BORDER_Y);
76
 
        GfxContext.PushClippingRectangle (geo2);
77
 
        GfxContext.PushClippingRectangle (prop_geo);
78
 
        Painter.Paint2DQuadColor (GfxContext, geo2, ItemBackgroundColor);
79
 
        ProcessDraw (GfxContext, true);
80
 
        GfxContext.PopClippingRectangle();
81
 
        GfxContext.PopClippingRectangle();
82
 
      }
83
 
 
84
 
      table->PopItemBackground (GfxContext, nBackground);
85
 
    }
86
 
  }
87
 
 
88
 
  void CheckBoxPropertyItem::ComputePropertyLayout (int x, int y, RowHeader *row, const std::vector<ColumnHeader>& column_vector)
89
 
  {
90
 
    if (m_ItemGeometryVector.size() >= 2)
91
 
    {
92
 
      Geometry geo;
93
 
      geo = m_ItemGeometryVector[1];
94
 
      geo = geo.GetExpand (-PROPERTY_BORDER_X, -PROPERTY_BORDER_Y);
95
 
      SetGeometry (geo);
96
 
    }
97
 
  }
98
 
 
99
 
  int CheckBoxPropertyItem::GetItemBestHeight()
100
 
  {
101
 
    Size sz = GetMinimumSize();
102
 
    return sz.height + 2 * PROPERTY_BORDER_Y;
103
 
  }
104
 
 
105
 
  CheckBoxPropertyItem *CheckBoxPropertyItem::CreateFromXML (const TiXmlElement *elementxml, NodeNetCom *parent, const char *Name, int id)
106
 
  {
107
 
    int check = 0;
108
 
    QueryNodeXMLIntAttribute (elementxml, "Check",       &check,     id);
109
 
    CheckBoxPropertyItem *node = new CheckBoxPropertyItem (Name);
110
 
    node->active = check ? true : false;
111
 
    node->SetID (id);
112
 
    return node;
113
 
  }
114
 
 
115
 
  TiXmlElement *CheckBoxPropertyItem::ToXML() const
116
 
  {
117
 
    TiXmlElement *elementxml = NodeNetCom::ToXML();
118
 
    //FIXME needs to be updated to the latest button codebase
119
 
    //elementxml->SetAttribute ("Check", GetState() ? 1 : 0);
120
 
    return elementxml;
121
 
  }
122
 
 
123
 
  bool CheckBoxPropertyItem::FromXML (const TiXmlElement *elementxml)
124
 
  {
125
 
    int check;
126
 
 
127
 
    if (QueryNodeXMLIntAttribute (elementxml, "Check", &check, GetID() ) )
128
 
    {
129
 
      //FIXME needs to be updated to the latest button codebase
130
 
      //SetState (check ? true : false);
131
 
      //nuxDebugMsg(TEXT("Updated Node %s - ID: %d - Type: %s"), GetName().c_str(), GetID(), ConvertTypeToString(GetParameterType()));
132
 
      return NodeNetCom::FromXML (elementxml);
133
 
    }
134
 
 
135
 
    return false;
136
 
  }
137
 
 
138
 
}