nux-1.14.0
PropertyList.cpp
00001 /*
00002  * Copyright 2010 Inalogic® Inc.
00003  *
00004  * This program is free software: you can redistribute it and/or modify it
00005  * under the terms of the GNU Lesser General Public License, as
00006  * published by the  Free Software Foundation; either version 2.1 or 3.0
00007  * of the License.
00008  *
00009  * This program is distributed in the hope that it will be useful, but
00010  * WITHOUT ANY WARRANTY; without even the implied warranties of
00011  * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
00012  * PURPOSE.  See the applicable version of the GNU Lesser General Public
00013  * License for more details.
00014  *
00015  * You should have received a copy of both the GNU Lesser General Public
00016  * License along with this program. If not, see <http://www.gnu.org/licenses/>
00017  *
00018  * Authored by: Jay Taoko <jaytaoko@inalogic.com>
00019  *
00020  */
00021 
00022 
00023 #include "Nux.h"
00024 #include "ActionItem.h"
00025 #include "TableCtrl.h"
00026 #include "TableItem.h"
00027 #include "DoubleValidator.h"
00028 #include "PropertyList.h"
00029 
00030 namespace nux
00031 {
00032 
00033   const int PROPERTY_BORDER_X = 2;
00034   const int PROPERTY_BORDER_Y = 2;
00035 
00036   SectionProperty::SectionProperty (const TCHAR *name, NodeParameterType type)
00037     :   TableItem (name, type)
00038   {
00039     Open();
00040     SetItemTextColor (GPropertyItemTextColor0);
00041   }
00042 
00043   SectionProperty::~SectionProperty()
00044   {
00045   }
00046 
00047 //long SectionProperty::ProcessPropertyEvent(IEvent &ievent, long TraverseInfo, long ProcessEventInfo)
00048 //{
00049 //    long ret = TraverseInfo;
00050 //
00051 //    return ret;
00052 //}
00053 
00054   void SectionProperty::DrawProperty (GraphicsEngine &GfxContext, TableCtrl *table, bool force_draw, Geometry geo, const BasePainter &Painter,
00055                                       RowHeader *row, const std::vector<ColumnHeader>& column_vector, Color ItemBackgroundColor)
00056   {
00057     Geometry FirstColumnGeometry = m_ItemGeometryVector[0];
00058 
00059     if (isDirtyItem() )
00060     {
00061       t_u32 nBackground;
00062 
00063       if (m_bIsMouseInside)
00064       {
00065         nBackground = table->PushItemBackground (GfxContext, this, true);
00066       }
00067       else
00068       {
00069         nBackground = table->PushItemBackground (GfxContext, this, false);
00070       }
00071 
00072       Painter.PaintTextLineStatic (GfxContext, GetSysFont(), geo, row->_table_item->GetName(), GetItemTextColor());
00073 
00074       if (m_ItemGeometryVector.size() >= 2)
00075       {
00076         Geometry prop_geo = m_ItemGeometryVector[1];
00077         prop_geo.Expand (-PROPERTY_BORDER_X, -PROPERTY_BORDER_Y);
00078         GfxContext.PushClippingRectangle (prop_geo);
00079         Painter.PaintTextLineStatic (GfxContext, GetSysFont(), prop_geo, m_String.GetTCharPtr(), GetItemTextColor());
00080         GfxContext.PopClippingRectangle();
00081       }
00082 
00083       table->PopItemBackground (GfxContext, nBackground);
00084     }
00085   }
00086 
00087   void SectionProperty::ComputePropertyLayout (int x, int y, RowHeader *row, const std::vector<ColumnHeader>& column_vector)
00088   {
00089 
00090   }
00091 
00092   int SectionProperty::GetItemBestHeight()
00093   {
00094     return ITEMDEFAULTHEIGHT;
00095   }
00096 
00097 
00098 }
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends