|
Rapicorn - Experimental UI Toolkit - Source Code 10.08.1
|
00001 /* Rapicorn 00002 * Copyright (C) 2005 Tim Janik 00003 * 00004 * This library is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Lesser General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 2.1 of the License, or (at your option) any later version. 00008 * 00009 * This library is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Lesser General Public License for more details. 00013 * 00014 * A copy of the GNU Lesser General Public License should ship along 00015 * with this library; if not, see http://www.gnu.org/copyleft/. 00016 */ 00017 #ifndef __RAPICORN_TABLE_IMPL_HH__ 00018 #define __RAPICORN_TABLE_IMPL_HH__ 00019 00020 #include <ui/table.hh> 00021 #include <ui/container.hh> 00022 #include <string.h> 00023 00024 namespace Rapicorn { 00025 00026 class TableImpl : public virtual MultiContainerImpl, public virtual Table { 00027 struct RowCol { 00028 uint requisition; 00029 uint allocation; 00030 uint16 spacing; 00031 uint need_expand : 1; 00032 uint need_shrink : 1; 00033 uint expand : 1; 00034 uint shrink : 1; 00035 uint empty : 1; 00036 explicit RowCol() { memset (this, 0, sizeof (*this)); } 00037 static bool lesser_allocation (const TableImpl::RowCol *const &v1, 00038 const TableImpl::RowCol *const &v2); 00039 }; 00040 vector<RowCol> rows, cols; 00041 uint16 default_row_spacing; 00042 uint16 default_col_spacing; 00043 uint homogeneous_items : 1; 00044 void size_request_init (); 00045 void size_request_pass1 (); 00046 void size_request_pass2 (); 00047 void size_request_pass3 (); 00048 void size_allocate_init (); 00049 void size_allocate_pass1 (); 00050 void size_allocate_pass2 (); 00051 void resize_table (uint n_cols, uint n_rows); 00052 protected: 00053 virtual ~TableImpl (); 00054 virtual void size_request (Requisition &requisition); 00055 virtual void size_allocate (Allocation area); 00056 virtual void repack_child (ItemImpl &item, 00057 const PackInfo &orig, 00058 const PackInfo &pnew); 00059 public: 00060 explicit TableImpl (); 00061 virtual void resize (uint n_cols, uint n_rows) { resize (n_cols, n_rows); } 00062 virtual uint get_n_rows () { return rows.size(); } 00063 virtual uint get_n_cols () { return cols.size(); } 00064 virtual bool is_row_used (uint row); 00065 virtual bool is_col_used (uint col); 00066 virtual void insert_rows (uint first_row, uint n_rows); 00067 virtual void insert_cols (uint first_col, uint n_cols); 00068 virtual bool homogeneous () const { return homogeneous_items; } 00069 virtual void homogeneous (bool chomogeneous_items) { homogeneous_items = chomogeneous_items; invalidate(); } 00070 virtual uint col_spacing () { return default_col_spacing; } 00071 virtual void col_spacing (uint cspacing); 00072 virtual uint row_spacing () { return default_row_spacing; } 00073 virtual void row_spacing (uint rspacing); 00074 }; 00075 00076 } // Rapicorn 00077 00078 #endif /* __RAPICORN_TABLE_IMPL_HH__ */
1.7.4