diff --git a/README.md b/README.md index a4fbc267..23fd22ab 100644 --- a/README.md +++ b/README.md @@ -136,7 +136,10 @@ printf(...) ## Class digramm
-              1┌──────────────┐
+              1┌────────────┐
+   ┌-----------┤ FTermLinux │
+   :           └────────────┘
+   :          1┌──────────────┐
    ┌-----------┤ FTermFreeBSD │
    :           └──────────────┘
    :          1┌──────────────┐
@@ -172,12 +175,15 @@ printf(...)
    :          1┌───────────────┐   │    ┌─────────────┐
    ┌-----------┤ FMouseControl │   ├────┤ FTimerEvent │
    :           └───────────────┘   │    └─────────────┘
-   :          1┌─────────┐         │       ┌──────┐   ┌─────────┐
-   ┌-----------┤ FSystem │         │       │ FLog │◄──┤ FLogger │
-   :           └─────────┘         │       └──┬───┘   └─────────┘
-   :          *┌─────────┐         │          :1
-   :  ┌--------┤ FString │         │       ┌──┴───────────┐
-   :  :        └─────────┘         │  ┌────┤ FApplication │
+   :          1┌─────────┐         │    ┌────────────┐1    1┌───────┐
+   ┌-----------┤ FSystem │         ├────┤ FUserEvent ├------┤ FData │
+   :           └─────────┘         │    └────────────┘      └───────┘
+   :          *┌─────────┐         │       ┌──────┐   ┌─────────┐
+   :  ┌--------┤ FString │         │       │ FLog │◄──┤ FLogger │
+   :  :        └─────────┘         │       └──┬───┘   └─────────┘
+   :  :       *┌───────────────┐   │          :1
+   :  ┌--------┤ FStringStream │   │       ┌──┴───────────┐
+   :  :        └───────────────┘   │  ┌────┤ FApplication │
    :  :       *┌────────┐          │  │    └──────────────┘
    :  ┌--------┤ FPoint │          │  │    ┌────────┐
    :  :        └────────┘          │  ├────┤ FLabel │
@@ -209,15 +215,16 @@ printf(...)
                                       │    ┌───────────┐1    1┌──────────────────┐
                                       ├────┤ FComboBox ├------┤ FDropDownListBox │
                                       │    └───────────┘      └──────────────────┘
- ┌─────────────┐1                     │    ┌──────────┐1     *┌──────────────┐
- │ FTermBuffer ├----------------------├────┤ FListBox ├-------┤ FListBoxItem │
- └─────────────┘                      │    └──────────┘       └──────────────┘
-                                      │   1┌───────────┐1    *┌───────────────┐
-                                      ├────┤ FListView ├------┤ FListViewItem │
-                                      │    └───────────┘      └───────────────┘
-                                      │    ┌─────────────┐
-                                      ├────┤ FScrollView │
-                                      │    └─────────────┘
+ ┌─────────────┐1                     │    ┌──────────┐1     *┌──────────────┐1
+ │ FTermBuffer ├----------------------├────┤ FListBox ├-------┤ FListBoxItem ├--┐
+ └─────────────┘                      │    └──────────┘       └──────────────┘  :
+                                      │   1┌───────────┐1    *┌───────────────┐ :
+                                      ├────┤ FListView ├------┤ FListViewItem │ :
+                                      │    └───────────┘      └────────┬──────┘ :
+                                      │    ┌─────────────┐             :1       :
+                                      ├────┤ FScrollView │         ┌───┴───┐1   :
+                                      │    └─────────────┘         │ FData ├----┘
+                                      │                            └───────┘
                                       │    ┌────────────┐1   *┌────────────┐
                                       │ ┌──┤ FStatusBar ├-----┤ FStatusKey │
                                       │ │  └────────────┘     └────────────┘
diff --git a/doc/class-diagram.txt b/doc/class-diagram.txt
index a34f10e0..4dbf7181 100644
--- a/doc/class-diagram.txt
+++ b/doc/class-diagram.txt
@@ -1,7 +1,10 @@
 ══════════════════════════════════════════════════════════════════════════════
                                  Class digramm
 ══════════════════════════════════════════════════════════════════════════════
-              1┌──────────────┐
+              1┌────────────┐
+   ┌-----------┤ FTermLinux │
+   :           └────────────┘
+   :          1┌──────────────┐
    ┌-----------┤ FTermFreeBSD │
    :           └──────────────┘
    :          1┌──────────────┐
