]> git.saurik.com Git - wxWidgets.git/blobdiff - src/motif/dialog.cpp
SetBackground for ListBox and others
[wxWidgets.git] / src / motif / dialog.cpp
index 313ea015daba7a1934a37925432a0669b803ce6f..28b7db5b42f1cf205453070144f7f67f3cacbc4a 100644 (file)
@@ -61,7 +61,7 @@ wxList wxModalDialogs;
 wxList wxModelessWindows;  // Frames and modeless dialogs
 extern wxList wxPendingDelete;
 
-#define USE_INVISIBLE_RESIZE 1
+#define wxUSE_INVISIBLE_RESIZE 1
 
 #if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxDialog, wxPanel)
@@ -80,7 +80,7 @@ END_EVENT_TABLE()
 wxDialog::wxDialog()
 {
     m_modalShowing = FALSE;
-    SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
+    m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
 }
 
 bool wxDialog::Create(wxWindow *parent, wxWindowID id,
@@ -94,7 +94,9 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id,
     m_modalShowing = FALSE;
     m_dialogTitle = title;
 
-    SetBackgroundColour(wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE));
+    m_backgroundColour = wxSystemSettings::GetSystemColour(wxSYS_COLOUR_3DFACE);
+    m_foregroundColour = *wxBLACK;
+
     SetName(name);
   
     if (!parent)
@@ -164,7 +166,7 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id,
 
     // Can't remember what this was about... but I think it's necessary.
 
-    if (USE_INVISIBLE_RESIZE)
+    if (wxUSE_INVISIBLE_RESIZE)
     {
       if (pos.x > -1)
         XtVaSetValues(dialogShell, XmNx, pos.x,
@@ -216,10 +218,10 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id,
     // Positioning of the dialog doesn't work properly unless the dialog
     // is managed, so we manage without mapping to the screen.
     // To show, we map the shell (actually it's parent).
-    if (!USE_INVISIBLE_RESIZE)
+    if (!wxUSE_INVISIBLE_RESIZE)
         XtVaSetValues(shell, XmNmappedWhenManaged, FALSE, NULL);
 
-    if (!USE_INVISIBLE_RESIZE)
+    if (!wxUSE_INVISIBLE_RESIZE)
     {
         XtManageChild(dialogShell);
         SetSize(pos.x, pos.y, size.x, size.y);
@@ -233,6 +235,8 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id,
        wxDialogBoxEventHandler,
        (XtPointer)this);
 
+    ChangeBackgroundColour();
+
     return TRUE;
 }
 
@@ -252,7 +256,7 @@ void wxDialog::SetModal(bool flag)
 wxDialog::~wxDialog()
 {
     m_modalShowing = FALSE;
-    if (!USE_INVISIBLE_RESIZE && m_mainWidget)
+    if (!wxUSE_INVISIBLE_RESIZE && m_mainWidget)
     {
       XtUnmapWidget((Widget) m_mainWidget);
     }
@@ -280,10 +284,16 @@ wxDialog::~wxDialog()
 
     // Now process all events, because otherwise
     // this might remain on the screen.
-    XSync(XtDisplay(XtParent((Widget) m_mainWidget)), FALSE);
+    Display* display;
+    if (m_mainWidget)
+      display = XtDisplay((Widget) m_mainWidget);
+    else
+      display = (Display*) wxGetDisplay();
+
+    XSync(display, FALSE);
     XEvent event;
     while (XtAppPending((XtAppContext) wxTheApp->GetAppContext())) {
-      XFlush(XtDisplay((Widget) XtParent((Widget) m_mainWidget)));
+      XFlush(display);
       XtAppNextEvent((XtAppContext) wxTheApp->GetAppContext(), &event);
       XtDispatchEvent(&event);
     }
@@ -426,7 +436,7 @@ bool wxDialog::Show(bool show)
 
     if (show)
     {
-        if (!USE_INVISIBLE_RESIZE)
+        if (!wxUSE_INVISIBLE_RESIZE)
           XtMapWidget(XtParent((Widget) m_mainWidget));
         else
           XtManageChild((Widget) m_mainWidget) ; 
@@ -436,7 +446,7 @@ bool wxDialog::Show(bool show)
     }
     else
     {
-        if (!USE_INVISIBLE_RESIZE)
+        if (!wxUSE_INVISIBLE_RESIZE)
             XtUnmapWidget(XtParent((Widget) m_mainWidget));
         else
             XtUnmanageChild((Widget) m_mainWidget) ;
@@ -733,3 +743,19 @@ static void wxUnmapBulletinBoard(Widget dialog, wxDialog *client,XtPointer call)
   client->m_isShown = FALSE;
   */
 }
+
+void wxDialog::ChangeFont()
+{
+    // TODO
+}
+
+void wxDialog::ChangeBackgroundColour()
+{
+    // TODO
+}
+
+void wxDialog::ChangeForegroundColour()
+{
+    // TODO
+}
+