]> git.saurik.com Git - wxWidgets.git/blobdiff - src/palmos/frame.cpp
Committed William Osborne's wxPalmOS port
[wxWidgets.git] / src / palmos / frame.cpp
diff --git a/src/palmos/frame.cpp b/src/palmos/frame.cpp
new file mode 100644 (file)
index 0000000..494bfb2
--- /dev/null
@@ -0,0 +1,395 @@
+/////////////////////////////////////////////////////////////////////////////
+// Name:        palmos/frame.cpp
+// Purpose:     wxFrame
+// Author:      William Osborne
+// Modified by:
+// Created:     10/13/04
+// RCS-ID:      $Id: 
+// Copyright:   (c) William Osborne
+// Licence:     wxWindows licence
+/////////////////////////////////////////////////////////////////////////////
+
+// ============================================================================
+// declarations
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// headers
+// ----------------------------------------------------------------------------
+
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
+    #pragma implementation "frame.h"
+#endif
+
+// For compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
+#ifdef __BORLANDC__
+    #pragma hdrstop
+#endif
+
+#ifndef WX_PRECOMP
+    #include "wx/frame.h"
+    #include "wx/app.h"
+    #include "wx/menu.h"
+    #include "wx/utils.h"
+    #include "wx/dialog.h"
+    #include "wx/settings.h"
+    #include "wx/dcclient.h"
+    #include "wx/mdi.h"
+    #include "wx/panel.h"
+#endif // WX_PRECOMP
+
+#if wxUSE_STATUSBAR
+    #include "wx/statusbr.h"
+    #include "wx/generic/statusbr.h"
+#endif // wxUSE_STATUSBAR
+
+#if wxUSE_TOOLBAR
+    #include "wx/toolbar.h"
+#endif // wxUSE_TOOLBAR
+
+#include "wx/menuitem.h"
+#include "wx/log.h"
+
+#ifdef __WXUNIVERSAL__
+    #include "wx/univ/theme.h"
+    #include "wx/univ/colschem.h"
+#endif // __WXUNIVERSAL__
+
+// ----------------------------------------------------------------------------
+// globals
+// ----------------------------------------------------------------------------
+
+#if wxUSE_MENUS_NATIVE
+    extern wxMenu *wxCurrentPopupMenu;
+#endif // wxUSE_MENUS_NATIVE
+
+// ----------------------------------------------------------------------------
+// event tables
+// ----------------------------------------------------------------------------
+
+BEGIN_EVENT_TABLE(wxFrame, wxFrameBase)
+    EVT_SYS_COLOUR_CHANGED(wxFrame::OnSysColourChanged)
+    EVT_PAINT(wxFrame::OnPaint)    
+END_EVENT_TABLE()
+
+#if wxUSE_EXTENDED_RTTI
+WX_DEFINE_FLAGS( wxFrameStyle )
+
+wxBEGIN_FLAGS( wxFrameStyle )
+    // new style border flags, we put them first to
+    // use them for streaming out
+    wxFLAGS_MEMBER(wxBORDER_SIMPLE)
+    wxFLAGS_MEMBER(wxBORDER_SUNKEN)
+    wxFLAGS_MEMBER(wxBORDER_DOUBLE)
+    wxFLAGS_MEMBER(wxBORDER_RAISED)
+    wxFLAGS_MEMBER(wxBORDER_STATIC)
+    wxFLAGS_MEMBER(wxBORDER_NONE)
+    
+    // old style border flags
+    wxFLAGS_MEMBER(wxSIMPLE_BORDER)
+    wxFLAGS_MEMBER(wxSUNKEN_BORDER)
+    wxFLAGS_MEMBER(wxDOUBLE_BORDER)
+    wxFLAGS_MEMBER(wxRAISED_BORDER)
+    wxFLAGS_MEMBER(wxSTATIC_BORDER)
+    wxFLAGS_MEMBER(wxBORDER)
+
+    // standard window styles
+    wxFLAGS_MEMBER(wxTAB_TRAVERSAL)
+    wxFLAGS_MEMBER(wxCLIP_CHILDREN)
+    wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW)
+    wxFLAGS_MEMBER(wxWANTS_CHARS)
+    wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE)
+    wxFLAGS_MEMBER(wxALWAYS_SHOW_SB )
+    wxFLAGS_MEMBER(wxVSCROLL)
+    wxFLAGS_MEMBER(wxHSCROLL)
+
+    // frame styles
+    wxFLAGS_MEMBER(wxSTAY_ON_TOP)
+    wxFLAGS_MEMBER(wxCAPTION)
+    wxFLAGS_MEMBER(wxTHICK_FRAME)
+    wxFLAGS_MEMBER(wxSYSTEM_MENU)
+    wxFLAGS_MEMBER(wxRESIZE_BORDER)
+    wxFLAGS_MEMBER(wxRESIZE_BOX)
+    wxFLAGS_MEMBER(wxCLOSE_BOX)
+    wxFLAGS_MEMBER(wxMAXIMIZE_BOX)
+    wxFLAGS_MEMBER(wxMINIMIZE_BOX)
+
+    wxFLAGS_MEMBER(wxFRAME_TOOL_WINDOW)
+    wxFLAGS_MEMBER(wxFRAME_FLOAT_ON_PARENT)
+
+    wxFLAGS_MEMBER(wxFRAME_SHAPED)
+
+wxEND_FLAGS( wxFrameStyle )
+
+IMPLEMENT_DYNAMIC_CLASS_XTI(wxFrame, wxTopLevelWindow,"wx/frame.h")
+
+wxBEGIN_PROPERTIES_TABLE(wxFrame)
+    wxEVENT_PROPERTY( Menu , wxEVT_COMMAND_MENU_SELECTED , wxCommandEvent)
+
+    wxPROPERTY( Title,wxString, SetTitle, GetTitle, wxString() , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
+    wxPROPERTY_FLAGS( WindowStyle , wxFrameStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
+    wxPROPERTY( MenuBar , wxMenuBar * , SetMenuBar , GetMenuBar , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
+wxEND_PROPERTIES_TABLE()
+
+wxBEGIN_HANDLERS_TABLE(wxFrame)
+wxEND_HANDLERS_TABLE()
+
+wxCONSTRUCTOR_6( wxFrame , wxWindow* , Parent , wxWindowID , Id , wxString , Title , wxPoint , Position , wxSize , Size , long , WindowStyle) 
+
+#else
+IMPLEMENT_DYNAMIC_CLASS(wxFrame, wxTopLevelWindow)
+#endif
+
+// ============================================================================
+// implementation
+// ============================================================================
+
+// ----------------------------------------------------------------------------
+// static class members
+// ----------------------------------------------------------------------------
+
+#if wxUSE_STATUSBAR
+    #if wxUSE_NATIVE_STATUSBAR
+        bool wxFrame::m_useNativeStatusBar = TRUE;
+    #else
+        bool wxFrame::m_useNativeStatusBar = FALSE;
+    #endif
+#endif // wxUSE_NATIVE_STATUSBAR
+
+// ----------------------------------------------------------------------------
+// creation/destruction
+// ----------------------------------------------------------------------------
+
+void wxFrame::Init()
+{
+    StatusBar=NULL;
+}
+
+bool wxFrame::Create(wxWindow *parent,
+                     wxWindowID id,
+                     const wxString& title,
+                     const wxPoint& pos,
+                     const wxSize& size,
+                     long style,
+                     const wxString& name)
+{
+    if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name, this) )
+        return false;
+        
+    return true;
+}
+
+wxFrame::~wxFrame()
+{
+}
+
+// ----------------------------------------------------------------------------
+// wxFrame client size calculations
+// ----------------------------------------------------------------------------
+
+void wxFrame::DoSetClientSize(int width, int height)
+{
+}
+
+// Get size *available for subwindows* i.e. excluding menu bar, toolbar etc.
+void wxFrame::DoGetClientSize(int *x, int *y) const
+{
+}
+
+// ----------------------------------------------------------------------------
+// wxFrame: various geometry-related functions
+// ----------------------------------------------------------------------------
+
+void wxFrame::Raise()
+{
+}
+
+// generate an artificial resize event
+void wxFrame::SendSizeEvent()
+{
+}
+
+#if wxUSE_STATUSBAR
+wxStatusBar *wxFrame::OnCreateStatusBar(int number,
+                                        long style,
+                                        wxWindowID id,
+                                        const wxString& name)
+{
+    wxStatusBar *statusBar = NULL;
+
+#if wxUSE_NATIVE_STATUSBAR
+    if ( !UsesNativeStatusBar() )
+    {
+        statusBar = (wxStatusBar *)new wxStatusBarGeneric(this, id, style);
+    }
+    else
+#endif
+    {
+        statusBar = new wxStatusBar(this, id, style, name);
+    }
+
+    statusBar->SetFieldsCount(number);
+
+       StatusBar=statusBar;
+    return statusBar;
+
+    return NULL;
+}
+
+void wxFrame::PositionStatusBar()
+{
+}
+#endif // wxUSE_STATUSBAR
+
+#if wxUSE_MENUS_NATIVE
+
+void wxFrame::AttachMenuBar(wxMenuBar *menubar)
+{
+    wxFrameBase::AttachMenuBar(menubar);
+
+    if ( !menubar )
+    {
+        // actually remove the menu from the frame
+        m_hMenu = (WXHMENU)0;
+    }
+}
+
+void wxFrame::InternalSetMenuBar()
+{
+}
+
+bool wxFrame::HandleMenuOpen()
+{
+    if(!m_frameMenuBar)
+        return false;
+        
+    m_frameMenuBar->LoadMenu();
+    return true;
+}
+
+bool wxFrame::HandleMenuSelect(int ItemID)
+{
+    if (!m_frameMenuBar)
+        return false;
+
+    int item=m_frameMenuBar->ProcessCommand(ItemID);
+    if(item==-1)
+        return false;
+
+    wxCommandEvent commandEvent(wxEVT_COMMAND_MENU_SELECTED, item);
+    commandEvent.SetEventObject(this);
+        
+    GetEventHandler()->ProcessEvent(commandEvent);
+    return true;    
+}
+
+#endif // wxUSE_MENUS_NATIVE
+
+// Responds to colour changes, and passes event on to children.
+void wxFrame::OnSysColourChanged(wxSysColourChangedEvent& event)
+{
+}
+
+void wxFrame::OnPaint(wxPaintEvent& event)
+{
+    #if wxUSE_STATUSBAR
+        if(StatusBar!=NULL)
+            StatusBar->DrawStatusBar();
+    #endif
+}
+  
+// Pass TRUE to show full screen, FALSE to restore.
+bool wxFrame::ShowFullScreen(bool show, long style)
+{
+    return false;
+}
+
+// ----------------------------------------------------------------------------
+// tool/status bar stuff
+// ----------------------------------------------------------------------------
+
+#if wxUSE_TOOLBAR
+
+wxToolBar* wxFrame::CreateToolBar(long style, wxWindowID id, const wxString& name)
+{
+    return NULL;
+}
+
+void wxFrame::PositionToolBar()
+{
+}
+
+#endif // wxUSE_TOOLBAR
+
+// ----------------------------------------------------------------------------
+// frame state (iconized/maximized/...)
+// ----------------------------------------------------------------------------
+
+// propagate our state change to all child frames: this allows us to emulate X
+// Windows behaviour where child frames float independently of the parent one
+// on the desktop, but are iconized/restored with it
+void wxFrame::IconizeChildFrames(bool bIconize)
+{
+}
+
+WXHICON wxFrame::GetDefaultIcon() const
+{
+    // we don't have any standard icons (any more)
+    return (WXHICON)0;
+}
+
+// ===========================================================================
+// message processing
+// ===========================================================================
+
+// ---------------------------------------------------------------------------
+// preprocessing
+// ---------------------------------------------------------------------------
+
+bool wxFrame::MSWTranslateMessage(WXMSG* pMsg)
+{
+    return false;
+}
+
+// ---------------------------------------------------------------------------
+// our private (non virtual) message handlers
+// ---------------------------------------------------------------------------
+
+bool wxFrame::HandlePaint()
+{
+    return false;
+}
+
+bool wxFrame::HandleSize(int x, int y, WXUINT id)
+{
+    return false;
+}
+
+bool wxFrame::HandleCommand(WXWORD id, WXWORD cmd, WXHWND control)
+{
+    return false;
+}
+
+// ---------------------------------------------------------------------------
+// the window proc for wxFrame
+// ---------------------------------------------------------------------------
+
+WXLRESULT wxFrame::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
+{
+    return false;
+}
+
+// ----------------------------------------------------------------------------
+// wxFrame size management: we exclude the areas taken by menu/status/toolbars
+// from the client area, so the client area is what's really available for the
+// frame contents
+// ----------------------------------------------------------------------------
+
+// get the origin of the client area in the client coordinates
+wxPoint wxFrame::GetClientAreaOrigin() const
+{
+    wxPoint pt;
+    return pt;
+}