changeset 2939:ebbc5b16899e

C++: Another couple fixes, context menus and PackAtIndex that got lost during porting.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 01 Jan 2023 00:23:39 +0000
parents 1184f58135ba
children 60e90b783cb1
files dw.hpp dwtestoo.cpp
diffstat 2 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/dw.hpp	Sat Dec 31 21:42:12 2022 +0000
+++ b/dw.hpp	Sun Jan 01 00:23:39 2023 +0000
@@ -351,6 +351,7 @@
     int Lower() { return dw_window_lower(hwnd); }
     void Redraw() { dw_window_redraw(hwnd); }
     void Default(Widget *defaultitem) { if(defaultitem) dw_window_default(hwnd, defaultitem->GetHWND()); }
+    void ClickDefault(Widget *defaultitem) { if(defaultitem) dw_window_click_default(hwnd, defaultitem->GetHWND()); }
     void SetIcon(HICN icon) { dw_window_set_icon(hwnd, icon); }
     MenuBar *MenuBarNew() { if(!menu) menu = new MenuBar(hwnd); return menu; }
     void Popup(Menu *menu, int x, int y) {
@@ -1437,7 +1438,7 @@
             return classptr->_ConnectItemSelectOld(classptr, item, text, itemdata);
         return classptr->OnItemSelect(item, text, itemdata);
     }
-    static int _OnItemContext(HWND window, char *text, int x, int y, void *itemdata, void *data) {
+    static int _OnItemContext(HWND window, char *text, int x, int y, void *data, void *itemdata) {
         ObjectView *classptr = reinterpret_cast<ObjectView *>(data);
 #ifdef DW_LAMBDA
         if(classptr->_ConnectItemContext)
--- a/dwtestoo.cpp	Sat Dec 31 21:42:12 2022 +0000
+++ b/dwtestoo.cpp	Sun Jan 01 00:23:39 2023 +0000
@@ -351,7 +351,7 @@
     // Request that the render widgets redraw...
     // If not using direct rendering, call UpdateRender() to
     // redraw the in memory pixmaps. Then trigger the expose events.
-    // Expose will call update_render() to draw directly or bitblt the pixmaps.
+    // Expose will call UpdateRender() to draw directly or bitblt the pixmaps.
     void RenderDraw() {
         // If we are double buffered, draw to the pixmaps
         if(render_type != SHAPES_DIRECT)
@@ -704,10 +704,10 @@
 
         cancelbutton->Unpack();
         buttonbox->PackStart(cancelbutton, 130, 30, TRUE, TRUE, 2);
-        //this->ClickDefault(cancelbutton);
+        this->ClickDefault(cancelbutton);
 
         DW::Button *colorchoosebutton = new DW::Button("Color Chooser Dialog");
-        buttonbox->PackStart(colorchoosebutton, 130, 30, TRUE, TRUE, 2);
+        buttonbox->PackAtIndex(colorchoosebutton, 1, 130, 30, TRUE, TRUE, 2);
 
         // Set some nice fonts and colors
         lbbox->SetColor(DW_CLR_DARKCYAN, DW_CLR_PALEGRAY);