Import r67258 of the wxWidgets trunk, which I expect will before

long become wxWidgets 2.9.2, which in turn is expected to be the
last 2.9 release before the 3.0 stable release.

Since the full wxWidgets distribution is rather large, I have
imported only the parts that we use, on a subdirectory basis:

art
include/wx/*.*
include/wx/aui
include/wx/cocoa
include/wx/generic
include/wx/gtk
include/wx/meta
include/wx/msw
include/wx/osx
include/wx/persist
include/wx/private
include/wx/protocol
include/wx/unix
src/aui
src/common
src/generic
src/gtk
src/msw
src/osx
src/unix


git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7380 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Soren Jorvang
2011-03-20 18:05:19 +00:00
parent 205637ccc3
commit d14efe561b
1945 changed files with 694474 additions and 0 deletions

View File

@ -0,0 +1,120 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/osx/cocoa/private/markuptoattr.h
// Purpose: Class to convert markup to Cocoa attributed strings.
// Author: Vadim Zeitlin
// Created: 2011-02-22
// RCS-ID: $Id: markuptoattr.h 67069 2011-02-27 12:48:46Z VZ $
// Copyright: (c) 2011 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_OSX_COCOA_PRIVATE_MARKUPTOATTR_H_
#define _WX_OSX_COCOA_PRIVATE_MARKUPTOATTR_H_
#include "wx/private/markupparserattr.h"
// ----------------------------------------------------------------------------
// wxMarkupToAttrString: create NSAttributedString from markup.
// ----------------------------------------------------------------------------
class wxMarkupToAttrString : public wxMarkupParserAttrOutput
{
public:
// We don't care about the original colours because we never use them but
// we do need the correct initial font as we apply modifiers (e.g. create a
// font larger than it) to it and so it must be valid.
wxMarkupToAttrString(wxWindow *win, const wxString& markup)
: wxMarkupParserAttrOutput(win->GetFont(), wxColour(), wxColour())
{
const wxCFStringRef
label(wxControl::RemoveMnemonics(wxMarkupParser::Strip(markup)));
m_attrString = [[NSMutableAttributedString alloc]
initWithString: label.AsNSString()];
m_pos = 0;
[m_attrString beginEditing];
// First thing we do is change the default string font: as mentioned in
// Apple documentation, attributed strings use "Helvetica 12" font by
// default which is different from the system "Lucida Grande" font. So
// we need to explicitly change the font for the entire string.
[m_attrString addAttribute:NSFontAttributeName
value:win->GetFont().OSXGetNSFont()
range:NSMakeRange(0, [m_attrString length])];
// Now translate the markup tags to corresponding attributes.
wxMarkupParser parser(*this);
parser.Parse(markup);
[m_attrString endEditing];
}
~wxMarkupToAttrString()
{
[m_attrString release];
}
// Accessor for the users of this class.
//
// We keep ownership of the returned string.
NSMutableAttributedString *GetNSAttributedString() const
{
return m_attrString;
}
// Implement base class pure virtual methods to process markup tags.
virtual void OnText(const wxString& text)
{
m_pos += wxControl::RemoveMnemonics(text).length();
}
virtual void OnAttrStart(const Attr& WXUNUSED(attr))
{
// Just remember the starting position of the range, we can't really
// set the attribute until we find the end of it.
m_rangeStarts.push(m_pos);
}
virtual void OnAttrEnd(const Attr& attr)
{
unsigned start = m_rangeStarts.top();
m_rangeStarts.pop();
const NSRange range = NSMakeRange(start, m_pos - start);
[m_attrString addAttribute:NSFontAttributeName
value:attr.font.OSXGetNSFont()
range:range];
if ( attr.foreground.IsOk() )
{
[m_attrString addAttribute:NSForegroundColorAttributeName
value:attr.foreground.OSXGetNSColor()
range:range];
}
if ( attr.background.IsOk() )
{
[m_attrString addAttribute:NSBackgroundColorAttributeName
value:attr.background.OSXGetNSColor()
range:range];
}
}
private:
// The attributed string we're building.
NSMutableAttributedString *m_attrString;
// The current position in the output string.
unsigned m_pos;
// The positions of starting ranges.
wxStack<unsigned> m_rangeStarts;
wxDECLARE_NO_COPY_CLASS(wxMarkupToAttrString);
};
#endif // _WX_OSX_COCOA_PRIVATE_MARKUPTOATTR_H_

View File

@ -0,0 +1,56 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/osx/cocoa/private/overlay.h
// Purpose: wxOverlayImpl declaration
// Author: Stefan Csomor
// Modified by:
// Created: 2006-10-20
// RCS-ID: $Id: overlay.h 67232 2011-03-18 15:10:15Z DS $
// Copyright: (c) wxWidgets team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_OSX_COCOA_PRIVATE_OVERLAY_H_
#define _WX_OSX_COCOA_PRIVATE_OVERLAY_H_
#include "wx/osx/private.h"
#include "wx/toplevel.h"
#include "wx/graphics.h"
class wxOverlayImpl
{
public:
wxOverlayImpl() ;
~wxOverlayImpl() ;
// clears the overlay without restoring the former state
// to be done eg when the window content has been changed and repainted
void Reset();
// returns true if it has been setup
bool IsOk();
void Init( wxDC* dc, int x , int y , int width , int height );
void BeginDrawing( wxDC* dc);
void EndDrawing( wxDC* dc);
void Clear( wxDC* dc);
private:
void CreateOverlayWindow();
WXWindow m_overlayWindow;
WXWindow m_overlayParentWindow;
CGContextRef m_overlayContext ;
// we store the window in case we would have to issue a Refresh()
wxWindow* m_window ;
int m_x ;
int m_y ;
int m_width ;
int m_height ;
} ;
#endif // _WX_MAC_CARBON_PRIVATE_OVERLAY_H_

View File

@ -0,0 +1,112 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/osx/cocoa/private/textimpl.h
// Purpose: textcontrol implementation classes that have to be exposed
// Author: Stefan Csomor
// Modified by:
// Created: 03/02/99
// RCS-ID: $Id: textimpl.h 67254 2011-03-20 00:14:35Z DS $
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_OSX_COCOA_PRIVATE_TEXTIMPL_H_
#define _WX_OSX_COCOA_PRIVATE_TEXTIMPL_H_
#include "wx/combobox.h"
#include "wx/osx/private.h"
// implementation exposed, so that search control can pull it
class wxNSTextFieldControl : public wxWidgetCocoaImpl, public wxTextWidgetImpl
{
public :
// wxNSTextFieldControl must always be associated with a wxTextEntry. If
// it's associated with a wxTextCtrl then we can get the associated entry
// from it but otherwise the second ctor should be used to explicitly pass
// us the entry.
wxNSTextFieldControl( wxTextCtrl *text, WXWidget w );
wxNSTextFieldControl( wxWindow *wxPeer, wxTextEntry *entry, WXWidget w );
virtual ~wxNSTextFieldControl();
virtual wxString GetStringValue() const ;
virtual void SetStringValue( const wxString &str) ;
virtual void Copy() ;
virtual void Cut() ;
virtual void Paste() ;
virtual bool CanPaste() const ;
virtual void SetEditable(bool editable) ;
virtual void GetSelection( long* from, long* to) const ;
virtual void SetSelection( long from , long to );
virtual void WriteText(const wxString& str) ;
virtual bool HasOwnContextMenu() const { return true; }
virtual bool SetHint(const wxString& hint);
virtual void controlAction(WXWidget slf, void* _cmd, void *sender);
protected :
NSTextField* m_textField;
long m_selStart;
long m_selEnd;
private:
// Common part of both ctors.
void Init(WXWidget w);
};
class wxNSTextViewControl : public wxWidgetCocoaImpl, public wxTextWidgetImpl
{
public:
wxNSTextViewControl( wxTextCtrl *wxPeer, WXWidget w );
virtual ~wxNSTextViewControl();
virtual wxString GetStringValue() const ;
virtual void SetStringValue( const wxString &str) ;
virtual void Copy() ;
virtual void Cut() ;
virtual void Paste() ;
virtual bool CanPaste() const ;
virtual void SetEditable(bool editable) ;
virtual void GetSelection( long* from, long* to) const ;
virtual void SetSelection( long from , long to );
virtual void WriteText(const wxString& str) ;
virtual void SetFont( const wxFont & font , const wxColour& foreground , long windowStyle, bool ignoreBlack = true );
virtual bool GetStyle(long position, wxTextAttr& style);
virtual void SetStyle(long start, long end, const wxTextAttr& style);
virtual bool CanFocus() const;
virtual bool HasOwnContextMenu() const { return true; }
virtual void CheckSpelling(bool check);
virtual wxSize GetBestSize() const;
protected:
NSScrollView* m_scrollView;
NSTextView* m_textView;
};
class wxNSComboBoxControl : public wxNSTextFieldControl, public wxComboWidgetImpl
{
public :
wxNSComboBoxControl( wxComboBox *wxPeer, WXWidget w );
virtual ~wxNSComboBoxControl();
virtual int GetSelectedItem() const;
virtual void SetSelectedItem(int item);
virtual int GetNumberOfItems() const;
virtual void InsertItem(int pos, const wxString& item);
virtual void RemoveItem(int pos);
virtual void Clear();
virtual wxString GetStringAtIndex(int pos) const;
virtual int FindString(const wxString& text) const;
private:
NSComboBox* m_comboBox;
};
#endif // _WX_OSX_COCOA_PRIVATE_TEXTIMPL_H_