@@ -37,12 +40,15 @@
    :          1┌───────────────┐   │    ┌─────────────┐
    ┌-----------┤ FMouseControl │   ├────┤ FTimerEvent │
    :           └───────────────┘   │    └─────────────┘
-   :          1┌─────────┐         │       ┌──────┐   ┌─────────┐
-   ┌-----------┤ FSystem │         │       │ FLog │◄──┤ FLogger │
-   :           └─────────┘         │       └──┬───┘   └─────────┘
-   :          *┌─────────┐         │          :1
-   :  ┌--------┤ FString │         │       ┌──┴───────────┐
-   :  :        └─────────┘         │  ┌────┤ FApplication │
+   :          1┌─────────┐         │    ┌────────────┐1    1┌───────┐
+   ┌-----------┤ FSystem │         ├────┤ FUserEvent ├------┤ FData │
+   :           └─────────┘         │    └────────────┘      └───────┘
+   :          *┌─────────┐         │       ┌──────┐   ┌─────────┐
+   :  ┌--------┤ FString │         │       │ FLog │◄──┤ FLogger │
+   :  :        └─────────┘         │       └──┬───┘   └─────────┘
+   :  :       *┌───────────────┐   │          :1
+   :  ┌--------┤ FStringStream │   │       ┌──┴───────────┐
+   :  :        └───────────────┘   │  ┌────┤ FApplication │
    :  :       *┌────────┐          │  │    └──────────────┘
    :  ┌--------┤ FPoint │          │  │    ┌────────┐
    :  :        └────────┘          │  ├────┤ FLabel │
@@ -74,15 +80,16 @@
                                       │    ┌───────────┐1    1┌──────────────────┐
                                       ├────┤ FComboBox ├------┤ FDropDownListBox │
                                       │    └───────────┘      └──────────────────┘
- ┌─────────────┐1                     │    ┌──────────┐1     *┌──────────────┐
- │ FTermBuffer ├----------------------├────┤ FListBox ├-------┤ FListBoxItem │
- └─────────────┘                      │    └──────────┘       └──────────────┘
-                                      │   1┌───────────┐1    *┌───────────────┐
-                                      ├────┤ FListView ├------┤ FListViewItem │
-                                      │    └───────────┘      └───────────────┘
-                                      │    ┌─────────────┐
-                                      ├────┤ FScrollView │
-                                      │    └─────────────┘
+ ┌─────────────┐1                     │    ┌──────────┐1     *┌──────────────┐1
+ │ FTermBuffer ├----------------------├────┤ FListBox ├-------┤ FListBoxItem ├--┐
+ └─────────────┘                      │    └──────────┘       └──────────────┘  :
+                                      │   1┌───────────┐1    *┌───────────────┐ :
+                                      ├────┤ FListView ├------┤ FListViewItem │ :
+                                      │    └───────────┘      └────────┬──────┘ :
+                                      │    ┌─────────────┐             :1       :
+                                      ├────┤ FScrollView │         ┌───┴───┐1   :
+                                      │    └─────────────┘         │ FData ├----┘
+                                      │                            └───────┘
                                       │    ┌────────────┐1   *┌────────────┐
                                       │ ┌──┤ FStatusBar ├-----┤ FStatusKey │
                                       │ │  └────────────┘     └────────────┘
diff --git a/examples/calculator.cpp b/examples/calculator.cpp
index 8160f41e..ae3f2b9f 100644
--- a/examples/calculator.cpp
+++ b/examples/calculator.cpp
@@ -213,6 +213,7 @@ class Calc final : public finalcut::FDialog
 
     // Event handlers
     void           onKeyPress (finalcut::FKeyEvent*) override;
+    void           onShow (finalcut::FShowEvent*) override;
     void           onClose (finalcut::FCloseEvent*) override;
 
     // Callback method
@@ -255,7 +256,6 @@ Calc::Calc (FWidget* parent)
 
   mapKeyFunctions();
   clearInfixOperator();
-  std::setlocale(LC_NUMERIC, "C");
 
   for (button key{Sine}; key < Calc::NUM_OF_BUTTONS; key = button(key + 1))
   {
@@ -357,6 +357,13 @@ void Calc::onKeyPress (finalcut::FKeyEvent* ev)
   }
 }
 
