diff options
author | Ira Rice <irarice@gmail.com> | 2009-02-03 14:38:40 -0700 |
---|---|---|
committer | Ira Rice <irarice@gmail.com> | 2009-02-03 14:38:40 -0700 |
commit | 8857a59c3818c1ce6eeb6c054cb5543bfc35c087 (patch) | |
tree | 792fca4acae0c9372cf145a4f0b4cb995b1c3c78 /src/gui/skill.cpp | |
parent | 6c5d9cd16b750ae9404407171a5641b5e0ee78b5 (diff) | |
download | mana-8857a59c3818c1ce6eeb6c054cb5543bfc35c087.tar.gz mana-8857a59c3818c1ce6eeb6c054cb5543bfc35c087.tar.bz2 mana-8857a59c3818c1ce6eeb6c054cb5543bfc35c087.tar.xz mana-8857a59c3818c1ce6eeb6c054cb5543bfc35c087.zip |
Fixed up table class to allow for different background colors, as well
as defining whether the given table is opaque or not.
Signed-off-by: Ira Rice <irarice@gmail.com>
Diffstat (limited to 'src/gui/skill.cpp')
-rw-r--r-- | src/gui/skill.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/gui/skill.cpp b/src/gui/skill.cpp index 9d23cc3c..60f8ee65 100644 --- a/src/gui/skill.cpp +++ b/src/gui/skill.cpp @@ -53,7 +53,7 @@ class SkillGuiTableModel : public StaticTableModel { public: SkillGuiTableModel(SkillDialog *dialog) : - StaticTableModel(0, 3, 0xbdb5aa) + StaticTableModel(0, 3) { mEntriesNr = 0; mDialog = dialog; @@ -125,6 +125,7 @@ SkillDialog::SkillDialog(): initSkillinfo(); mTableModel = new SkillGuiTableModel(this); mTable.setModel(mTableModel); + mTable.setOpaque(false); mTable.setLinewiseSelection(true); setWindowName(_("Skills")); @@ -134,14 +135,12 @@ SkillDialog::SkillDialog(): setMinHeight(50 + mTableModel->getHeight()); setMinWidth(200); -// mSkillListBox = new ListBox(this); ScrollArea *skillScrollArea = new ScrollArea(&mTable); mPointsLabel = new gcn::Label(strprintf(_("Skill points: %d"), 0)); mIncButton = new Button(_("Up"), _("inc"), this); mUseButton = new Button(_("Use"), _("use"), this); mUseButton->setEnabled(false); -// mSkillListBox->setActionEventId("skill"); mTable.setActionEventId("skill"); skillScrollArea->setHorizontalScrollPolicy(gcn::ScrollArea::SHOW_NEVER); @@ -155,7 +154,6 @@ SkillDialog::SkillDialog(): Layout &layout = getLayout(); layout.setRowHeight(0, Layout::AUTO_SET); -// mSkillListBox->addActionListener(this); mTable.addActionListener(this); setLocationRelativeTo(getParent()); @@ -171,7 +169,7 @@ void SkillDialog::action(const gcn::ActionEvent &event) if (event.getId() == "inc") { // Increment skill - int selectedSkill = mTable.getSelectedRow();//mSkillListBox->getSelected(); + int selectedSkill = mTable.getSelectedRow(); if (selectedSkill >= 0) player_node->raiseSkill(mSkillList[selectedSkill]->id); } @@ -278,7 +276,8 @@ static void initSkillinfo(void) std::string name = XML::getProperty(node, "name", ""); bool modifiable = !atoi(XML::getProperty(node, "fixed", "0").c_str()); - if (index >= 0) { + if (index >= 0) + { skill_db.resize(index + 1, emptySkillInfo); skill_db[index].name = name; skill_db[index].modifiable = modifiable; |