2003-03-21 14:51:47 -05:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/cocoa/toplevel.h
|
|
|
|
// Purpose: wxTopLevelWindowCocoa is the Cocoa implementation of wxTLW
|
|
|
|
// Author: David Elliott
|
|
|
|
// Modified by:
|
|
|
|
// Created: 2002/12/08
|
2003-11-13 10:13:55 -05:00
|
|
|
// RCS-ID: $Id$
|
2003-03-21 14:51:47 -05:00
|
|
|
// Copyright: (c) 2002 David Elliott
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
2003-03-21 14:51:47 -05:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef __WX_COCOA_TOPLEVEL_H__
|
|
|
|
#define __WX_COCOA_TOPLEVEL_H__
|
|
|
|
|
|
|
|
#include "wx/hashmap.h"
|
|
|
|
#include "wx/cocoa/NSWindow.h"
|
|
|
|
|
2003-09-04 17:16:41 -04:00
|
|
|
class WXDLLEXPORT wxMenuBar;
|
|
|
|
|
2003-03-21 14:51:47 -05:00
|
|
|
// ========================================================================
|
|
|
|
// wxTopLevelWindowCocoa
|
|
|
|
// ========================================================================
|
|
|
|
class WXDLLEXPORT wxTopLevelWindowCocoa : public wxTopLevelWindowBase, protected wxCocoaNSWindow
|
|
|
|
{
|
|
|
|
DECLARE_EVENT_TABLE();
|
2003-03-24 12:06:28 -05:00
|
|
|
DECLARE_NO_COPY_CLASS(wxTopLevelWindowCocoa);
|
2003-03-21 14:51:47 -05:00
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
// initialization
|
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
public:
|
2004-03-02 22:45:38 -05:00
|
|
|
inline wxTopLevelWindowCocoa()
|
|
|
|
: wxCocoaNSWindow(this)
|
|
|
|
{ Init(); }
|
2003-03-21 14:51:47 -05:00
|
|
|
|
|
|
|
inline wxTopLevelWindowCocoa(wxWindow *parent,
|
|
|
|
wxWindowID winid,
|
|
|
|
const wxString& title,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxDEFAULT_FRAME_STYLE,
|
|
|
|
const wxString& name = wxFrameNameStr)
|
2004-03-02 22:45:38 -05:00
|
|
|
: wxCocoaNSWindow(this)
|
2003-03-21 14:51:47 -05:00
|
|
|
{
|
|
|
|
Init();
|
|
|
|
Create(parent, winid, title, pos, size, style, name);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Create(wxWindow *parent,
|
|
|
|
wxWindowID winid,
|
|
|
|
const wxString& title,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxDEFAULT_FRAME_STYLE,
|
|
|
|
const wxString& name = wxFrameNameStr);
|
|
|
|
|
|
|
|
virtual ~wxTopLevelWindowCocoa();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
// common part of all ctors
|
|
|
|
void Init();
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
// Cocoa specifics
|
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
public:
|
|
|
|
inline WX_NSWindow GetNSWindow() { return m_cocoaNSWindow; }
|
2003-10-06 15:17:11 -04:00
|
|
|
virtual void CocoaDelegate_windowWillClose(void);
|
2003-08-29 10:59:04 -04:00
|
|
|
virtual bool CocoaDelegate_windowShouldClose(void);
|
|
|
|
virtual void CocoaDelegate_windowDidBecomeKey(void);
|
|
|
|
virtual void CocoaDelegate_windowDidResignKey(void);
|
2003-09-04 17:16:41 -04:00
|
|
|
virtual void CocoaDelegate_windowDidBecomeMain(void);
|
|
|
|
virtual void CocoaDelegate_windowDidResignMain(void);
|
2004-02-27 01:07:47 -05:00
|
|
|
virtual void CocoaDelegate_wxMenuItemAction(WX_NSMenuItem sender);
|
|
|
|
virtual bool CocoaDelegate_validateMenuItem(WX_NSMenuItem sender);
|
2003-11-06 15:37:16 -05:00
|
|
|
virtual wxMenuBar* GetAppMenuBar(wxCocoaNSWindow *win);
|
2003-11-13 10:13:55 -05:00
|
|
|
static void DeactivatePendingWindow();
|
2003-03-21 14:51:47 -05:00
|
|
|
protected:
|
|
|
|
void SetNSWindow(WX_NSWindow cocoaNSWindow);
|
|
|
|
WX_NSWindow m_cocoaNSWindow;
|
|
|
|
static wxCocoaNSWindowHash sm_cocoaHash;
|
2003-08-14 16:34:07 -04:00
|
|
|
virtual void CocoaReplaceView(WX_NSView oldView, WX_NSView newView);
|
2003-09-08 10:51:38 -04:00
|
|
|
static unsigned int NSWindowStyleForWxStyle(long style);
|
2003-03-21 14:51:47 -05:00
|
|
|
|
2003-11-13 10:13:55 -05:00
|
|
|
static wxTopLevelWindowCocoa *sm_cocoaDeactivateWindow;
|
2003-03-21 14:51:47 -05:00
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
// Implementation
|
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
public:
|
2003-11-13 10:13:55 -05:00
|
|
|
virtual bool Destroy();
|
2003-03-21 14:51:47 -05:00
|
|
|
// Pure virtuals
|
|
|
|
virtual void Maximize(bool maximize = true);
|
|
|
|
virtual bool IsMaximized() const;
|
|
|
|
virtual void Iconize(bool iconize = true);
|
|
|
|
virtual bool IsIconized() const;
|
|
|
|
virtual void Restore();
|
|
|
|
virtual bool ShowFullScreen(bool show, long style = wxFULLSCREEN_ALL);
|
|
|
|
virtual bool IsFullScreen() const;
|
|
|
|
// other
|
|
|
|
virtual bool Show( bool show = true );
|
|
|
|
virtual bool Close( bool force = false );
|
|
|
|
virtual void OnCloseWindow(wxCloseEvent& event);
|
2003-08-17 19:23:26 -04:00
|
|
|
virtual void CocoaSetWxWindowSize(int width, int height);
|
2003-03-21 14:51:47 -05:00
|
|
|
virtual void DoMoveWindow(int x, int y, int width, int height);
|
|
|
|
virtual void DoGetSize(int *width, int *height) const;
|
|
|
|
virtual void DoGetPosition(int *x, int *y) const;
|
|
|
|
|
|
|
|
|
|
|
|
// Things I may/may not do
|
|
|
|
// virtual void SetIcon(const wxIcon& icon);
|
|
|
|
// virtual void SetIcons(const wxIconBundle& icons) { SetIcon( icons.GetIcon( -1 ) ); }
|
|
|
|
// virtual void Clear() ;
|
|
|
|
// virtual void Raise();
|
|
|
|
// virtual void Lower();
|
|
|
|
// virtual void SetTitle( const wxString& title);
|
|
|
|
protected:
|
|
|
|
// is the frame currently iconized?
|
|
|
|
bool m_iconized;
|
|
|
|
// has the frame been closed
|
|
|
|
bool m_closed;
|
|
|
|
// should the frame be maximized when it will be shown? set by Maximize()
|
|
|
|
// when it is called while the frame is hidden
|
|
|
|
bool m_maximizeOnShow;
|
|
|
|
};
|
|
|
|
|
|
|
|
// list of all frames and modeless dialogs
|
|
|
|
extern WXDLLEXPORT_DATA(wxWindowList) wxModelessWindows;
|
|
|
|
|
|
|
|
#endif // __WX_COCOA_TOPLEVEL_H__
|