changeset 2924:248e32f744f0

C++: Attempt to get dwtestoo working with old pre-lambda compilers. Fixed a number of errors regarding this from the last commit, however... GCC 4.2 errors out complaining about forward declaration of class Pixmap. This forward definition is necessary to define some classes that reference each other. The issue seems to be these old GCC implmentations expect... that these classes be defined in different files. Since I forward declare Pixmap before defining Render which uses it, then when I go to define Pixmap, it is already forward declared and gives errors. This code is legit, but the compiler implementation is erroring out.... Not sure how to fix this right now without defining them in separate files.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Thu, 29 Dec 2022 23:20:12 +0000
parents 969cc3b8bec2
children 32bd25b05918
files dw.hpp dwtestoo.cpp
diffstat 2 files changed, 16 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/dw.hpp	Thu Dec 29 21:56:58 2022 +0000
+++ b/dw.hpp	Thu Dec 29 23:20:12 2022 +0000
@@ -1212,7 +1212,10 @@
     }
 protected:
     void Setup() {
+#ifdef DW_LAMBDA
         _ConnectValueChanged = 0;
+#endif
+        _ConnectValueChangedOld = 0;
         if(IsOverridden(Ranged::OnValueChanged, this)) {
             dw_signal_connect(hwnd, DW_SIGNAL_VALUE_CHANGED, DW_SIGNAL_FUNC(_OnValueChanged), this);
             ValueChangedConnected = true;
@@ -1332,7 +1335,10 @@
     }
 protected:
     void Setup() {
+#ifdef DW_LAMBDA
         _ConnectSwitchPage = 0;
+#endif
+        _ConnectSwitchPageOld = 0;
         if(IsOverridden(Notebook::OnSwitchPage, this)) {
             dw_signal_connect(hwnd, DW_SIGNAL_SWITCH_PAGE, DW_SIGNAL_FUNC(_OnSwitchPage), this);
             SwitchPageConnected = true;
@@ -1821,7 +1827,14 @@
     }
 public:
     // Constructors
-    Timer(int interval) { _ConnectTimer = 0; timer = dw_timer_connect(interval, DW_SIGNAL_FUNC(_OnTimer), this); SetHandle(reinterpret_cast<void *>(timer)); }
+    Timer(int interval) {
+#ifdef DW_LAMBDA
+        _ConnectTimer = 0;
+#endif
+        _ConnectTimerOld = 0;
+        timer = dw_timer_connect(interval, DW_SIGNAL_FUNC(_OnTimer), this);
+        SetHandle(reinterpret_cast<void *>(timer));
+    }
 #ifdef DW_LAMBDA
     Timer(int interval, std::function<int()> userfunc) {
         _ConnectTimer = userfunc;
--- a/dwtestoo.cpp	Thu Dec 29 21:56:58 2022 +0000
+++ b/dwtestoo.cpp	Thu Dec 29 23:20:12 2022 +0000
@@ -56,14 +56,14 @@
      }
 };
 
-int button_clicked(Clickable *classptr)
+int button_clicked(DW::Clickable *classptr)
 {
     DW::App *app = DW::App::Init();
     app->MessageBox("Button", DW_MB_OK | DW_MB_INFORMATION, "Clicked!"); 
     return TRUE; 
 }
 
-int exit_handler(Clickable *classptr)
+int exit_handler(DW::Clickable *classptr)
 {
     DW::App *app = DW::App::Init();
     if(app->MessageBox(APP_TITLE, DW_MB_YESNO | DW_MB_QUESTION, APP_EXIT) != 0) {