tabber.h 990 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. #ifndef TABBER_H
  2. #define TABBER_H
  3. class Tabber;
  4. class TabberListener{
  5. public:
  6. virtual void currentSet( Tabber *tabber,int index )=0;
  7. };
  8. class Tabber : public CTabCtrl{
  9. public:
  10. Tabber();
  11. ~Tabber();
  12. void setListener( TabberListener *l );
  13. void insert( int index,CWnd *wnd,const string &text );
  14. void remove( int index );
  15. void setCurrent( int index );
  16. void setTabText( int index,const string &t );
  17. int size()const;
  18. int getCurrent()const;
  19. CWnd *getTabWnd( int index )const;
  20. string getTabText( int index )const;
  21. DECLARE_DYNAMIC( Tabber )
  22. DECLARE_MESSAGE_MAP()
  23. afx_msg void OnSize( UINT type,int w,int h );
  24. afx_msg BOOL OnEraseBkgnd( CDC *dc );
  25. afx_msg void tcn_selChange( NMHDR *p,LRESULT *result );
  26. private:
  27. TabberListener *listener;
  28. struct Tab{
  29. CWnd *wnd;
  30. string text;
  31. Tab( CWnd *w,const string &t ):wnd(w),text(t){
  32. }
  33. };
  34. typedef list<Tab*> Tabs;
  35. Tabs tabs;
  36. int curr;
  37. void refresh();
  38. CRect getInnerRect();
  39. Tab *getTab( int index )const;
  40. };
  41. #endif