]> git.saurik.com Git - wxWidgets.git/blobdiff - src/os2/statbox.cpp
Stripped out miscellaneous Motif/Xt-specific code
[wxWidgets.git] / src / os2 / statbox.cpp
index b239dc738c830175d1f18afc795245ca00b4ecee..61f5db74d6cf964bb3d8488d21d466b94a39f386 100644 (file)
 /////////////////////////////////////////////////////////////////////////////
 // Name:        statbox.cpp
 // Purpose:     wxStaticBox
-// Author:      AUTHOR
+// Author:      David Webster
 // Modified by:
 // Created:     ??/??/98
 // RCS-ID:      $Id$
-// Copyright:   (c) AUTHOR
-// Licence:    wxWindows licence
+// Copyright:   (c) David Webster
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#ifdef __GNUG__
-#pragma implementation "statbox.h"
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#include "wx/window.h"
+#include "wx/os2/private.h"
+
+#ifndef WX_PRECOMP
+#include "wx/app.h"
+#include "wx/dcclient.h"
 #endif
 
 #include "wx/statbox.h"
 
-#if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxStaticBox, wxControl)
 
-BEGIN_EVENT_TABLE(wxStaticBox, wxControl)
-       EVT_ERASE_BACKGROUND(wxStaticBox::OnEraseBackground)
-END_EVENT_TABLE()
-
+bool wxStaticBox::Create(
+  wxWindow*                         pParent
+, wxWindowID                        vId
+, const wxString&                   rsLabel
+, const wxPoint&                    rPos
+, const wxSize&                     rSize
+, long                              lStyle
+, const wxString&                   rsName
+)
+{
+    if(!OS2CreateControl( pParent
+                         ,vId
+                         ,rPos
+                         ,rSize
+                         ,lStyle
+#if wxUSE_VALIDATORS
+                         ,wxDefaultValidator
 #endif
+                         ,rsName
+                        ))
+    {
+        return FALSE;
+    }
 
-/*
- * Static box
- */
-bool wxStaticBox::Create(wxWindow *parent, wxWindowID id,
-           const wxString& label,
-           const wxPoint& pos,
-           const wxSize& size,
-           long style,
-           const wxString& name)
-{
-    SetName(name);
+    wxPoint                         vPos(0,0);
+    wxSize                          vSize(0,0);
+
+    if (!OS2CreateControl( "STATIC"
+                          ,SS_GROUPBOX
+                          ,vPos
+                          ,vSize
+                          ,rsLabel
+                         ))
+    {
+        return FALSE;
+    }
 
-    if (parent) parent->AddChild(this);
+    wxColour                        vColour;
 
-    if ( id == -1 )
-           m_windowId = (int)NewControlId();
-    else
-           m_windowId = id;
+    vColour.Set(wxString("BLACK"));
 
-    m_windowStyle = style;
+    LONG                            lColor = (LONG)vColour.GetPixel();
 
-    // TODO: create static box
-    return FALSE;
-}
+    ::WinSetPresParam( m_hWnd
+                      ,PP_FOREGROUNDCOLOR
+                      ,sizeof(LONG)
+                      ,(PVOID)&lColor
+                     );
+    lColor = (LONG)m_backgroundColour.GetPixel();
 
-void wxStaticBox::SetLabel(const wxString& label)
+    ::WinSetPresParam( m_hWnd
+                      ,PP_BACKGROUNDCOLOR
+                      ,sizeof(LONG)
+                      ,(PVOID)&lColor
+                     );
+    wxFont*                          pTextFont = new wxFont( 10
+                                                            ,wxMODERN
+                                                            ,wxNORMAL
+                                                            ,wxNORMAL
+                                                           );
+    SetFont(*pTextFont);
+    SetSize( rPos.x
+            ,rPos.y
+            ,rSize.x
+            ,rSize.y
+           );
+    delete pTextFont;
+    return TRUE;
+} // end of wxStaticBox::Create
+
+wxSize wxStaticBox::DoGetBestSize() const
 {
-    // TODO
-}
+    int                             nCx;
+    int                             nCy;
+    int                             wBox;
+
+    wxGetCharSize( GetHWND()
+                  ,&nCx
+                  ,&nCy
+                  ,(wxFont*)&GetFont()
+                 );
+    GetTextExtent( wxGetWindowText(m_hWnd)
+                  ,&wBox
+                  ,&nCy
+                 );
+    wBox += 3 * nCx;
+
+    int                             hBox = EDIT_HEIGHT_FROM_CHAR_HEIGHT(nCy);
 
-void wxStaticBox::SetSize(int x, int y, int width, int height, int sizeFlags)
+    return wxSize( wBox
+                  ,hBox
+                 );
+} // end of wxStaticBox::DoGetBestSize
+
+MRESULT wxStaticBox::OS2WindowProc(
+  WXUINT                            nMsg
+, WXWPARAM                          wParam
+, WXLPARAM                          lParam
+)
 {
-    // TODO
-}
+    return wxControl::OS2WindowProc(nMsg, wParam, lParam);
+} // end of wxStaticBox::OS2WindowProc
+