Mercurial > dwindows
comparison dw.hpp @ 2929:2ab97b349958
C++: Add Page 3 - Tree to dwtestoo.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Fri, 30 Dec 2022 09:35:00 +0000 |
parents | 102b96d77f89 |
children | d8117d36ed27 |
comparison
equal
deleted
inserted
replaced
2928:102b96d77f89 | 2929:2ab97b349958 |
---|---|
151 #endif | 151 #endif |
152 if(classptr->_ConnectClickedOld) | 152 if(classptr->_ConnectClickedOld) |
153 return classptr->_ConnectClickedOld(classptr); | 153 return classptr->_ConnectClickedOld(classptr); |
154 return classptr->OnClicked(); } | 154 return classptr->OnClicked(); } |
155 protected: | 155 protected: |
156 virtual ~Clickable() {} | |
156 void Setup() { | 157 void Setup() { |
157 #ifdef DW_LAMBDA | 158 #ifdef DW_LAMBDA |
158 _ConnectClicked = 0; | 159 _ConnectClicked = 0; |
159 #endif | 160 #endif |
160 _ConnectClickedOld = 0; | 161 _ConnectClickedOld = 0; |
583 | 584 |
584 // Abstract class that defines drawing, either to screen or picture (pixmap) | 585 // Abstract class that defines drawing, either to screen or picture (pixmap) |
585 class Drawable | 586 class Drawable |
586 { | 587 { |
587 public: | 588 public: |
589 virtual ~Drawable() { } | |
588 virtual void DrawPoint(int x, int y) = 0; | 590 virtual void DrawPoint(int x, int y) = 0; |
589 virtual void DrawLine(int x1, int y1, int x2, int y2) = 0; | 591 virtual void DrawLine(int x1, int y1, int x2, int y2) = 0; |
590 virtual void DrawPolygon(int flags, int npoints, int x[], int y[]) = 0; | 592 virtual void DrawPolygon(int flags, int npoints, int x[], int y[]) = 0; |
591 virtual void DrawRect(int fill, int x, int y, int width, int height) = 0; | 593 virtual void DrawRect(int fill, int x, int y, int width, int height) = 0; |
592 virtual void DrawArc(int flags, int xorigin, int yorigin, int x1, int y1, int x2, int y2) = 0; | 594 virtual void DrawArc(int flags, int xorigin, int yorigin, int x1, int y1, int x2, int y2) = 0; |
593 virtual void DrawText(int x, int y, const char *text) = 0; | 595 virtual void DrawText(int x, int y, const char *text) = 0; |
594 virtual int BitBltStretch(int xdest, int ydest, int width, int height, Render *src, int xsrc, int ysrc, int srcwidth, int srcheight) = 0; | 596 virtual int BitBltStretch(int xdest, int ydest, int width, int height, Render *src, int xsrc, int ysrc, int srcwidth, int srcheight) = 0; |
595 virtual int BitBltStretch(int xdest, int ydest, int width, int height, Pixmap *src, int xsrc, int ysrc, int srcwidth, int srcheight) = 0; | 597 virtual int BitBltStretch(int xdest, int ydest, int width, int height, Pixmap *src, int xsrc, int ysrc, int srcwidth, int srcheight) = 0; |
596 virtual void BitBlt(int xdest, int ydest, int width, int height, Render *src, int xsrc, int ysrc) = 0; | 598 virtual void BitBlt(int xdest, int ydest, int width, int height, Render *src, int xsrc, int ysrc) = 0; |
597 virtual void BitBlt(int xdest, int ydest, int width, int height, Pixmap *srcp, int xsrc, int ysrc) = 0; | 599 virtual void BitBlt(int xdest, int ydest, int width, int height, Pixmap *srcp, int xsrc, int ysrc) = 0; |
598 void SetColor(unsigned long fore, unsigned long back) { dw_color_foreground_set(fore); dw_color_background_set(back); } | 600 void SetColor(unsigned long fore, unsigned long back) { dw_color_foreground_set(fore); dw_color_background_set(back); } |
599 void SetBackgroundColor(unsigned long back) { dw_color_background_set(back); } | 601 void SetBackgroundColor(unsigned long back) { dw_color_background_set(back); } |
600 void SetForegroundColor(unsigned long fore) { dw_color_foreground_set(fore); } | 602 void SetForegroundColor(unsigned long fore) { dw_color_foreground_set(fore); } |
601 }; | 603 }; |
602 | 604 |
603 class Render : public Drawable, public Widget | 605 class Render : public Drawable, public Widget |
604 { | 606 { |
605 private: | 607 private: |
1699 // User functions | 1701 // User functions |
1700 void Clear() { dw_tree_clear(hwnd); } | 1702 void Clear() { dw_tree_clear(hwnd); } |
1701 HTREEITEM GetParent(HTREEITEM item) { return dw_tree_get_parent(hwnd, item); } | 1703 HTREEITEM GetParent(HTREEITEM item) { return dw_tree_get_parent(hwnd, item); } |
1702 char *GetTitle(HTREEITEM item) { return dw_tree_get_title(hwnd, item); } | 1704 char *GetTitle(HTREEITEM item) { return dw_tree_get_title(hwnd, item); } |
1703 HTREEITEM Insert(const char *title, HICN icon, HTREEITEM parent, void *itemdata) { return dw_tree_insert(hwnd, title, icon, parent, itemdata); } | 1705 HTREEITEM Insert(const char *title, HICN icon, HTREEITEM parent, void *itemdata) { return dw_tree_insert(hwnd, title, icon, parent, itemdata); } |
1704 HTREEITEM Insert(const char *title, HTREEITEM item, HICN icon, HTREEITEM parent, void *itemdata) { return dw_tree_insert_after(hwnd, item, title, icon, parent, itemdata); } | 1706 HTREEITEM Insert(const char *title, HICN icon, HTREEITEM parent) { return dw_tree_insert(hwnd, title, icon, parent, NULL); } |
1707 HTREEITEM Insert(const char *title, HICN icon) { return dw_tree_insert(hwnd, title, icon, 0, NULL); } | |
1708 HTREEITEM InsertAfter(const char *title, HTREEITEM item, HICN icon, HTREEITEM parent, void *itemdata) { return dw_tree_insert_after(hwnd, item, title, icon, parent, itemdata); } | |
1709 HTREEITEM InsertAfter(const char *title, HTREEITEM item, HICN icon, HTREEITEM parent) { return dw_tree_insert_after(hwnd, item, title, icon, parent, NULL); } | |
1710 HTREEITEM InsertAfter(const char *title, HTREEITEM item, HICN icon) { return dw_tree_insert_after(hwnd, item, title, icon, 0, NULL); } | |
1705 void Change(HTREEITEM item, const char *title, HICN icon) { dw_tree_item_change(hwnd, item, title, icon); } | 1711 void Change(HTREEITEM item, const char *title, HICN icon) { dw_tree_item_change(hwnd, item, title, icon); } |
1706 void Collapse(HTREEITEM item) { dw_tree_item_collapse(hwnd, item); } | 1712 void Collapse(HTREEITEM item) { dw_tree_item_collapse(hwnd, item); } |
1707 void Delete(HTREEITEM item) { dw_tree_item_delete(hwnd, item); } | 1713 void Delete(HTREEITEM item) { dw_tree_item_delete(hwnd, item); } |
1708 void Expand(HTREEITEM item) { dw_tree_item_expand(hwnd, item); } | 1714 void Expand(HTREEITEM item) { dw_tree_item_expand(hwnd, item); } |
1709 void *GetData(HTREEITEM item) { return dw_tree_item_get_data(hwnd, item); } | 1715 void *GetData(HTREEITEM item) { return dw_tree_item_get_data(hwnd, item); } |