Permalink
Browse files

widget: Convert the intelmap stuff from W_TABFORMs to ListTabWidgets.

  • Loading branch information...
1 parent 43b62d5 commit 685e77c88499aafba6aaccbf7aa92cd48a3ca7d9 @Cyp Cyp committed Mar 12, 2013
Showing with 65 additions and 205 deletions.
  1. +18 −2 lib/widget/listwidget.cpp
  2. +5 −0 lib/widget/listwidget.h
  3. +0 −11 src/hci.cpp
  4. +0 −7 src/hci.h
  5. +0 −18 src/intdisplay.cpp
  6. +0 −1 src/intdisplay.h
  7. +42 −155 src/intelmap.cpp
  8. +0 −8 src/intimage.cpp
  9. +0 −3 src/intimage.h
View
@@ -245,6 +245,7 @@ ListTabWidget::ListTabWidget(WIDGET *parent)
: WIDGET(parent)
, tabs(new TabSelectionWidget(this))
, widgets(new ListWidget(this))
+ , tabPos(Top)
{
connect(tabs, SIGNAL(tabChanged(int)), widgets, SLOT(setCurrentPage(int)));
connect(widgets, SIGNAL(currentPageChanged(int)), tabs, SLOT(setTab(int)));
@@ -254,8 +255,17 @@ ListTabWidget::ListTabWidget(WIDGET *parent)
void ListTabWidget::geometryChanged()
{
- tabs->setGeometry(0, 0, width(), tabs->height());
- widgets->setGeometry(0, tabs->height(), width(), height() - tabs->height());
+ switch (tabPos)
+ {
+ case Top:
+ tabs->setGeometry(0, 0, width(), tabs->height());
+ widgets->setGeometry(0, tabs->height(), width(), height() - tabs->height());
+ break;
+ case Bottom:
+ tabs->setGeometry(0, height() - tabs->height(), width(), tabs->height());
+ widgets->setGeometry(0, 0, width(), height() - tabs->height());
+ break;
+ }
}
void ListTabWidget::addWidgetToLayout(WIDGET *widget)
@@ -267,3 +277,9 @@ void ListTabWidget::addWidgetToLayout(WIDGET *widget)
}
widgets->addWidgetToLayout(widget);
}
+
+void ListTabWidget::setTabPosition(TabPosition pos)
+{
+ tabPos = pos;
+ geometryChanged();
+}
View
@@ -122,6 +122,8 @@ class ListTabWidget : public WIDGET
Q_OBJECT
public:
+ enum TabPosition {Top, Bottom};
+
ListTabWidget(WIDGET *parent);
virtual void geometryChanged();
@@ -134,12 +136,15 @@ class ListTabWidget : public WIDGET
int currentPage() const { return widgets->currentPage(); }
int pages() const { return widgets->pages(); }
+ void setTabPosition(TabPosition pos);
+
TabSelectionWidget *tabWidget() { return tabs; }
ListWidget *listWidget() { return widgets; }
private:
TabSelectionWidget *tabs;
ListWidget *widgets;
+ TabPosition tabPos;
};
#endif //THISISALISTWIDGET_H
View
@@ -2679,17 +2679,6 @@ void intAlliedResearchChanged()
}
}
-/* Do the annoying calculation for how many forms are needed
- * given the total number of buttons and the number of
- * buttons per page.
- * A simple div just doesn't quite do it....
- */
-UWORD numForms(UDWORD total, UDWORD perForm)
-{
- return std::max((total + perForm - 1) / perForm, 1u);
-}
-
-
/* Add the reticule widgets to the widget screen */
bool intAddReticule()
{
View
@@ -138,11 +138,6 @@
#define POW_Y (OBJ_BACKY + OBJ_BACKHEIGHT + 6)
#define POW_BARWIDTH 308
-//tab details
-#define OBJ_TABWIDTH 26
-#define OBJ_TABHEIGHT 11
-#define OBJ_TABOFFSET 2
-
/* close button data */
#define CLOSE_WIDTH 15
#define CLOSE_HEIGHT 15
@@ -311,8 +306,6 @@ extern bool intBuildMode(void);
// add the construction interface if a constructor droid is selected
void intCommanderSelected(DROID *psDroid);
-extern UWORD numForms(UDWORD total, UDWORD perForm);
-
//sets up the Intelligence Screen as far as the interface is concerned
extern void addIntelScreen(void);
View
@@ -1437,24 +1437,6 @@ void intDisplayReticuleButton(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset)
psWidget->UserData = PACKDWORD_QUAD(flashTime, flashing, DownTime, Index);
}
-
-void intDisplayTab(WIDGET *psWidget, UDWORD Position,
- UDWORD Number, bool Selected, bool Hilight, UDWORD x, UDWORD y, UDWORD Width, UDWORD Height)
-{
- TABDEF *Tab = (TABDEF *)psWidget->pUserData;
-
- iV_DrawImage(IntImages, (UWORD)Tab->MajorUp, x, y);
-
- if (Hilight)
- {
- iV_DrawImage(IntImages, (UWORD)Tab->MajorHilight, x, y);
- }
- else if (Selected)
- {
- iV_DrawImage(IntImages, (UWORD)Tab->MajorSelected, x, y);
- }
-}
-
// Display one of three images depending on if the widget is currently depressed (ah!).
//
void intDisplayButtonPressed(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset)
View
@@ -181,7 +181,6 @@ void intDisplayButtonPressed(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset);
void intDisplayReticuleButton(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset);
-void intDisplayTab(WIDGET *psWidget, UDWORD Position, UDWORD Number, bool Selected, bool Hilight, UDWORD x, UDWORD y, UDWORD Width, UDWORD Height);
void intDisplaySlider(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset);
void intDisplayNumber(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset);
Oops, something went wrong.

0 comments on commit 685e77c

Please sign in to comment.