summaryrefslogtreecommitdiff
path: root/client/collapser.h
diff options
context:
space:
mode:
authordeva <deva>2011-03-04 08:10:30 +0000
committerdeva <deva>2011-03-04 08:10:30 +0000
commitd8a34adcc1a69a2b77881a6e504d0f0ad896eb3a (patch)
tree0fb2ddc53c77e3aec664daf9707c1860fd4eeb29 /client/collapser.h
parent1bda89969eaf0f8dc07ec831c94aa23fbee985a2 (diff)
Simplify Collapser (animateToWidget instead of collapse/expand).
Diffstat (limited to 'client/collapser.h')
-rw-r--r--client/collapser.h52
1 files changed, 20 insertions, 32 deletions
diff --git a/client/collapser.h b/client/collapser.h
index 27d0810..8eea84a 100644
--- a/client/collapser.h
+++ b/client/collapser.h
@@ -37,33 +37,20 @@
class Collapser : public QWidget {
Q_OBJECT
public:
- Collapser(QWidget *collapsed = NULL, QWidget *expanded = NULL,
- bool setcollapsed = true, QScrollArea *scrollarea = NULL);
+ Collapser(QWidget *current = NULL, QScrollArea *scrollarea = NULL);
- bool isCollapsed();
- void setCollapsed(bool setcollapsed);
-
- void setWidgets(QWidget *collapsed, QWidget *expanded);
+ void updateHeight();
- QWidget *collapsedWidget();
- QWidget *expandedWidget();
+ void animateToWidget(QWidget *widget, bool scroll_to_view = false);
- void setCollapsedWidget(QWidget *collapsed);
- void setExpandedWidget(QWidget *expanded);
-
- void updateHeight();
+ QWidget *currentWidget();
public slots:
- void collapse();
- void expand();
- void toggleCollapse();
void anim();
signals:
- void collapsing();
- void expanding();
- void doneCollapsing();
- void doneExpanding();
+ void animating(QWidget *);
+ void doneAnimating(QWidget *);
protected:
// void timerEvent(QTimerEvent *);
@@ -71,34 +58,35 @@ protected:
private:
class Placeholder : public QWidget {
public:
- QPixmap pixmap_from;
- QPixmap pixmap_to;
-
- void grab_from(QWidget *w);
- void grab_to(QWidget *w);
+ void grabFrom(QWidget *w);
+ void grabTo(QWidget *w);
void setWeight(double weight);
+ int toHeight();
+ int fromHeight();
+
protected:
void paintEvent(QPaintEvent*);
private:
+ QPixmap pixmap_from;
+ QPixmap pixmap_to;
+
+ int to_height;
+ int from_height;
double weight;
};
Placeholder placeholder;
+ QWidget *current_widget;
- QWidget *collapsed;
- QWidget *expanded;
-
- QScrollArea *scrollarea;
-
- bool is_collapsed;
-
+ bool scroll_to_view;
+ QTimer *timer;
QTime t_anim;
int timer_id;
- QTimer *timer;
+ QScrollArea *scrollarea;
};
#endif/*__PRACRO_COLLAPSER_H__*/