nux-1.14.0
|
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 "PropertyList.h" 00025 00026 #include "ComboBoxComplex.h" 00027 #include "ComboBoxListPropertyItem.h" 00028 00029 namespace nux 00030 { 00031 00032 ComboBoxListPropertyItem::ComboBoxListPropertyItem (const TCHAR *name) 00033 : SectionProperty (name, NODE_TYPE_COMBOCOMPLEX) 00034 { 00035 // SetRange(0.0f, 1.0f); 00036 // SetValue(0.0f); 00037 AddItem (new TableItem ("True") ); 00038 AddItem (new TableItem ("False") ); 00039 AddItem (new TableItem ("Test") ); 00040 } 00041 00042 ComboBoxListPropertyItem::~ComboBoxListPropertyItem() 00043 { 00044 00045 } 00046 00047 long ComboBoxListPropertyItem::ProcessPropertyEvent (IEvent &ievent, long TraverseInfo, long ProcessEventInfo) 00048 { 00049 long ret = TraverseInfo; 00050 00051 ret = ProcessEvent (ievent, TraverseInfo, ProcessEventInfo); 00052 return ret; 00053 } 00054 00055 void ComboBoxListPropertyItem::DrawProperty (GraphicsEngine &GfxContext, TableCtrl *table, bool force_draw, Geometry geo, const BasePainter &Painter, 00056 RowHeader *row, const std::vector<ColumnHeader>& column_vector, Color ItemBackgroundColor) 00057 { 00058 Geometry geo2 = m_FirstColumnUsableGeometry; 00059 00060 if (isDirtyItem() || IsRedrawNeeded() ) 00061 { 00062 t_u32 nBackground = table->PushItemBackground (GfxContext, this); 00063 Painter.PaintTextLineStatic (GfxContext, GetFont (), m_FirstColumnUsableGeometry, row->_table_item->GetName(), GetItemTextColor() ); 00064 00065 if (m_ItemGeometryVector.size() >= 2) 00066 { 00067 Geometry geo2 = m_ItemGeometryVector[1]; 00068 Geometry prop_geo; 00069 prop_geo.SetX (geo.x + geo.GetWidth() ); 00070 prop_geo.SetY (geo.y); 00071 prop_geo.SetWidth (column_vector[1].m_header_area->GetBaseWidth() ); 00072 prop_geo.SetHeight (geo.GetHeight() ); 00073 00074 geo2.Expand (-PROPERTY_BORDER_X, -PROPERTY_BORDER_Y); 00075 GfxContext.PushClippingRectangle (geo2); 00076 GfxContext.PushClippingRectangle (prop_geo); 00077 ProcessDraw (GfxContext, true); 00078 GfxContext.PopClippingRectangle(); 00079 GfxContext.PopClippingRectangle(); 00080 } 00081 00082 table->PopItemBackground (GfxContext, nBackground); 00083 } 00084 } 00085 00086 void ComboBoxListPropertyItem::ComputePropertyLayout (int x, int y, RowHeader *row, const std::vector<ColumnHeader>& column_vector) 00087 { 00088 if (m_ItemGeometryVector.size() >= 2) 00089 { 00090 Geometry geo; 00091 geo = m_ItemGeometryVector[1]; 00092 geo = geo.GetExpand (-PROPERTY_BORDER_X, -PROPERTY_BORDER_Y); 00093 SetGeometry (geo); 00094 } 00095 } 00096 00097 int ComboBoxListPropertyItem::GetItemBestHeight() 00098 { 00099 Size sz = GetMinimumSize(); 00100 return sz.height + 2 * PROPERTY_BORDER_Y; 00101 } 00102 }