123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268 |
- #ifndef _TABSHEET_H
- #define _TABSHEET_H
- #include <api/skin/widgets/grouptgbutton.h>
- #include <api/wnd/wndclass/buttwnd.h>
- #include <bfc/common.h>
- #include <api/wnd/wndclass/guiobjwnd.h>
- #include <bfc/ptrlist.h>
- class ButtonWnd;
- class SkinBitmap;
- class TabButtonBase;
- class ButtBar;
- class TabSheetBar;
- #define TABSHEET_GROUPS -2
- #define TABSHEET_NOTABS -3
- #define TABSHEET_PARENT GuiObjectWnd
- class TabSheet : public TABSHEET_PARENT
- {
- public:
-
- TabSheet(int bbtype=-1);
-
-
- virtual ~TabSheet();
-
- virtual int onInit();
-
-
- virtual void getClientRect(RECT *);
-
-
- virtual int onPaint(Canvas *canvas);
-
- virtual int onResize();
-
-
- void setButtonType(int type);
-
- void setTabRowMargin(int pixels);
-
-
- int addChild(BaseWnd *newchild, const wchar_t *tooltip=NULL);
-
-
- virtual void activateChild(BaseWnd *activechild);
-
-
- virtual void killChildren();
-
- virtual int childNotify(ifc_window *child, int msg,
- intptr_t param1=0, intptr_t param2=0);
- void setContentMarginLeft(int cm);
- void setContentMarginTop(int cm);
- void setContentMarginRight(int cm);
- void setContentMarginBottom(int cm);
-
-
- BaseWnd *enumChild(int child);
-
-
- int getNumChild();
- BaseWnd *getActiveChild() { return active; }
- virtual void onSetPage(int n) { lastpage = n; }
- int getCurPage() { return lastpage; }
- void setCurPage(int page);
- int getNumPages() { return tabs.getNumItems(); }
- void nextPage() { int n = getCurPage()+1; if (n >= getNumPages()) n = 0; setCurPage(n); }
- void previousPage() { int n = getCurPage()-1; if (n < 0) n = getNumPages()-1; setCurPage(n); }
- int onAction(const wchar_t *action, const wchar_t *param, int x, int y, intptr_t p1, intptr_t p2, void *data, size_t datalen, ifc_window *source);
- protected:
-
- TabButtonBase *enumButton(int button);
- public:
-
- #ifdef WASABI_COMPILE_IMGLDR
- void setBackgroundBmp(const wchar_t *name);
- #endif
- SkinBitmap *getBackgroundBitmap();
- protected:
-
- ButtonWnd *leftscroll, *rightscroll;
- SkinBitmap *background;
- private:
- int tabrowheight, tabrowwidth, tabrowmargin;
- PtrList<TabButtonBase> tabs;
- ButtBar *bb;
- TabSheetBar *tsb;
- GuiObjectWnd *contentwnd;
- int tilex, tilew;
- BaseWnd *active;
- int type;
- int content_margin_left, content_margin_top, content_margin_right, content_margin_bottom;
- int lastpage;
- };
- class TabButtonBase
- {
- public:
- TabButtonBase(BaseWnd *linkWnd, TabSheet *par, const wchar_t *tip=NULL);
- virtual ~TabButtonBase();
- BaseWnd *getBaseWnd() const { return linked; }
- void setNoDeleteLinked(int i) { nodeletelinked = i; }
- virtual void btn_setHilite(int tf)=0;
- virtual void btn_setText(const wchar_t *txt)=0;
- protected:
- BaseWnd *linked;
- TabSheet *parent;
- int nodeletelinked;
- };
- #define TABBUTTON_PARENT ButtonWnd
- class TabButton : public TABBUTTON_PARENT, public TabButtonBase {
- public:
-
- TabButton(BaseWnd *linkWnd, TabSheet *par, const wchar_t *tip=NULL) : TabButtonBase(linkWnd, par, tip)
- {
- if (tip != NULL)
- setTip(tip);
- }
-
-
- virtual int onInit();
-
-
- virtual void onLeftPush(int x, int y);
- virtual void btn_setHilite(int tf);
- virtual void btn_setText(const wchar_t *text);
- };
- #define GROUPTABBUTTON_PARENT GroupToggleButton
- class GroupTabButton : public GROUPTABBUTTON_PARENT, public TabButtonBase {
- public:
- GroupTabButton(BaseWnd *linkWnd, TabSheet *par, const wchar_t *tip=NULL) : TabButtonBase(linkWnd, par, tip)
- {
- setGroups(L"wasabi.tabsheet.button.selected.group", L"wasabi.tabsheet.button.unselected.group");
- }
- virtual int wantFullClick() { return 0; }
- virtual int wantAutoToggle() { return 0; }
- virtual int onInit();
- virtual void grouptoggle_onLeftPush();
- virtual void btn_setHilite(int tf);
- virtual void btn_setText(const wchar_t *text);
- };
- #endif
|