From: Włodzimierz Skiba Date: Tue, 8 Nov 2005 16:02:07 +0000 (+0000) Subject: Get/SetTitle only for wxTopLevelWindow (wxCocoa part). X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/8d8d36335cf7d3a5bf787e7e2510ac09f4839e5e Get/SetTitle only for wxTopLevelWindow (wxCocoa part). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@36128 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/cocoa/checkbox.h b/include/wx/cocoa/checkbox.h index 4ce89830fc..2cdaa412c2 100644 --- a/include/wx/cocoa/checkbox.h +++ b/include/wx/cocoa/checkbox.h @@ -4,9 +4,9 @@ // Author: David Elliott // Modified by: // Created: 2003/03/16 -// RCS-ID: $Id: +// RCS-ID: $Id$ // Copyright: (c) 2003 David Elliott -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef __WX_COCOA_CHECKBOX_H__ @@ -59,7 +59,6 @@ public: virtual void SetValue(bool); virtual bool GetValue() const; virtual void SetLabel(const wxString& label); - virtual wxString GetLabel() const { return GetTitle(); } protected: virtual void DoSet3StateValue(wxCheckBoxState state); virtual wxCheckBoxState DoGet3StateValue() const; diff --git a/include/wx/cocoa/toplevel.h b/include/wx/cocoa/toplevel.h index 779028ca15..5ac33f1a77 100644 --- a/include/wx/cocoa/toplevel.h +++ b/include/wx/cocoa/toplevel.h @@ -103,6 +103,8 @@ public: 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; + virtual void SetTitle( const wxString& title); + virtual wxString GetTitle() const; // Things I may/may not do @@ -111,7 +113,6 @@ public: // virtual void Clear() ; // virtual void Raise(); // virtual void Lower(); -// virtual void SetTitle( const wxString& title); protected: // is the frame currently iconized? bool m_iconized; diff --git a/include/wx/cocoa/window.h b/include/wx/cocoa/window.h index 06ce0bb977..509d59b12a 100644 --- a/include/wx/cocoa/window.h +++ b/include/wx/cocoa/window.h @@ -4,9 +4,9 @@ // Author: David Elliott // Modified by: // Created: 2002/12/26 -// RCS-ID: $Id: +// RCS-ID: $Id$ // Copyright: (c) 2002 David Elliott -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef __WX_COCOA_WINDOW_H__ @@ -142,10 +142,13 @@ public: // Warp the pointer the given position virtual void WarpPointer(int x_pos, int y_pos) ; // Send the window a refresh event - virtual void Refresh(bool eraseBack = TRUE, const wxRect *rect = NULL); + virtual void Refresh(bool eraseBack = true, const wxRect *rect = NULL); // Set/get the window's font virtual bool SetFont(const wxFont& f); // inline virtual wxFont& GetFont() const; + virtual void SetLabel(const wxString& label) { SetTitle(label); } + virtual wxString GetLabel() const { return GetTitle(); } + // label handling // Get character size virtual int GetCharHeight() const; virtual int GetCharWidth() const; @@ -155,8 +158,8 @@ public: const wxFont *theFont = NULL) const; // Scroll stuff virtual void SetScrollbar(int orient, int pos, int thumbVisible, - int range, bool refresh = TRUE); - virtual void SetScrollPos(int orient, int pos, bool refresh = TRUE); + int range, bool refresh = true); + virtual void SetScrollPos(int orient, int pos, bool refresh = true); virtual int GetScrollPos(int orient) const; virtual int GetScrollThumb(int orient) const; virtual int GetScrollRange(int orient) const; diff --git a/include/wx/toplevel.h b/include/wx/toplevel.h index 15b141709a..bc98e88087 100644 --- a/include/wx/toplevel.h +++ b/include/wx/toplevel.h @@ -159,6 +159,7 @@ public: defined(__WXMOTIF__) || \ defined(__WXPM__) || \ defined(__WXMAC__) || \ + defined(__WXCOCOA__) || \ defined(__WXGTK__) // FIXME: This is work in progress about moving SetTitle/GetTitle from wxWindow diff --git a/include/wx/window.h b/include/wx/window.h index 6753073db0..e80ae5faa1 100644 --- a/include/wx/window.h +++ b/include/wx/window.h @@ -173,6 +173,7 @@ public: !defined(__WXMOTIF__) && \ !defined(__WXPM__) && \ !defined(__WXMAC__) && \ + !defined(__WXCOCOA__) && \ !defined(__WXGTK__) // FIXME: This is work in progress about moving SetTitle/GetTitle from wxWindow diff --git a/src/cocoa/toplevel.mm b/src/cocoa/toplevel.mm index 4778cc3668..97f32f8387 100644 --- a/src/cocoa/toplevel.mm +++ b/src/cocoa/toplevel.mm @@ -1,7 +1,7 @@ /////////////////////////////////////////////////////////////////////////////// -// Name: cocoa/toplevel.mm +// Name: src/cocoa/toplevel.mm // Purpose: implements wxTopLevelWindow for Cocoa -// Author: David Elliott +// Author: David Elliott // Modified by: // Created: 2002/11/27 // RCS-ID: $Id$ @@ -93,7 +93,7 @@ bool wxTopLevelWindowCocoa::Create(wxWindow *parent, wxTopLevelWindows.Append(this); if(!CreateBase(parent,winid,pos,size,style,wxDefaultValidator,name)) - return FALSE; + return false; if ( parent ) parent->AddChild(this); @@ -105,7 +105,7 @@ bool wxTopLevelWindowCocoa::Create(wxWindow *parent, // Create frame and check and handle default position and size int realx, realy; - + // WX has no set default position - the carbon port caps the low // end at 20, 50. Here we do the same, except instead of setting // it to 20 and 50, we set it to 100 and 100 if the values are too low @@ -113,7 +113,7 @@ bool wxTopLevelWindowCocoa::Create(wxWindow *parent, realx = 100; else realx = pos.x; - + if (pos.y < 50) realy = 100; else @@ -124,7 +124,7 @@ bool wxTopLevelWindowCocoa::Create(wxWindow *parent, // NOTE: y-origin needs to be flipped. NSRect cocoaRect = [NSWindow - contentRectForFrameRect:NSMakeRect(realx,realy,realw,realh) + contentRectForFrameRect:NSMakeRect(realx,realy,realw,realh) styleMask:cocoaStyle]; m_cocoaNSWindow = NULL; @@ -143,7 +143,7 @@ bool wxTopLevelWindowCocoa::Create(wxWindow *parent, if(style & wxSTAY_ON_TOP) [m_cocoaNSWindow setLevel:NSFloatingWindowLevel]; [m_cocoaNSWindow setTitle:wxNSStringWithWxString(title)]; - return TRUE; + return true; } wxTopLevelWindowCocoa::~wxTopLevelWindowCocoa() @@ -211,7 +211,7 @@ void wxTopLevelWindowCocoa::CocoaDelegate_windowDidBecomeKey(void) { DeactivatePendingWindow(); wxLogTrace(wxTRACE_COCOA,wxT("wxTopLevelWindowCocoa=%p::CocoaDelegate_windowDidBecomeKey"),this); - wxActivateEvent event(wxEVT_ACTIVATE, TRUE, GetId()); + wxActivateEvent event(wxEVT_ACTIVATE, true, GetId()); event.SetEventObject(this); GetEventHandler()->ProcessEvent(event); } @@ -219,7 +219,7 @@ void wxTopLevelWindowCocoa::CocoaDelegate_windowDidBecomeKey(void) void wxTopLevelWindowCocoa::CocoaDelegate_windowDidResignKey(void) { wxLogTrace(wxTRACE_COCOA,wxT("wxTopLevelWindowCocoa=%p::CocoaDelegate_windowDidResignKey"),this); - wxActivateEvent event(wxEVT_ACTIVATE, FALSE, GetId()); + wxActivateEvent event(wxEVT_ACTIVATE, false, GetId()); event.SetEventObject(this); GetEventHandler()->ProcessEvent(event); } @@ -264,7 +264,7 @@ void wxTopLevelWindowCocoa::Maximize(bool maximize) bool wxTopLevelWindowCocoa::IsMaximized() const { - return false ; + return false ; } void wxTopLevelWindowCocoa::Iconize(bool iconize) @@ -273,7 +273,7 @@ void wxTopLevelWindowCocoa::Iconize(bool iconize) bool wxTopLevelWindowCocoa::IsIconized() const { - return FALSE; + return false; } void wxTopLevelWindowCocoa::Restore() @@ -330,14 +330,25 @@ void wxTopLevelWindowCocoa::OnCloseWindow(wxCloseEvent& event) // wxTopLevelWindowCocoa misc // ---------------------------------------------------------------------------- +void wxTopLevelWindowCocoa::SetTitle( const wxString& WXUNUSED(title)) +{ + // TODO +} + +wxString wxTopLevelWindowCocoa::GetTitle() const +{ + // TODO + return wxEmptyString; +} + bool wxTopLevelWindowCocoa::ShowFullScreen(bool show, long style) { - return FALSE; + return false; } bool wxTopLevelWindowCocoa::IsFullScreen() const { - return FALSE; + return false; } void wxTopLevelWindowCocoa::CocoaSetWxWindowSize(int width, int height) @@ -383,4 +394,3 @@ void wxTopLevelWindowCocoa::DoGetPosition(int *x, int *y) const *y=(int)cocoaRect.origin.y; wxLogTrace(wxTRACE_COCOA_TopLevelWindow_Size,wxT("wxTopLevelWindow=%p::DoGetPosition = (%d,%d)"),this,(int)cocoaRect.origin.x,(int)cocoaRect.origin.y); } - diff --git a/src/cocoa/window.mm b/src/cocoa/window.mm index 69168f11c4..31fc7b3dad 100644 --- a/src/cocoa/window.mm +++ b/src/cocoa/window.mm @@ -4,9 +4,9 @@ // 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" @@ -308,8 +308,8 @@ void wxWindowCocoa::Init() m_cocoaNSView = NULL; m_cocoaHider = NULL; m_wxCocoaScrollView = NULL; - m_isBeingDeleted = FALSE; - m_isInPaint = FALSE; + m_isBeingDeleted = false; + m_isInPaint = false; m_shouldBeEnabled = true; } @@ -335,7 +335,7 @@ bool wxWindow::Create(wxWindow *parent, wxWindowID winid, SetInitialFrameRect(pos,size); } - return TRUE; + return true; } // Destructor @@ -439,7 +439,7 @@ bool wxWindowCocoa::Cocoa_drawRect(const NSRect &rect) 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 @@ -459,7 +459,7 @@ bool wxWindowCocoa::Cocoa_drawRect(const NSRect &rect) wxPaintEvent event(m_windowId); event.SetEventObject(this); bool ret = GetEventHandler()->ProcessEvent(event); - m_isInPaint = FALSE; + m_isInPaint = false; return ret; } @@ -580,9 +580,9 @@ bool wxWindowCocoa::Cocoa_resetCursorRects() { if(!m_cursor.GetNSCursor()) return false; - - [GetNSView() addCursorRect: [GetNSView() visibleRect] cursor: m_cursor.GetNSCursor()]; - + + [GetNSView() addCursorRect: [GetNSView() visibleRect] cursor: m_cursor.GetNSCursor()]; + return true; } @@ -679,7 +679,7 @@ void wxWindowCocoa::DoSetSize(int x, int y, int width, int height, int sizeFlags AdjustForParentClientOrigin(x,y,sizeFlags); - wxSize size(-1,-1); + wxSize size(wxDefaultSize); if((width==-1)&&!(sizeFlags&wxSIZE_ALLOW_MINUS_ONE)) { @@ -849,7 +849,18 @@ void wxWindow::DoSetClientSize(int width, int height) 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 @@ -933,7 +944,7 @@ void wxWindow::DoSetVirtualSize( int x, int y ) bool wxWindow::SetFont(const wxFont& font) { // TODO - return TRUE; + return true; } static int CocoaRaiseWindowCompareFunction(id first, id second, void *target) @@ -979,7 +990,7 @@ void wxWindow::Lower() bool wxWindow::DoPopupMenu(wxMenu *menu, int x, int y) { - return FALSE; + return false; } // Get the window with the focus @@ -1034,4 +1045,3 @@ wxWindow* wxFindWindowAtPointer(wxPoint& pt) pt = wxGetMousePosition(); return NULL; } -