// Author: David Elliott
// Modified by:
// Created: 2002/12/26
-// RCS-ID: $Id:
+// RCS-ID: $Id$
// Copyright: (c) 2002 David Elliott
-// Licence: wxWidgets licence
+// Licence: wxWidgets licence
/////////////////////////////////////////////////////////////////////////////
#include "wx/wxprec.h"
+
#ifndef WX_PRECOMP
#include "wx/log.h"
#include "wx/window.h"
#include "wx/dc.h"
+ #include "wx/utils.h"
#endif //WX_PRECOMP
+
#include "wx/tooltip.h"
#include "wx/cocoa/autorelease.h"
#include "wx/cocoa/string.h"
-#import <AppKit/NSView.h>
+#include "wx/cocoa/objc/NSView.h"
#import <AppKit/NSEvent.h>
#import <AppKit/NSScrollView.h>
#import <AppKit/NSColor.h>
m_cocoaNSView = NULL;
m_cocoaHider = NULL;
m_wxCocoaScrollView = NULL;
- m_isBeingDeleted = FALSE;
- m_isInPaint = FALSE;
- m_shouldBeEnabled = true;
+ m_isBeingDeleted = false;
+ m_isInPaint = false;
}
// Constructor
// TODO: create the window
m_cocoaNSView = NULL;
- SetNSView([[NSView alloc] initWithFrame: MakeDefaultNSRect(size)]);
+ SetNSView([[WXNSView alloc] initWithFrame: MakeDefaultNSRect(size)]);
[m_cocoaNSView release];
if (m_parent)
SetInitialFrameRect(pos,size);
}
- return TRUE;
+ return true;
}
// Destructor
wxLogDebug(wxT("Paint event recursion!"));
return false;
}
- m_isInPaint = TRUE;
+ m_isInPaint = true;
// Set m_updateRegion
const NSRect *rects = ▭ // The bounding box of the region
wxPaintEvent event(m_windowId);
event.SetEventObject(this);
bool ret = GetEventHandler()->ProcessEvent(event);
- m_isInPaint = FALSE;
+ m_isInPaint = false;
return ret;
}
{
if(!m_cursor.GetNSCursor())
return false;
-
- [GetNSView() addCursorRect: [GetNSView() visibleRect] cursor: m_cursor.GetNSCursor()];
-
+
+ [GetNSView() addCursorRect: [GetNSView() visibleRect] cursor: m_cursor.GetNSCursor()];
+
return true;
}
[[oldView superview] replaceSubview:oldView with:newView];
}
-bool wxWindow::EnableSelfAndChildren(bool enable)
+void wxWindow::DoEnable(bool enable)
{
- // If the state isn't changing, don't do anything
- if(!wxWindowBase::Enable(enable && m_shouldBeEnabled))
- return false;
- // Set the state of the Cocoa window
- CocoaSetEnabled(m_isEnabled);
- // Disable all children or (if enabling) return them to their proper state
- for(wxWindowList::compatibility_iterator node = GetChildren().GetFirst();
- node; node = node->GetNext())
- {
- node->GetData()->EnableSelfAndChildren(enable);
- }
- return true;
-}
-
-bool wxWindow::Enable(bool enable)
-{
- // Keep track of what the window SHOULD be doing
- m_shouldBeEnabled = enable;
- // If the parent is disabled for any reason, then this window will be too.
- if(!IsTopLevel() && GetParent())
- {
- enable = enable && GetParent()->IsEnabled();
- }
- return EnableSelfAndChildren(enable);
+ CocoaSetEnabled(enable);
}
bool wxWindow::Show(bool show)
AdjustForParentClientOrigin(x,y,sizeFlags);
- wxSize size(-1,-1);
+ wxSize size(wxDefaultSize);
if((width==-1)&&!(sizeFlags&wxSIZE_ALLOW_MINUS_ONE))
{
void wxWindow::CocoaSetWxWindowSize(int width, int height)
{
- wxWindowCocoa::DoSetSize(-1,-1,width,height,wxSIZE_USE_EXISTING);
+ wxWindowCocoa::DoSetSize(wxDefaultCoord,wxDefaultCoord,width,height,wxSIZE_USE_EXISTING);
+}
+
+void wxWindow::SetLabel(const wxString& WXUNUSED(label))
+{
+ // TODO
+}
+
+wxString wxWindow::GetLabel() const
+{
+ // TODO
+ return wxEmptyString;
}
int wxWindow::GetCharHeight() const
bool wxWindow::SetFont(const wxFont& font)
{
// TODO
- return TRUE;
+ return true;
}
static int CocoaRaiseWindowCompareFunction(id first, id second, void *target)
bool wxWindow::DoPopupMenu(wxMenu *menu, int x, int y)
{
- return FALSE;
+ return false;
}
// Get the window with the focus
return wxDefaultPosition;
}
+wxMouseState wxGetMouseState()
+{
+ wxMouseState ms;
+ // TODO
+ return ms;
+}
+
wxWindow* wxFindWindowAtPointer(wxPoint& pt)
{
pt = wxGetMousePosition();
return NULL;
}
-