+//----------------------------------------------------------------------
+void Calc::onShow (finalcut::FShowEvent*)
+{
+  // Overwrites the initialized value of LC_NUMERIC
+  std::setlocale(LC_NUMERIC, "C");
+}
+
 //----------------------------------------------------------------------
 void Calc::onClose (finalcut::FCloseEvent* ev)
 {
diff --git a/src/fwidget.cpp b/src/fwidget.cpp
index e5442eb9..216423a3 100644
--- a/src/fwidget.cpp
+++ b/src/fwidget.cpp
@@ -102,8 +102,7 @@ FWidget::~FWidget()  // destructor
 {
   processDestroy();
   delCallback();
-  auto app_object = FApplication::getApplicationObject();
-  app_object->removeQueuedEvent(this);
+  removeQueuedEvent();
 
   // unset clicked widget
   if ( this == getClickedWidget() )
@@ -2015,6 +2014,15 @@ void FWidget::destroyColorTheme()
   delete theme;
 }
 
+//----------------------------------------------------------------------
+void FWidget::removeQueuedEvent()
+{
+  auto app_object = FApplication::getApplicationObject();
+
+  if ( app_object )
+    app_object->removeQueuedEvent(this);
+}
+
 //----------------------------------------------------------------------
 void FWidget::setStatusbarText (bool enable) const
 {
diff --git a/src/include/final/fcheckmenuitem.h b/src/include/final/fcheckmenuitem.h
index f313c41d..82cb04ec 100644
--- a/src/include/final/fcheckmenuitem.h
+++ b/src/include/final/fcheckmenuitem.h
@@ -40,9 +40,9 @@
  *      ▕▁▁▁▁▁▁▁▁▁▁▁▏
  *            ▲
  *            │
- *    ▕▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▏*       1▕▔▔▔▔▔▔▔▏
- *    ▕ FCheckMenuItem ▏- - - - -▕ FMenu ▏
- *    ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▏         ▕▁▁▁▁▁▁▁▏
+ *    ▕▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▏*     1▕▔▔▔▔▔▔▔▏
+ *    ▕ FCheckMenuItem ▏- - - -▕ FMenu ▏
+ *    ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▏       ▕▁▁▁▁▁▁▁▏
  */
 
 #ifndef FCHECKMENUITEM_H
diff --git a/src/include/final/fcombobox.h b/src/include/final/fcombobox.h
index 18411d0f..b6758717 100644
--- a/src/include/final/fcombobox.h
+++ b/src/include/final/fcombobox.h
@@ -47,6 +47,7 @@
   #error "Only  can be included directly."
 #endif
 
+#include "final/fdata.h"
 #include "final/flineedit.h"
 #include "final/flistbox.h"
 #include "final/fwidget.h"
diff --git a/src/include/final/fdata.h b/src/include/final/fdata.h
index 2bf5f725..91ed9984 100644
--- a/src/include/final/fdata.h
+++ b/src/include/final/fdata.h
@@ -42,10 +42,11 @@
 
 #include 
 
+#include "final/fstring.h"
+
 namespace finalcut
 {
 
-
 //----------------------------------------------------------------------
 // struct FDataAccess
 //----------------------------------------------------------------------
@@ -56,12 +57,23 @@ class FData;  // Class forward declaration
 class FDataAccess
 {
   public:
+    // Destructor
+    virtual ~FDataAccess()
+    { }
+
+    // Accessors
+    virtual const FString getClassName() const
+    {
+      return "FDataAccess";
+    }
+
     template 
     const T& get() const
     {
       return static_cast&>(*this).get();
     }
 
+    // Mutator
     template 
     void set (const V& v)
@@ -79,6 +91,7 @@ template 
 class FData : public FDataAccess
 {
   public:
+    // Constructors
     explicit FData (T& v)  // constructor
       : value_ref{v}
     { }
@@ -88,6 +101,7 @@ class FData : public FDataAccess
       , value_ref{value}
     { }
 
+    // Overloaded operators
     T operator () () const
     {
       return value_ref;
@@ -104,16 +118,30 @@ class FData : public FDataAccess
       return value_ref;
     }
 
+    FData& operator << (const T& v)
+    {
+      value_ref = v;
+      return *this;
+    }
+
+    // Accessors
+    const FString getClassName() const override
+    {
+      return "FData";
+    }
+
     T& get()
     {
       return value_ref;
     }
 
+    // Mutator
     void set (const T& v)
     {
       value_ref = v;
     }
 
+    // Inquiries
     bool isInitializedCopy()
     {
       return bool(value);
@@ -124,12 +152,7 @@ class FData : public FDataAccess
       return ! isInitializedCopy();
     }
 
-    FData& operator << (const T& v)
-    {
-      value_ref = v;
-      return *this;
-    }
-
+    // Friend Non-member operator functions
     friend std::ostream& operator << (std::ostream &os, const FData& data)
     {
       os << data.value_ref;
@@ -142,7 +165,6 @@ class FData : public FDataAccess
     T& value_ref;
 };
 
-
 // non-member functions
 //----------------------------------------------------------------------
 namespace internal
diff --git a/src/include/final/fevent.h b/src/include/final/fevent.h
index e22d098f..da0313cf 100644
--- a/src/include/final/fevent.h
+++ b/src/include/final/fevent.h
@@ -68,9 +68,9 @@
  *      ├─────▏FTimerEvent ▏
  *      │    ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▏
  *      │
- *      │    ▕▔▔▔▔▔▔▔▔▔▔▔▔▔▏
- *      └─────▏FUserEvent  ▏
- *           ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▏
+ *      │    ▕▔▔▔▔▔▔▔▔▔▔▔▔▏1     1▕▔▔▔▔▔▔▔▏
+ *      └─────▏FUserEvent ▏- - - -▕ FData ▏
+ *           ▕▁▁▁▁▁▁▁▁▁▁▁▁▏       ▕▁▁▁▁▁▁▁▏
  */
 
 #ifndef FEVENT_H
@@ -81,6 +81,7 @@
 #endif
 
 #include "final/fc.h"
+#include "final/fdata.h"
 #include "final/fpoint.h"
 #include "final/ftypes.h"
 
diff --git a/src/include/final/final.h b/src/include/final/final.h
index dc363458..248f5627 100644
--- a/src/include/final/final.h
+++ b/src/include/final/final.h
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/src/include/final/flistbox.h b/src/include/final/flistbox.h
index 2e628cd0..7c923e0a 100644
--- a/src/include/final/flistbox.h
+++ b/src/include/final/flistbox.h
@@ -35,9 +35,9 @@
  *       ▕▁▁▁▁▁▁▁▁▁▏
  *            ▲
  *            │
- *       ▕▔▔▔▔▔▔▔▔▔▔▏1     *▕▔▔▔▔▔▔▔▔▔▔▔▔▔▔▏
- *       ▕ FListBox ▏- - - -▕ FListBoxItem ▏
- *       ▕▁▁▁▁▁▁▁▁▁▁▏       ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▁▏
+ *       ▕▔▔▔▔▔▔▔▔▔▔▏1     *▕▔▔▔▔▔▔▔▔▔▔▔▔▔▔▏1     1▕▔▔▔▔▔▔▔▏
+ *       ▕ FListBox ▏- - - -▕ FListBoxItem ▏- - - -▕ FData ▏
+ *       ▕▁▁▁▁▁▁▁▁▁▁▏       ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▁▏       ▕▁▁▁▁▁▁▁▏
  *
  */
 
@@ -51,6 +51,7 @@
 #include 
 #include 
 
+#include "final/fdata.h"
 #include "final/fscrollbar.h"
 #include "final/fwidget.h"
 
diff --git a/src/include/final/flistview.h b/src/include/final/flistview.h
index dad678a6..5052fbea 100644
--- a/src/include/final/flistview.h
+++ b/src/include/final/flistview.h
@@ -35,9 +35,9 @@
  *       ▕▁▁▁▁▁▁▁▁▁▏           ▕▁▁▁▁▁▁▁▁▁▏
  *            ▲                     ▲
  *            │                     │
- *      ▕▔▔▔▔▔▔▔▔▔▔▔▏1     *▕▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▏
- *      ▕ FListView ▏- - - -▕ FListViewItem ▏
- *      ▕▁▁▁▁▁▁▁▁▁▁▁▏       ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▏
+ *      ▕▔▔▔▔▔▔▔▔▔▔▔▏1     *▕▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▏1     1▕▔▔▔▔▔▔▔▏
+ *      ▕ FListView ▏- - - -▕ FListViewItem ▏- - - -▕ FData ▏
+ *      ▕▁▁▁▁▁▁▁▁▁▁▁▏       ▕▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▏       ▕▁▁▁▁▁▁▁▏
  */
 
 #ifndef FLISTVIEW_H
@@ -52,6 +52,7 @@
 #include 
 #include 
 
+#include "final/fdata.h"
 #include "final/fscrollbar.h"
 #include "final/ftermbuffer.h"
 #include "final/ftypes.h"
diff --git a/src/include/final/ftypes.h b/src/include/final/ftypes.h
index 5312905e..6aa4028a 100644
--- a/src/include/final/ftypes.h
+++ b/src/include/final/ftypes.h
@@ -36,8 +36,6 @@
 #include 
 #include 
 
-#include 
-
 #define null nullptr
 
 #define badAllocOutput(object_name)                            \
diff --git a/src/include/final/fwidget.h b/src/include/final/fwidget.h
index 61cdc3f9..1af03bfe 100644
--- a/src/include/final/fwidget.h
+++ b/src/include/final/fwidget.h
@@ -452,6 +452,7 @@ class FWidget : public FVTerm, public FObject
     static bool              isDefaultTheme();
     static void              initColorTheme();
     void                     destroyColorTheme();
+    void                     removeQueuedEvent();
     void                     setStatusbarText (bool) const;
 
     // Data members
diff --git a/test/fcallback-test.cpp b/test/fcallback-test.cpp
index 666b6399..ed7e83b1 100644
--- a/test/fcallback-test.cpp
+++ b/test/fcallback-test.cpp
@@ -1,5 +1,5 @@
 /***********************************************************************
-* callback-test.cpp - FCallback unit tests                             *
+* fcallback-test.cpp - FCallback unit tests                            *
 *                                                                      *
 * This file is part of the FINAL CUT widget toolkit                    *
 *                                                                      *
diff --git a/test/fdata-test.cpp b/test/fdata-test.cpp
new file mode 100644
index 00000000..8ca52d6e
--- /dev/null
+++ b/test/fdata-test.cpp
@@ -0,0 +1,98 @@
+/***********************************************************************
+* fdata-test.cpp - FCallback unit tests                                *
+*                                                                      *
+* This file is part of the FINAL CUT widget toolkit                    *
+*                                                                      *
+* Copyright 2020 Markus Gans                                           *
+*                                                                      *
+* FINAL CUT is free software; you can redistribute it and/or modify    *
+* it under the terms of the GNU Lesser General Public License as       *
+* published by the Free Software Foundation; either version 3 of       *
+* the License, or (at your option) any later version.                  *
+*                                                                      *
+* FINAL CUT is distributed in the hope that it will be useful, but     *
+* WITHOUT ANY WARRANTY; without even the implied warranty of           *
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
+* GNU Lesser General Public License for more details.                  *
+*                                                                      *
+* You should have received a copy of the GNU Lesser General Public     *
+* License along with this program.  If not, see                        *
+* .                                      *
+***********************************************************************/
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+
+//----------------------------------------------------------------------
+// functions
+//----------------------------------------------------------------------
+/*void cb_function_ptr (int* value)
+{
+  (*value)++;
+}
+
+//----------------------------------------------------------------------
+void cb_function_ref (int& value)
+{
+  value += 2;
+}*/
+
+//----------------------------------------------------------------------
+// class FDataTest
+//----------------------------------------------------------------------
+
+class FDataTest : public CPPUNIT_NS::TestFixture
+{
+  public:
+    FDataTest()
+    { }
+
+  protected:
+    void classNameTest();
+    void dataTest();
+
+  private:
+    // Adds code needed to register the test suite
+    CPPUNIT_TEST_SUITE (FDataTest);
+
+    // Add a methods to the test suite
+    CPPUNIT_TEST (classNameTest);
+    CPPUNIT_TEST (dataTest);
+
+    // End of test suite definition
+    CPPUNIT_TEST_SUITE_END();
+
+    // Data member
+    static finalcut::FWidget root_widget;
+};
+
+// static class attributes
+finalcut::FWidget FDataTest::root_widget{nullptr};
+
+//----------------------------------------------------------------------
+void FDataTest::classNameTest()
+{
+  const finalcut::FCallback d;
+  const finalcut::FString& classname = d.getClassName();
+  CPPUNIT_ASSERT ( classname == "FData" );
+}
+
+//----------------------------------------------------------------------
+void FDataTest::dataTest()
+{
+
+}
+// Put the test suite in the registry
+CPPUNIT_TEST_SUITE_REGISTRATION (FDataTest);
+
+// The general unit test main part
+#include