X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Ftable.cpp;h=085a44237f979bbe9013534c9c160881d75b14eb;hb=ae991f3bbd83fa0afff5e1fc31be50e1f2d17875;hp=7f0ae796f9c7077599990ee1fd563fe64bec0b29;hpb=75a16eae9eb2714f8112d46fa5b8f7908b6d2487;p=libs%2Fgltk.git diff --git a/source/table.cpp b/source/table.cpp index 7f0ae79..085a442 100644 --- a/source/table.cpp +++ b/source/table.cpp @@ -23,13 +23,13 @@ Table::Table(const Resources &r): data(1), col_w(1) { - focusable=false; + focusable = false; update_style(); } void Table::set_rows(unsigned r) { - rows=r; + rows = r; data.resize(rows*columns); } @@ -40,7 +40,7 @@ void Table::set_columns(unsigned c) for(unsigned j=0; j=columns) throw InvalidParameterValue("Column index out of bounds"); - col_w[c]=w; + col_w[c] = w; } void Table::set_cell_text(unsigned r, unsigned c, const string &t) @@ -57,40 +57,40 @@ void Table::set_cell_text(unsigned r, unsigned c, const string &t) if(r>=rows || c>=columns) throw InvalidParameterValue("Cell coordinates out of bounds"); - data[r*columns+c]=t; + data[r*columns+c] = t; } void Table::render_special(const Part &part) const { if(part.get_name()=="cells") { - const GL::Font *const font=style->get_font(); - const float font_size=font->get_default_size(); + const GL::Font *const font = style->get_font(); + const float font_size = font->get_default_size(); - unsigned free_width=geom.w; + unsigned free_width = geom.w; for(unsigned i=0; i(font->get_string_width(text)*font_size); - rgeom.h=static_cast((font->get_ascent()-font->get_descent())*font_size); + rgeom.x = cgeom.x; + rgeom.y = cgeom.y; + rgeom.w = static_cast(font->get_string_width(text)*font_size); + rgeom.h = static_cast((font->get_ascent()-font->get_descent())*font_size); part.get_alignment().apply(rgeom, cgeom, part.get_margin()); @@ -100,10 +100,10 @@ void Table::render_special(const Part &part) const font->draw_string(text); GL::pop_matrix(); - cgeom.x+=cgeom.w; + cgeom.x += cgeom.w; } - cgeom.y-=cgeom.h; + cgeom.y -= cgeom.h; } } }