Tidied space and tabs in wxMac files
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19397 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_GAUGE_H_
|
#ifndef _WX_GAUGE_H_
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_GDIOBJ_H_
|
#ifndef _WX_GDIOBJ_H_
|
||||||
@@ -21,8 +21,8 @@
|
|||||||
class WXDLLEXPORT wxGDIRefData: public wxObjectRefData {
|
class WXDLLEXPORT wxGDIRefData: public wxObjectRefData {
|
||||||
public:
|
public:
|
||||||
inline wxGDIRefData()
|
inline wxGDIRefData()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#define M_GDIDATA ((wxGDIRefData *)m_refData)
|
#define M_GDIDATA ((wxGDIRefData *)m_refData)
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#if defined(__GNUG__) && !defined(__APPLE__)
|
#if defined(__GNUG__) && !defined(__APPLE__)
|
||||||
@@ -92,17 +92,17 @@ class WXDLLEXPORT wxGLCanvas: public wxWindow
|
|||||||
wxGLCanvas( wxWindow *parent, const wxGLContext *shared = (wxGLContext *)NULL,
|
wxGLCanvas( wxWindow *parent, const wxGLContext *shared = (wxGLContext *)NULL,
|
||||||
wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition,
|
wxWindowID id = -1, const wxPoint& pos = wxDefaultPosition,
|
||||||
const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = "GLCanvas",
|
const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = "GLCanvas",
|
||||||
int *attribList = (int*) NULL, const wxPalette& palette = wxNullPalette );
|
int *attribList = (int*) NULL, const wxPalette& palette = wxNullPalette );
|
||||||
|
|
||||||
wxGLCanvas( wxWindow *parent, const wxGLCanvas *shared = (wxGLCanvas *)NULL, wxWindowID id = -1,
|
wxGLCanvas( wxWindow *parent, const wxGLCanvas *shared = (wxGLCanvas *)NULL, wxWindowID id = -1,
|
||||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0,
|
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0,
|
||||||
const wxString& name = "GLCanvas", int *attribList = 0, const wxPalette& palette = wxNullPalette );
|
const wxString& name = "GLCanvas", int *attribList = 0, const wxPalette& palette = wxNullPalette );
|
||||||
|
|
||||||
~wxGLCanvas();
|
~wxGLCanvas();
|
||||||
|
|
||||||
bool Create(wxWindow *parent, const wxGLContext *shared, wxWindowID id,
|
bool Create(wxWindow *parent, const wxGLContext *shared, wxWindowID id,
|
||||||
const wxPoint& pos, const wxSize& size, long style, const wxString& name,
|
const wxPoint& pos, const wxSize& size, long style, const wxString& name,
|
||||||
int *attribList, const wxPalette& palette);
|
int *attribList, const wxPalette& palette);
|
||||||
|
|
||||||
void SetCurrent();
|
void SetCurrent();
|
||||||
void SetColour(const char *colour);
|
void SetColour(const char *colour);
|
||||||
@@ -115,9 +115,9 @@ class WXDLLEXPORT wxGLCanvas: public wxWindow
|
|||||||
// You shouldn't call glViewport yourself either (use SetViewport if you must reset it.)
|
// You shouldn't call glViewport yourself either (use SetViewport if you must reset it.)
|
||||||
void OnSize(wxSizeEvent& event);
|
void OnSize(wxSizeEvent& event);
|
||||||
|
|
||||||
virtual void MacSuperChangedPosition() ;
|
virtual void MacSuperChangedPosition() ;
|
||||||
virtual void MacTopLevelWindowChangedPosition() ;
|
virtual void MacTopLevelWindowChangedPosition() ;
|
||||||
void MacUpdateView() ;
|
void MacUpdateView() ;
|
||||||
|
|
||||||
inline wxGLContext* GetContext() const { return m_glContext; }
|
inline wxGLContext* GetContext() const { return m_glContext; }
|
||||||
|
|
||||||
|
|||||||
@@ -54,8 +54,8 @@ struct _GSocket
|
|||||||
|
|
||||||
struct _GAddress
|
struct _GAddress
|
||||||
{
|
{
|
||||||
UInt32 m_host ;
|
UInt32 m_host ;
|
||||||
UInt16 m_port ;
|
UInt16 m_port ;
|
||||||
GAddressType m_family;
|
GAddressType m_family;
|
||||||
GSocketError m_error;
|
GSocketError m_error;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_HELPXXXX_H_
|
#ifndef _WX_HELPXXXX_H_
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_ICON_H_
|
#ifndef _WX_ICON_H_
|
||||||
@@ -41,7 +41,7 @@ public:
|
|||||||
bool LoadFile(const wxString& name, wxBitmapType flags /* = wxBITMAP_TYPE_ICON_RESOURCE */ ,
|
bool LoadFile(const wxString& name, wxBitmapType flags /* = wxBITMAP_TYPE_ICON_RESOURCE */ ,
|
||||||
int desiredWidth /* = -1 */ , int desiredHeight = -1);
|
int desiredWidth /* = -1 */ , int desiredHeight = -1);
|
||||||
bool LoadFile(const wxString& name ,wxBitmapType flags = wxBITMAP_TYPE_ICON_RESOURCE )
|
bool LoadFile(const wxString& name ,wxBitmapType flags = wxBITMAP_TYPE_ICON_RESOURCE )
|
||||||
{ return LoadFile( name , flags , -1 , -1 ) ; }
|
{ return LoadFile( name , flags , -1 , -1 ) ; }
|
||||||
|
|
||||||
inline wxIcon& operator = (const wxIcon& icon) { if (*this == icon) return (*this); Ref(icon); return *this; }
|
inline wxIcon& operator = (const wxIcon& icon) { if (*this == icon) return (*this); Ref(icon); return *this; }
|
||||||
inline bool operator == (const wxIcon& icon) { return m_refData == icon.m_refData; }
|
inline bool operator == (const wxIcon& icon) { return m_refData == icon.m_refData; }
|
||||||
@@ -60,9 +60,9 @@ class WXDLLEXPORT wxICONFileHandler: public wxBitmapHandler
|
|||||||
public:
|
public:
|
||||||
inline wxICONFileHandler()
|
inline wxICONFileHandler()
|
||||||
{
|
{
|
||||||
m_name = "ICO icon file";
|
m_name = "ICO icon file";
|
||||||
m_extension = "ico";
|
m_extension = "ico";
|
||||||
m_type = wxBITMAP_TYPE_ICO;
|
m_type = wxBITMAP_TYPE_ICO;
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
|
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
|
||||||
@@ -76,9 +76,9 @@ class WXDLLEXPORT wxICONResourceHandler: public wxBitmapHandler
|
|||||||
public:
|
public:
|
||||||
inline wxICONResourceHandler()
|
inline wxICONResourceHandler()
|
||||||
{
|
{
|
||||||
m_name = "ICON resource";
|
m_name = "ICON resource";
|
||||||
m_extension = "";
|
m_extension = "";
|
||||||
m_type = wxBITMAP_TYPE_ICON_RESOURCE;
|
m_type = wxBITMAP_TYPE_ICON_RESOURCE;
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
|
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_IMAGLIST_H_
|
#ifndef _WX_IMAGLIST_H_
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_JOYSTICK_H_
|
#ifndef _WX_JOYSTICK_H_
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ public:
|
|||||||
virtual void* DoGetItemClientData(int n) const;
|
virtual void* DoGetItemClientData(int n) const;
|
||||||
virtual void DoSetItemClientObject(int n, wxClientData* clientData);
|
virtual void DoSetItemClientObject(int n, wxClientData* clientData);
|
||||||
virtual wxClientData* DoGetItemClientObject(int n) const;
|
virtual wxClientData* DoGetItemClientObject(int n) const;
|
||||||
virtual void DoSetSize(int x, int y,int width, int height,int sizeFlags = wxSIZE_AUTO ) ;
|
virtual void DoSetSize(int x, int y,int width, int height,int sizeFlags = wxSIZE_AUTO ) ;
|
||||||
|
|
||||||
// wxCheckListBox support
|
// wxCheckListBox support
|
||||||
#if wxUSE_OWNER_DRAWN
|
#if wxUSE_OWNER_DRAWN
|
||||||
@@ -112,7 +112,7 @@ public:
|
|||||||
|
|
||||||
virtual void SetupColours();
|
virtual void SetupColours();
|
||||||
virtual void MacHandleControlClick( WXWidget control , wxInt16 controlpart ) ;
|
virtual void MacHandleControlClick( WXWidget control , wxInt16 controlpart ) ;
|
||||||
virtual bool MacCanFocus() const { return true ; }
|
virtual bool MacCanFocus() const { return true ; }
|
||||||
void OnChar(wxKeyEvent& event);
|
void OnChar(wxKeyEvent& event);
|
||||||
|
|
||||||
void* m_macList ;
|
void* m_macList ;
|
||||||
@@ -145,8 +145,8 @@ protected:
|
|||||||
|
|
||||||
int m_noItems;
|
int m_noItems;
|
||||||
int m_selected;
|
int m_selected;
|
||||||
wxString m_typeIn ;
|
wxString m_typeIn ;
|
||||||
long m_lastTypeIn ;
|
long m_lastTypeIn ;
|
||||||
|
|
||||||
virtual wxSize DoGetBestSize() const;
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_LISTCTRL_H_
|
#ifndef _WX_LISTCTRL_H_
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_MDI_H_
|
#ifndef _WX_MDI_H_
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_MENU_H_
|
#ifndef _WX_MENU_H_
|
||||||
@@ -57,9 +57,9 @@ public:
|
|||||||
// implementation only from now on
|
// implementation only from now on
|
||||||
// -------------------------------
|
// -------------------------------
|
||||||
|
|
||||||
int MacGetIndexFromId( int id ) ;
|
int MacGetIndexFromId( int id ) ;
|
||||||
int MacGetIndexFromItem( wxMenuItem *pItem ) ;
|
int MacGetIndexFromItem( wxMenuItem *pItem ) ;
|
||||||
void MacEnableMenu( bool bDoEnable ) ;
|
void MacEnableMenu( bool bDoEnable ) ;
|
||||||
|
|
||||||
// semi-private accessors
|
// semi-private accessors
|
||||||
// get the window which contains this menu
|
// get the window which contains this menu
|
||||||
@@ -67,7 +67,7 @@ public:
|
|||||||
// get the menu handle
|
// get the menu handle
|
||||||
WXHMENU GetHMenu() const { return m_hMenu; }
|
WXHMENU GetHMenu() const { return m_hMenu; }
|
||||||
|
|
||||||
short MacGetMenuId() { return m_macMenuId ; }
|
short MacGetMenuId() { return m_macMenuId ; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// common part of all ctors
|
// common part of all ctors
|
||||||
@@ -88,9 +88,9 @@ private:
|
|||||||
// the menu handle of this menu
|
// the menu handle of this menu
|
||||||
WXHMENU m_hMenu;
|
WXHMENU m_hMenu;
|
||||||
|
|
||||||
short m_macMenuId;
|
short m_macMenuId;
|
||||||
|
|
||||||
static short s_macNextMenuId ;
|
static short s_macNextMenuId ;
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxMenu)
|
DECLARE_DYNAMIC_CLASS(wxMenu)
|
||||||
};
|
};
|
||||||
@@ -146,11 +146,11 @@ public:
|
|||||||
// attach to a frame
|
// attach to a frame
|
||||||
void Attach(wxFrame *frame);
|
void Attach(wxFrame *frame);
|
||||||
|
|
||||||
// clear the invoking window for all menus and submenus
|
// clear the invoking window for all menus and submenus
|
||||||
void UnsetInvokingWindow() ;
|
void UnsetInvokingWindow() ;
|
||||||
|
|
||||||
// set the invoking window for all menus and submenus
|
// set the invoking window for all menus and submenus
|
||||||
void SetInvokingWindow( wxFrame* frame ) ;
|
void SetInvokingWindow( wxFrame* frame ) ;
|
||||||
|
|
||||||
// if the menubar is modified, the display is not updated automatically,
|
// if the menubar is modified, the display is not updated automatically,
|
||||||
// call this function to update it (m_menuBarFrame should be !NULL)
|
// call this function to update it (m_menuBarFrame should be !NULL)
|
||||||
@@ -171,7 +171,7 @@ protected:
|
|||||||
wxArrayString m_titles;
|
wxArrayString m_titles;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static wxMenuBar* s_macInstalledMenuBar ;
|
static wxMenuBar* s_macInstalledMenuBar ;
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxMenuBar)
|
DECLARE_DYNAMIC_CLASS(wxMenuBar)
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -46,10 +46,10 @@ public:
|
|||||||
virtual void SetBitmap(const wxBitmap& bitmap) ;
|
virtual void SetBitmap(const wxBitmap& bitmap) ;
|
||||||
virtual const wxBitmap& GetBitmap() const { return m_bitmap; }
|
virtual const wxBitmap& GetBitmap() const { return m_bitmap; }
|
||||||
|
|
||||||
// update the os specific representation
|
// update the os specific representation
|
||||||
void UpdateItemBitmap() ;
|
void UpdateItemBitmap() ;
|
||||||
void UpdateItemText() ;
|
void UpdateItemText() ;
|
||||||
void UpdateItemStatus() ;
|
void UpdateItemStatus() ;
|
||||||
|
|
||||||
// mark item as belonging to the given radio group
|
// mark item as belonging to the given radio group
|
||||||
void SetAsRadioGroupStart();
|
void SetAsRadioGroupStart();
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ public:
|
|||||||
// the first extension found, index 1 for the second and so on
|
// the first extension found, index 1 for the second and so on
|
||||||
|
|
||||||
void Init(wxMimeTypesManagerImpl *manager, size_t index)
|
void Init(wxMimeTypesManagerImpl *manager, size_t index)
|
||||||
{ m_manager = manager; m_index.Add(index); }
|
{ m_manager = manager; m_index.Add(index); }
|
||||||
|
|
||||||
// initialize us with our file type name
|
// initialize us with our file type name
|
||||||
void SetFileType(const wxString& strFileType)
|
void SetFileType(const wxString& strFileType)
|
||||||
@@ -98,9 +98,9 @@ public:
|
|||||||
// remove the record for this file type
|
// remove the record for this file type
|
||||||
// probably a mistake to come here, use wxMimeTypesManager.Unassociate (ft) instead
|
// probably a mistake to come here, use wxMimeTypesManager.Unassociate (ft) instead
|
||||||
bool Unassociate(wxFileType *ft)
|
bool Unassociate(wxFileType *ft)
|
||||||
{
|
{
|
||||||
return m_manager->Unassociate(ft);
|
return m_manager->Unassociate(ft);
|
||||||
}
|
}
|
||||||
|
|
||||||
// set an arbitrary command, ask confirmation if it already exists and
|
// set an arbitrary command, ask confirmation if it already exists and
|
||||||
// overwriteprompt is TRUE
|
// overwriteprompt is TRUE
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_MINIFRAM_H_
|
#ifndef _WX_MINIFRAM_H_
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_MSGBOXDLG_H_
|
#ifndef _WX_MSGBOXDLG_H_
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
// Modified by:
|
// Modified by:
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_NOTEBOOK_H_
|
#ifndef _WX_NOTEBOOK_H_
|
||||||
@@ -135,7 +135,7 @@ public:
|
|||||||
virtual void Command(wxCommandEvent& event);
|
virtual void Command(wxCommandEvent& event);
|
||||||
protected:
|
protected:
|
||||||
virtual wxNotebookPage *DoRemovePage(int page) ;
|
virtual wxNotebookPage *DoRemovePage(int page) ;
|
||||||
virtual void MacHandleControlClick( WXWidget control , wxInt16 controlpart ) ;
|
virtual void MacHandleControlClick( WXWidget control , wxInt16 controlpart ) ;
|
||||||
// common part of all ctors
|
// common part of all ctors
|
||||||
void Init();
|
void Init();
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_PALETTE_H_
|
#ifndef _WX_PALETTE_H_
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_PEN_H_
|
#ifndef _WX_PEN_H_
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Microsoft, Julian Smart
|
// Copyright: (c) Microsoft, Julian Smart
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#if defined(__GNUG__) && !defined(__APPLE__)
|
#if defined(__GNUG__) && !defined(__APPLE__)
|
||||||
@@ -22,9 +22,9 @@ class WXDLLEXPORT wxPNGFileHandler: public wxBitmapHandler
|
|||||||
public:
|
public:
|
||||||
inline wxPNGFileHandler(void)
|
inline wxPNGFileHandler(void)
|
||||||
{
|
{
|
||||||
m_name = "PNG bitmap file";
|
m_name = "PNG bitmap file";
|
||||||
m_extension = "bmp";
|
m_extension = "bmp";
|
||||||
m_type = wxBITMAP_TYPE_PNG;
|
m_type = wxBITMAP_TYPE_PNG;
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
|
virtual bool LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* File: pngread.h
|
* File: pngread.h
|
||||||
* Purpose: PNG file reader
|
* Purpose: PNG file reader
|
||||||
* Author: Alejandro Aguilar Sierra/Julian Smart
|
* Author: Alejandro Aguilar Sierra/Julian Smart
|
||||||
* Created: 1995
|
* Created: 1995
|
||||||
* Copyright: (c) 1995, Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
|
* Copyright: (c) 1995, Alejandro Aguilar Sierra <asierra@servidor.unam.mx>
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
@@ -25,30 +25,30 @@ typedef byte * ImagePointerType;
|
|||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
byte red;
|
byte red;
|
||||||
byte green;
|
byte green;
|
||||||
byte blue;
|
byte blue;
|
||||||
} rgb_color_struct;
|
} rgb_color_struct;
|
||||||
|
|
||||||
|
|
||||||
#define COLORTYPE_PALETTE 1
|
#define COLORTYPE_PALETTE 1
|
||||||
#define COLORTYPE_COLOR 2
|
#define COLORTYPE_COLOR 2
|
||||||
#define COLORTYPE_ALPHA 4
|
#define COLORTYPE_ALPHA 4
|
||||||
|
|
||||||
class wxPNGReader
|
class wxPNGReader
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
int filetype;
|
int filetype;
|
||||||
char filename[255];
|
char filename[255];
|
||||||
ImagePointerType RawImage; // Image data
|
ImagePointerType RawImage; // Image data
|
||||||
|
|
||||||
int Width, Height; // Dimensions
|
int Width, Height; // Dimensions
|
||||||
int Depth; // (bits x pixel)
|
int Depth; // (bits x pixel)
|
||||||
int ColorType; // Bit 1 = Palette used
|
int ColorType; // Bit 1 = Palette used
|
||||||
// Bit 2 = Color used
|
// Bit 2 = Color used
|
||||||
// Bit 3 = Alpha used
|
// Bit 3 = Alpha used
|
||||||
|
|
||||||
long EfeWidth; // Efective Width
|
long EfeWidth; // Efective Width
|
||||||
|
|
||||||
void *lpbi;
|
void *lpbi;
|
||||||
int bgindex;
|
int bgindex;
|
||||||
@@ -98,9 +98,9 @@ public:
|
|||||||
class wxPNGReaderIter
|
class wxPNGReaderIter
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
int Itx, Ity; // Counters
|
int Itx, Ity; // Counters
|
||||||
int Stepx, Stepy;
|
int Stepx, Stepy;
|
||||||
ImagePointerType IterImage; // Image pointer
|
ImagePointerType IterImage; // Image pointer
|
||||||
wxPNGReader *ima;
|
wxPNGReader *ima;
|
||||||
public:
|
public:
|
||||||
// Constructors
|
// Constructors
|
||||||
@@ -146,7 +146,7 @@ inline
|
|||||||
wxPNGReaderIter::wxPNGReaderIter(wxPNGReader *imax): ima(imax)
|
wxPNGReaderIter::wxPNGReaderIter(wxPNGReader *imax): ima(imax)
|
||||||
{
|
{
|
||||||
if (ima)
|
if (ima)
|
||||||
IterImage = ima->RawImage;
|
IterImage = ima->RawImage;
|
||||||
Itx = Ity = 0;
|
Itx = Ity = 0;
|
||||||
Stepx = Stepy = 0;
|
Stepx = Stepy = 0;
|
||||||
}
|
}
|
||||||
@@ -161,9 +161,9 @@ inline
|
|||||||
bool wxPNGReaderIter::ItOK ()
|
bool wxPNGReaderIter::ItOK ()
|
||||||
{
|
{
|
||||||
if (ima)
|
if (ima)
|
||||||
return ima->Inside(Itx, Ity);
|
return ima->Inside(Itx, Ity);
|
||||||
else
|
else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -209,7 +209,7 @@ inline void wxPNGReaderIter::SetRow(byte *buf, int n)
|
|||||||
// Here should be bcopy or memcpy
|
// Here should be bcopy or memcpy
|
||||||
//_fmemcpy(IterImage, (void far *)buf, n);
|
//_fmemcpy(IterImage, (void far *)buf, n);
|
||||||
if (n<0)
|
if (n<0)
|
||||||
n = ima->GetWidth();
|
n = ima->GetWidth();
|
||||||
|
|
||||||
for (int i=0; i<n; i++) IterImage[i] = buf[i];
|
for (int i=0; i<n; i++) IterImage[i] = buf[i];
|
||||||
}
|
}
|
||||||
@@ -227,45 +227,45 @@ inline ImagePointerType wxPNGReaderIter::GetRow()
|
|||||||
inline bool wxPNGReaderIter::NextByte()
|
inline bool wxPNGReaderIter::NextByte()
|
||||||
{
|
{
|
||||||
if (++Itx < ima->EfeWidth)
|
if (++Itx < ima->EfeWidth)
|
||||||
return 1;
|
return 1;
|
||||||
else
|
else
|
||||||
if (++Ity < ima->Height)
|
if (++Ity < ima->Height)
|
||||||
{
|
{
|
||||||
IterImage += ima->EfeWidth;
|
IterImage += ima->EfeWidth;
|
||||||
Itx = 0;
|
Itx = 0;
|
||||||
return 1;
|
return 1;
|
||||||
} else
|
} else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool wxPNGReaderIter::PrevByte()
|
inline bool wxPNGReaderIter::PrevByte()
|
||||||
{
|
{
|
||||||
if (--Itx >= 0)
|
if (--Itx >= 0)
|
||||||
return 1;
|
return 1;
|
||||||
else
|
else
|
||||||
if (--Ity >= 0)
|
if (--Ity >= 0)
|
||||||
{
|
{
|
||||||
IterImage -= ima->EfeWidth;
|
IterImage -= ima->EfeWidth;
|
||||||
Itx = 0;
|
Itx = 0;
|
||||||
return 1;
|
return 1;
|
||||||
} else
|
} else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool wxPNGReaderIter::NextStep()
|
inline bool wxPNGReaderIter::NextStep()
|
||||||
{
|
{
|
||||||
Itx += Stepx;
|
Itx += Stepx;
|
||||||
if (Itx < ima->EfeWidth)
|
if (Itx < ima->EfeWidth)
|
||||||
return 1;
|
return 1;
|
||||||
else {
|
else {
|
||||||
Ity += Stepy;
|
Ity += Stepy;
|
||||||
if (Ity < ima->Height)
|
if (Ity < ima->Height)
|
||||||
{
|
{
|
||||||
IterImage += ima->EfeWidth;
|
IterImage += ima->EfeWidth;
|
||||||
Itx = 0;
|
Itx = 0;
|
||||||
return 1;
|
return 1;
|
||||||
} else
|
} else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -273,16 +273,16 @@ inline bool wxPNGReaderIter::PrevStep()
|
|||||||
{
|
{
|
||||||
Itx -= Stepx;
|
Itx -= Stepx;
|
||||||
if (Itx >= 0)
|
if (Itx >= 0)
|
||||||
return 1;
|
return 1;
|
||||||
else {
|
else {
|
||||||
Ity -= Stepy;
|
Ity -= Stepy;
|
||||||
if (Ity >= 0 && Ity < ima->Height)
|
if (Ity >= 0 && Ity < ima->Height)
|
||||||
{
|
{
|
||||||
IterImage -= ima->EfeWidth;
|
IterImage -= ima->EfeWidth;
|
||||||
Itx = 0;
|
Itx = 0;
|
||||||
return 1;
|
return 1;
|
||||||
} else
|
} else
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_PRINT_H_
|
#ifndef _WX_PRINT_H_
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_PRINTDLG_H_
|
#ifndef _WX_PRINTDLG_H_
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 01/02/97
|
// Created: 01/02/97
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart
|
// Copyright: (c) Julian Smart
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_PRINTWIN_H_
|
#ifndef _WX_PRINTWIN_H_
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_PRIVATE_H_
|
#ifndef _WX_PRIVATE_H_
|
||||||
@@ -50,14 +50,14 @@ public:
|
|||||||
GrafPtr GetCurrentPort() { return m_currentPort ; }
|
GrafPtr GetCurrentPort() { return m_currentPort ; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GrafPtr m_currentPort ;
|
GrafPtr m_currentPort ;
|
||||||
GrafPtr m_oldPort ;
|
GrafPtr m_oldPort ;
|
||||||
RgnHandle m_clip ;
|
RgnHandle m_clip ;
|
||||||
ThemeDrawingState m_drawingState ;
|
ThemeDrawingState m_drawingState ;
|
||||||
short m_textFont ;
|
short m_textFont ;
|
||||||
short m_textSize ;
|
short m_textSize ;
|
||||||
short m_textStyle ;
|
short m_textStyle ;
|
||||||
short m_textMode ;
|
short m_textMode ;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
class WXDLLEXPORT wxMacPortSetter
|
class WXDLLEXPORT wxMacPortSetter
|
||||||
@@ -123,12 +123,12 @@ WXDLLEXPORT wxString wxMacFindFolder(short vRefNum,
|
|||||||
OSType folderType,
|
OSType folderType,
|
||||||
Boolean createFolder);
|
Boolean createFolder);
|
||||||
|
|
||||||
GWorldPtr wxMacCreateGWorld( int width , int height , int depth ) ;
|
GWorldPtr wxMacCreateGWorld( int width , int height , int depth ) ;
|
||||||
void wxMacDestroyGWorld( GWorldPtr gw ) ;
|
void wxMacDestroyGWorld( GWorldPtr gw ) ;
|
||||||
PicHandle wxMacCreatePict( GWorldPtr gw , GWorldPtr mask = NULL ) ;
|
PicHandle wxMacCreatePict( GWorldPtr gw , GWorldPtr mask = NULL ) ;
|
||||||
CIconHandle wxMacCreateCIcon(GWorldPtr image , GWorldPtr mask , short dstDepth , short iconSize ) ;
|
CIconHandle wxMacCreateCIcon(GWorldPtr image , GWorldPtr mask , short dstDepth , short iconSize ) ;
|
||||||
void wxMacSetColorTableEntry( CTabHandle newColors , int index , int red , int green , int blue ) ;
|
void wxMacSetColorTableEntry( CTabHandle newColors , int index , int red , int green , int blue ) ;
|
||||||
CTabHandle wxMacCreateColorTable( int numColors ) ;
|
CTabHandle wxMacCreateColorTable( int numColors ) ;
|
||||||
void wxMacCreateBitmapButton( ControlButtonContentInfo*info , const wxBitmap& bitmap , int forceType = 0 ) ;
|
void wxMacCreateBitmapButton( ControlButtonContentInfo*info , const wxBitmap& bitmap , int forceType = 0 ) ;
|
||||||
|
|
||||||
#define MAC_WXCOLORREF(a) (*((RGBColor*)&(a)))
|
#define MAC_WXCOLORREF(a) (*((RGBColor*)&(a)))
|
||||||
@@ -165,7 +165,7 @@ inline wxString wxMacMakeStringFromMacString( const char* from )
|
|||||||
// converts this c string into a wxString with pc 2 mac encoding if s_macDefaultEncodingIsPC
|
// converts this c string into a wxString with pc 2 mac encoding if s_macDefaultEncodingIsPC
|
||||||
inline wxString wxMacMakeStringFromMacString( const wxString& from )
|
inline wxString wxMacMakeStringFromMacString( const wxString& from )
|
||||||
{ return wxApp::s_macDefaultEncodingIsPC ?
|
{ return wxApp::s_macDefaultEncodingIsPC ?
|
||||||
wxMacMakeStringFromMacString( from.c_str() , true ) : from ; }
|
wxMacMakeStringFromMacString( from.c_str() , true ) : from ; }
|
||||||
|
|
||||||
//
|
//
|
||||||
// Pascal Strings
|
// Pascal Strings
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_RADIOBOX_H_
|
#ifndef _WX_RADIOBOX_H_
|
||||||
@@ -23,65 +23,65 @@ class WXDLLEXPORT wxRadioButton ;
|
|||||||
|
|
||||||
class WXDLLEXPORT wxRadioBox: public wxControl, public wxRadioBoxBase
|
class WXDLLEXPORT wxRadioBox: public wxControl, public wxRadioBoxBase
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxRadioBox)
|
DECLARE_DYNAMIC_CLASS(wxRadioBox)
|
||||||
public:
|
public:
|
||||||
// Constructors & destructor
|
// Constructors & destructor
|
||||||
wxRadioBox();
|
wxRadioBox();
|
||||||
inline wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title,
|
inline wxRadioBox(wxWindow *parent, wxWindowID id, const wxString& title,
|
||||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||||
int n = 0, const wxString choices[] = NULL,
|
int n = 0, const wxString choices[] = NULL,
|
||||||
int majorDim = 0, long style = wxRA_HORIZONTAL,
|
int majorDim = 0, long style = wxRA_HORIZONTAL,
|
||||||
const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr)
|
const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr)
|
||||||
{
|
{
|
||||||
Create(parent, id, title, pos, size, n, choices, majorDim, style, val, name);
|
Create(parent, id, title, pos, size, n, choices, majorDim, style, val, name);
|
||||||
}
|
}
|
||||||
~wxRadioBox();
|
~wxRadioBox();
|
||||||
bool Create(wxWindow *parent, wxWindowID id, const wxString& title,
|
bool Create(wxWindow *parent, wxWindowID id, const wxString& title,
|
||||||
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||||
int n = 0, const wxString choices[] = NULL,
|
int n = 0, const wxString choices[] = NULL,
|
||||||
int majorDim = 0, long style = wxRA_HORIZONTAL,
|
int majorDim = 0, long style = wxRA_HORIZONTAL,
|
||||||
const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr);
|
const wxValidator& val = wxDefaultValidator, const wxString& name = wxRadioBoxNameStr);
|
||||||
|
|
||||||
// Specific functions (in wxWindows2 reference)
|
// Specific functions (in wxWindows2 reference)
|
||||||
virtual void SetSelection(int item);
|
virtual void SetSelection(int item);
|
||||||
virtual int GetSelection() const;
|
virtual int GetSelection() const;
|
||||||
|
|
||||||
inline virtual int GetCount() const { return m_noItems; } ;
|
inline virtual int GetCount() const { return m_noItems; } ;
|
||||||
|
|
||||||
virtual wxString GetString(int item) const;
|
virtual wxString GetString(int item) const;
|
||||||
virtual void SetString(int item, const wxString& label) ;
|
virtual void SetString(int item, const wxString& label) ;
|
||||||
|
|
||||||
virtual void Enable(int item, bool enable);
|
virtual void Enable(int item, bool enable);
|
||||||
virtual void Show(int item, bool show) ;
|
virtual void Show(int item, bool show) ;
|
||||||
|
|
||||||
virtual int GetColumnCount() const ;
|
virtual int GetColumnCount() const ;
|
||||||
virtual int GetRowCount() const ;
|
virtual int GetRowCount() const ;
|
||||||
|
|
||||||
|
|
||||||
virtual bool Enable(bool enable = TRUE);
|
virtual bool Enable(bool enable = TRUE);
|
||||||
virtual wxString GetLabel() const;
|
virtual wxString GetLabel() const;
|
||||||
virtual void SetLabel(const wxString& label) ;
|
virtual void SetLabel(const wxString& label) ;
|
||||||
virtual bool Show(bool show = TRUE);
|
virtual bool Show(bool show = TRUE);
|
||||||
|
|
||||||
// Other external functions
|
// Other external functions
|
||||||
void Command(wxCommandEvent& event);
|
void Command(wxCommandEvent& event);
|
||||||
void SetFocus();
|
void SetFocus();
|
||||||
|
|
||||||
// Other variable access functions
|
// Other variable access functions
|
||||||
inline int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; }
|
inline int GetNumberOfRowsOrCols() const { return m_noRowsOrCols; }
|
||||||
inline void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; }
|
inline void SetNumberOfRowsOrCols(int n) { m_noRowsOrCols = n; }
|
||||||
|
|
||||||
void OnRadioButton( wxCommandEvent& event ) ;
|
void OnRadioButton( wxCommandEvent& event ) ;
|
||||||
protected:
|
protected:
|
||||||
wxRadioButton *m_radioButtonCycle;
|
wxRadioButton *m_radioButtonCycle;
|
||||||
|
|
||||||
int m_majorDim ;
|
int m_majorDim ;
|
||||||
int m_noItems;
|
int m_noItems;
|
||||||
int m_noRowsOrCols;
|
int m_noRowsOrCols;
|
||||||
|
|
||||||
// Internal functions
|
// Internal functions
|
||||||
virtual wxSize DoGetBestSize() const ;
|
virtual wxSize DoGetBestSize() const ;
|
||||||
virtual void DoSetSize(int x, int y,
|
virtual void DoSetSize(int x, int y,
|
||||||
int width, int height,
|
int width, int height,
|
||||||
int sizeFlags = wxSIZE_AUTO);
|
int sizeFlags = wxSIZE_AUTO);
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 01/02/97
|
// Created: 01/02/97
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_RADIOBUT_H_
|
#ifndef _WX_RADIOBUT_H_
|
||||||
@@ -44,7 +44,7 @@ public:
|
|||||||
|
|
||||||
// implementation
|
// implementation
|
||||||
|
|
||||||
virtual void MacHandleControlClick( WXWidget control , wxInt16 controlpart );
|
virtual void MacHandleControlClick( WXWidget control , wxInt16 controlpart );
|
||||||
void Command(wxCommandEvent& event);
|
void Command(wxCommandEvent& event);
|
||||||
wxRadioButton *AddInCycle(wxRadioButton *cycle);
|
wxRadioButton *AddInCycle(wxRadioButton *cycle);
|
||||||
inline wxRadioButton *NextInCycle() {return m_cycle;}
|
inline wxRadioButton *NextInCycle() {return m_cycle;}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_REGION_H_
|
#ifndef _WX_REGION_H_
|
||||||
@@ -24,7 +24,7 @@ class WXDLLEXPORT wxRect;
|
|||||||
class WXDLLEXPORT wxPoint;
|
class WXDLLEXPORT wxPoint;
|
||||||
|
|
||||||
enum wxRegionContain {
|
enum wxRegionContain {
|
||||||
wxOutRegion = 0, wxPartRegion = 1, wxInRegion = 2
|
wxOutRegion = 0, wxPartRegion = 1, wxInRegion = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
// So far, for internal use only
|
// So far, for internal use only
|
||||||
@@ -38,7 +38,7 @@ wxRGN_XOR // Creates the union of two combined regions except for any
|
|||||||
|
|
||||||
class WXDLLEXPORT wxRegion : public wxGDIObject {
|
class WXDLLEXPORT wxRegion : public wxGDIObject {
|
||||||
DECLARE_DYNAMIC_CLASS(wxRegion);
|
DECLARE_DYNAMIC_CLASS(wxRegion);
|
||||||
friend class WXDLLEXPORT wxRegionIterator;
|
friend class WXDLLEXPORT wxRegionIterator;
|
||||||
public:
|
public:
|
||||||
wxRegion(long x, long y, long w, long h);
|
wxRegion(long x, long y, long w, long h);
|
||||||
wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight);
|
wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight);
|
||||||
@@ -155,4 +155,4 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// _WX_REGION_H_
|
// _WX_REGION_H_
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_SCROLBAR_H_
|
#ifndef _WX_SCROLBAR_H_
|
||||||
@@ -57,7 +57,7 @@ public:
|
|||||||
bool refresh = TRUE);
|
bool refresh = TRUE);
|
||||||
|
|
||||||
void Command(wxCommandEvent& event);
|
void Command(wxCommandEvent& event);
|
||||||
virtual void MacHandleControlClick( WXWidget control , wxInt16 controlpart ) ;
|
virtual void MacHandleControlClick( WXWidget control , wxInt16 controlpart ) ;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int m_pageSize;
|
int m_pageSize;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_SETUP_H_
|
#ifndef _WX_SETUP_H_
|
||||||
@@ -855,7 +855,7 @@
|
|||||||
// that use the connection) should support forward only scrolling of cursors,
|
// that use the connection) should support forward only scrolling of cursors,
|
||||||
// or both forward and backward support for backward scrolling cursors is
|
// or both forward and backward support for backward scrolling cursors is
|
||||||
// dependent on the data source as well as the ODBC driver being used.
|
// dependent on the data source as well as the ODBC driver being used.
|
||||||
#define wxODBC_FWD_ONLY_CURSORS 1
|
#define wxODBC_FWD_ONLY_CURSORS 1
|
||||||
|
|
||||||
// Default is 0. Set to 1 to use the deprecated classes, enum types, function,
|
// Default is 0. Set to 1 to use the deprecated classes, enum types, function,
|
||||||
// member variables. With a setting of 1, full backward compatability with the
|
// member variables. With a setting of 1, full backward compatability with the
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_SLIDER_H_
|
#ifndef _WX_SLIDER_H_
|
||||||
@@ -87,12 +87,12 @@ public:
|
|||||||
virtual void DoMoveWindow(int x, int y, int w, int h);
|
virtual void DoMoveWindow(int x, int y, int w, int h);
|
||||||
|
|
||||||
void Command(wxCommandEvent& event);
|
void Command(wxCommandEvent& event);
|
||||||
void MacHandleControlClick( WXWidget control , wxInt16 controlpart ) ;
|
void MacHandleControlClick( WXWidget control , wxInt16 controlpart ) ;
|
||||||
virtual void MacUpdateDimensions() ;
|
virtual void MacUpdateDimensions() ;
|
||||||
|
|
||||||
wxStaticText* m_macMinimumStatic ;
|
wxStaticText* m_macMinimumStatic ;
|
||||||
wxStaticText* m_macMaximumStatic ;
|
wxStaticText* m_macMaximumStatic ;
|
||||||
wxStaticText* m_macValueStatic ;
|
wxStaticText* m_macValueStatic ;
|
||||||
|
|
||||||
int m_rangeMin;
|
int m_rangeMin;
|
||||||
int m_rangeMax;
|
int m_rangeMax;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_SPINBUTT_H_
|
#ifndef _WX_SPINBUTT_H_
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_STATBMP_H_
|
#ifndef _WX_STATBMP_H_
|
||||||
@@ -50,8 +50,8 @@ class WXDLLEXPORT wxStaticBitmap: public wxStaticBitmapBase
|
|||||||
wxBitmap GetBitmap() const { return m_bitmap; }
|
wxBitmap GetBitmap() const { return m_bitmap; }
|
||||||
wxIcon GetIcon() const
|
wxIcon GetIcon() const
|
||||||
{
|
{
|
||||||
// icons and bitmaps are really the same thing in wxMac
|
// icons and bitmaps are really the same thing in wxMac
|
||||||
return (const wxIcon &)m_bitmap;
|
return (const wxIcon &)m_bitmap;
|
||||||
}
|
}
|
||||||
void SetIcon(const wxIcon& icon) { SetBitmap( (const wxBitmap &)icon ) ; }
|
void SetIcon(const wxIcon& icon) { SetBitmap( (const wxBitmap &)icon ) ; }
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ class WXDLLEXPORT wxStaticBitmap: public wxStaticBitmapBase
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
wxBitmap m_bitmap;
|
wxBitmap m_bitmap;
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_STATBOX_H_
|
#ifndef _WX_STATBOX_H_
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_STATTEXT_H_
|
#ifndef _WX_STATTEXT_H_
|
||||||
@@ -53,7 +53,7 @@ class WXDLLEXPORT wxStaticText: public wxStaticTextBase
|
|||||||
virtual wxSize DoGetBestSize() const ;
|
virtual wxSize DoGetBestSize() const ;
|
||||||
virtual bool AcceptsFocus() const { return FALSE; }
|
virtual bool AcceptsFocus() const { return FALSE; }
|
||||||
private :
|
private :
|
||||||
wxString m_label ;
|
wxString m_label ;
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_TABCTRL_H_
|
#ifndef _WX_TABCTRL_H_
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
// File: taskbar.h
|
// File: taskbar.h
|
||||||
// Purpose: Defines wxTaskBarIcon class for manipulating icons on the
|
// Purpose: Defines wxTaskBarIcon class for manipulating icons on the
|
||||||
// task bar. Optional.
|
// task bar. Optional.
|
||||||
// Author: Stefan Csomor
|
// Author: Stefan Csomor
|
||||||
// Modified by:
|
// Modified by:
|
||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c)
|
// Copyright: (c)
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_TASKBAR_H_
|
#ifndef _WX_TASKBAR_H_
|
||||||
@@ -23,8 +23,8 @@
|
|||||||
class wxTaskBarIcon: public wxObject
|
class wxTaskBarIcon: public wxObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxTaskBarIcon();
|
wxTaskBarIcon();
|
||||||
virtual ~wxTaskBarIcon();
|
virtual ~wxTaskBarIcon();
|
||||||
|
|
||||||
// Accessors
|
// Accessors
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_TEXTCTRL_H_
|
#ifndef _WX_TEXTCTRL_H_
|
||||||
@@ -151,11 +151,11 @@ public:
|
|||||||
void OnUpdateUndo(wxUpdateUIEvent& event);
|
void OnUpdateUndo(wxUpdateUIEvent& event);
|
||||||
void OnUpdateRedo(wxUpdateUIEvent& event);
|
void OnUpdateRedo(wxUpdateUIEvent& event);
|
||||||
|
|
||||||
virtual bool MacCanFocus() const { return true ; }
|
virtual bool MacCanFocus() const { return true ; }
|
||||||
virtual bool MacSetupCursor( const wxPoint& pt ) ;
|
virtual bool MacSetupCursor( const wxPoint& pt ) ;
|
||||||
|
|
||||||
virtual void MacSuperShown( bool show ) ;
|
virtual void MacSuperShown( bool show ) ;
|
||||||
virtual bool Show(bool show = TRUE) ;
|
virtual bool Show(bool show = TRUE) ;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual wxSize DoGetBestSize() const;
|
virtual wxSize DoGetBestSize() const;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_TIMER_H_
|
#ifndef _WX_TIMER_H_
|
||||||
@@ -26,8 +26,8 @@ struct MacTimerInfo ;
|
|||||||
class WXDLLEXPORT wxTimer: public wxTimerBase
|
class WXDLLEXPORT wxTimer: public wxTimerBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxTimer() { Init(); }
|
wxTimer() { Init(); }
|
||||||
wxTimer(wxEvtHandler *owner, int id = -1) : wxTimerBase(owner, id) { Init(); }
|
wxTimer(wxEvtHandler *owner, int id = -1) : wxTimerBase(owner, id) { Init(); }
|
||||||
~wxTimer();
|
~wxTimer();
|
||||||
|
|
||||||
virtual bool Start(int milliseconds = -1,
|
virtual bool Start(int milliseconds = -1,
|
||||||
@@ -38,7 +38,7 @@ public:
|
|||||||
|
|
||||||
MacTimerInfo* m_info;
|
MacTimerInfo* m_info;
|
||||||
protected :
|
protected :
|
||||||
void Init();
|
void Init();
|
||||||
private:
|
private:
|
||||||
|
|
||||||
DECLARE_ABSTRACT_CLASS(wxTimer)
|
DECLARE_ABSTRACT_CLASS(wxTimer)
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_TOOLBAR_H_
|
#ifndef _WX_TOOLBAR_H_
|
||||||
@@ -61,11 +61,11 @@ class WXDLLEXPORT wxToolBar: public wxToolBarBase
|
|||||||
|
|
||||||
// Add all the buttons
|
// Add all the buttons
|
||||||
|
|
||||||
virtual void MacHandleControlClick( WXWidget control , short controlpart ) ;
|
virtual void MacHandleControlClick( WXWidget control , short controlpart ) ;
|
||||||
virtual wxString MacGetToolTipString( wxPoint &where ) ;
|
virtual wxString MacGetToolTipString( wxPoint &where ) ;
|
||||||
void OnPaint(wxPaintEvent& event) ;
|
void OnPaint(wxPaintEvent& event) ;
|
||||||
void OnMouse(wxMouseEvent& event) ;
|
void OnMouse(wxMouseEvent& event) ;
|
||||||
virtual void MacSuperChangedPosition() ;
|
virtual void MacSuperChangedPosition() ;
|
||||||
protected:
|
protected:
|
||||||
// common part of all ctors
|
// common part of all ctors
|
||||||
void Init();
|
void Init();
|
||||||
@@ -88,9 +88,9 @@ protected:
|
|||||||
const wxString& longHelp);
|
const wxString& longHelp);
|
||||||
virtual wxToolBarToolBase *CreateTool(wxControl *control);
|
virtual wxToolBarToolBase *CreateTool(wxControl *control);
|
||||||
|
|
||||||
wxArrayPtrVoid m_macToolHandles ;
|
wxArrayPtrVoid m_macToolHandles ;
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // wxUSE_TOOLBAR
|
#endif // wxUSE_TOOLBAR
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ public:
|
|||||||
short MacGetWindowBackgroundTheme() const { return m_macWindowBackgroundTheme ; }
|
short MacGetWindowBackgroundTheme() const { return m_macWindowBackgroundTheme ; }
|
||||||
|
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
WXEVENTHANDLERREF MacGetEventHandler() { return m_macEventHandler ; }
|
WXEVENTHANDLERREF MacGetEventHandler() { return m_macEventHandler ; }
|
||||||
#endif
|
#endif
|
||||||
protected:
|
protected:
|
||||||
// common part of all ctors
|
// common part of all ctors
|
||||||
@@ -116,7 +116,7 @@ protected:
|
|||||||
static WXWindow s_macWindowInUpdate ;
|
static WXWindow s_macWindowInUpdate ;
|
||||||
private :
|
private :
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
WXEVENTHANDLERREF m_macEventHandler ;
|
WXEVENTHANDLERREF m_macEventHandler ;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_TREECTRL_H_
|
#ifndef _WX_TREECTRL_H_
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 03/02/99
|
// Created: 03/02/99
|
||||||
// RCS-ID: $Id:
|
// RCS-ID: $Id:
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef H_UMA
|
#ifndef H_UMA
|
||||||
@@ -31,59 +31,59 @@ bool UMAGetProcessModeDoesActivateOnFGSwitch() ;
|
|||||||
|
|
||||||
// menu manager
|
// menu manager
|
||||||
|
|
||||||
MenuRef UMANewMenu( SInt16 id , const wxString& title ) ;
|
MenuRef UMANewMenu( SInt16 id , const wxString& title ) ;
|
||||||
void UMASetMenuTitle( MenuRef menu , const wxString& title ) ;
|
void UMASetMenuTitle( MenuRef menu , const wxString& title ) ;
|
||||||
UInt32 UMAMenuEvent( EventRecord *inEvent ) ;
|
UInt32 UMAMenuEvent( EventRecord *inEvent ) ;
|
||||||
void UMAEnableMenuItem( MenuRef inMenu , MenuItemIndex item , bool enable ) ;
|
void UMAEnableMenuItem( MenuRef inMenu , MenuItemIndex item , bool enable ) ;
|
||||||
|
|
||||||
void UMAAppendSubMenuItem( MenuRef menu , const wxString& title , SInt16 submenuid ) ;
|
void UMAAppendSubMenuItem( MenuRef menu , const wxString& title , SInt16 submenuid ) ;
|
||||||
void UMAInsertSubMenuItem( MenuRef menu , const wxString& title , MenuItemIndex item , SInt16 submenuid ) ;
|
void UMAInsertSubMenuItem( MenuRef menu , const wxString& title , MenuItemIndex item , SInt16 submenuid ) ;
|
||||||
void UMAAppendMenuItem( MenuRef menu , const wxString& title , wxAcceleratorEntry *entry = NULL ) ;
|
void UMAAppendMenuItem( MenuRef menu , const wxString& title , wxAcceleratorEntry *entry = NULL ) ;
|
||||||
void UMAInsertMenuItem( MenuRef menu , const wxString& title , MenuItemIndex item , wxAcceleratorEntry *entry = NULL ) ;
|
void UMAInsertMenuItem( MenuRef menu , const wxString& title , MenuItemIndex item , wxAcceleratorEntry *entry = NULL ) ;
|
||||||
void UMASetMenuItemShortcut( MenuRef menu , MenuItemIndex item , wxAcceleratorEntry *entry ) ;
|
void UMASetMenuItemShortcut( MenuRef menu , MenuItemIndex item , wxAcceleratorEntry *entry ) ;
|
||||||
|
|
||||||
void UMASetMenuItemText( MenuRef menu, MenuItemIndex item, const wxString& title ) ;
|
void UMASetMenuItemText( MenuRef menu, MenuItemIndex item, const wxString& title ) ;
|
||||||
|
|
||||||
// quickdraw
|
// quickdraw
|
||||||
|
|
||||||
void UMAShowWatchCursor() ;
|
void UMAShowWatchCursor() ;
|
||||||
void UMAShowArrowCursor() ;
|
void UMAShowArrowCursor() ;
|
||||||
|
|
||||||
OSStatus UMAPrOpen(void *macPrintSession) ;
|
OSStatus UMAPrOpen(void *macPrintSession) ;
|
||||||
OSStatus UMAPrClose(void *macPrintSession) ;
|
OSStatus UMAPrClose(void *macPrintSession) ;
|
||||||
|
|
||||||
// window manager
|
// window manager
|
||||||
|
|
||||||
GrafPtr UMAGetWindowPort( WindowRef inWindowRef ) ;
|
GrafPtr UMAGetWindowPort( WindowRef inWindowRef ) ;
|
||||||
void UMADisposeWindow( WindowRef inWindowRef ) ;
|
void UMADisposeWindow( WindowRef inWindowRef ) ;
|
||||||
void UMASetWTitleC( WindowRef inWindowRef , const char *title ) ;
|
void UMASetWTitleC( WindowRef inWindowRef , const char *title ) ;
|
||||||
void UMAGetWTitleC( WindowRef inWindowRef , char *title ) ;
|
void UMAGetWTitleC( WindowRef inWindowRef , char *title ) ;
|
||||||
|
|
||||||
void UMADrawGrowIcon( WindowRef inWindowRef ) ;
|
void UMADrawGrowIcon( WindowRef inWindowRef ) ;
|
||||||
void UMAShowHide( WindowRef inWindowRef , Boolean show) ;
|
void UMAShowHide( WindowRef inWindowRef , Boolean show) ;
|
||||||
|
|
||||||
// appearance manager
|
// appearance manager
|
||||||
|
|
||||||
void UMADrawControl( ControlHandle inControl ) ;
|
void UMADrawControl( ControlHandle inControl ) ;
|
||||||
|
|
||||||
void UMAEnableControl( ControlHandle inControl ) ;
|
void UMAEnableControl( ControlHandle inControl ) ;
|
||||||
void UMADisableControl( ControlHandle inControl ) ;
|
void UMADisableControl( ControlHandle inControl ) ;
|
||||||
void UMAActivateControl( ControlHandle inControl ) ;
|
void UMAActivateControl( ControlHandle inControl ) ;
|
||||||
void UMADeactivateControl( ControlHandle inControl ) ;
|
void UMADeactivateControl( ControlHandle inControl ) ;
|
||||||
// ControlPartCode hiliteState) ;
|
// ControlPartCode hiliteState) ;
|
||||||
void UMAShowControl (ControlHandle theControl) ;
|
void UMAShowControl (ControlHandle theControl) ;
|
||||||
void UMAHideControl (ControlHandle theControl);
|
void UMAHideControl (ControlHandle theControl);
|
||||||
void UMAActivateControl (ControlHandle inControl);
|
void UMAActivateControl (ControlHandle inControl);
|
||||||
void UMADeactivateControl (ControlHandle inControl);
|
void UMADeactivateControl (ControlHandle inControl);
|
||||||
|
|
||||||
void UMAMoveControl( ControlHandle inControl , short x , short y ) ;
|
void UMAMoveControl( ControlHandle inControl , short x , short y ) ;
|
||||||
void UMASizeControl( ControlHandle inControl , short x , short y ) ;
|
void UMASizeControl( ControlHandle inControl , short x , short y ) ;
|
||||||
// control hierarchy
|
// control hierarchy
|
||||||
|
|
||||||
// keyboard focus
|
// keyboard focus
|
||||||
OSErr UMASetKeyboardFocus (WindowPtr inWindow,
|
OSErr UMASetKeyboardFocus (WindowPtr inWindow,
|
||||||
ControlHandle inControl,
|
ControlHandle inControl,
|
||||||
ControlFocusPart inPart) ;
|
ControlFocusPart inPart) ;
|
||||||
|
|
||||||
// events
|
// events
|
||||||
|
|
||||||
@@ -91,8 +91,8 @@ void UMAUpdateControls( WindowPtr inWindow , RgnHandle inRgn ) ;
|
|||||||
OSErr UMAGetRootControl( WindowPtr inWindow , ControlHandle *outControl ) ;
|
OSErr UMAGetRootControl( WindowPtr inWindow , ControlHandle *outControl ) ;
|
||||||
|
|
||||||
// handling control data
|
// handling control data
|
||||||
bool UMAIsWindowFloating( WindowRef inWindow ) ;
|
bool UMAIsWindowFloating( WindowRef inWindow ) ;
|
||||||
bool UMAIsWindowModal( WindowRef inWindow ) ;
|
bool UMAIsWindowModal( WindowRef inWindow ) ;
|
||||||
|
|
||||||
void UMAHighlightAndActivateWindow( WindowRef inWindowRef , bool inActivate ) ;
|
void UMAHighlightAndActivateWindow( WindowRef inWindowRef , bool inActivate ) ;
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_WAVE_H_
|
#ifndef _WX_WAVE_H_
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef _WX_WINDOW_H_
|
#ifndef _WX_WINDOW_H_
|
||||||
@@ -163,7 +163,7 @@ public:
|
|||||||
|
|
||||||
// WXHWND GetHWND() const { return m_hWnd; }
|
// WXHWND GetHWND() const { return m_hWnd; }
|
||||||
// void SetHWND(WXHWND hWnd) { m_hWnd = hWnd; }
|
// void SetHWND(WXHWND hWnd) { m_hWnd = hWnd; }
|
||||||
virtual WXWidget GetHandle() const { return (WXWidget) NULL ; }
|
virtual WXWidget GetHandle() const { return (WXWidget) NULL ; }
|
||||||
|
|
||||||
bool GetUseCtl3D() const { return m_useCtl3D; }
|
bool GetUseCtl3D() const { return m_useCtl3D; }
|
||||||
bool GetTransparentBackground() const { return m_backgroundTransparent; }
|
bool GetTransparentBackground() const { return m_backgroundTransparent; }
|
||||||
@@ -171,7 +171,7 @@ public:
|
|||||||
|
|
||||||
// event handlers
|
// event handlers
|
||||||
// --------------
|
// --------------
|
||||||
void OnSetFocus(wxFocusEvent& event) ;
|
void OnSetFocus(wxFocusEvent& event) ;
|
||||||
void OnNcPaint(wxNcPaintEvent& event);
|
void OnNcPaint(wxNcPaintEvent& event);
|
||||||
void OnEraseBackground(wxEraseEvent& event);
|
void OnEraseBackground(wxEraseEvent& event);
|
||||||
void OnIdle(wxIdleEvent& event);
|
void OnIdle(wxIdleEvent& event);
|
||||||
@@ -233,7 +233,7 @@ public:
|
|||||||
static long MacRemoveBordersFromStyle( long style ) ;
|
static long MacRemoveBordersFromStyle( long style ) ;
|
||||||
virtual void MacSuperChangedPosition() ;
|
virtual void MacSuperChangedPosition() ;
|
||||||
// the absolute coordinates of this item within the toplevel window may have changed
|
// the absolute coordinates of this item within the toplevel window may have changed
|
||||||
virtual void MacUpdateDimensions() {}
|
virtual void MacUpdateDimensions() {}
|
||||||
// the absolute coortinates of this window's root have changed
|
// the absolute coortinates of this window's root have changed
|
||||||
virtual void MacTopLevelWindowChangedPosition() ;
|
virtual void MacTopLevelWindowChangedPosition() ;
|
||||||
virtual void MacSuperShown( bool show ) ;
|
virtual void MacSuperShown( bool show ) ;
|
||||||
|
|||||||
402
src/mac/app.cpp
402
src/mac/app.cpp
@@ -289,21 +289,21 @@ void wxApp::MacNewFile()
|
|||||||
|
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
|
|
||||||
static const EventTypeSpec eventList[] =
|
static const EventTypeSpec eventList[] =
|
||||||
{
|
{
|
||||||
{ kEventClassCommand, kEventProcessCommand } ,
|
{ kEventClassCommand, kEventProcessCommand } ,
|
||||||
{ kEventClassCommand, kEventCommandUpdateStatus } ,
|
{ kEventClassCommand, kEventCommandUpdateStatus } ,
|
||||||
|
|
||||||
{ kEventClassApplication , kEventAppActivated } ,
|
{ kEventClassApplication , kEventAppActivated } ,
|
||||||
{ kEventClassApplication , kEventAppDeactivated } ,
|
{ kEventClassApplication , kEventAppDeactivated } ,
|
||||||
// handling the quit event is not recommended by apple
|
// handling the quit event is not recommended by apple
|
||||||
// rather using the quit apple event - which we do
|
// rather using the quit apple event - which we do
|
||||||
|
|
||||||
{ kEventClassAppleEvent , kEventAppleEvent } ,
|
{ kEventClassAppleEvent , kEventAppleEvent } ,
|
||||||
|
|
||||||
{ kEventClassMouse , kEventMouseDown } ,
|
{ kEventClassMouse , kEventMouseDown } ,
|
||||||
{ 'WXMC' , 'WXMC' }
|
{ 'WXMC' , 'WXMC' }
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
static pascal OSStatus MenuEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
|
static pascal OSStatus MenuEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
|
||||||
{
|
{
|
||||||
@@ -323,22 +323,22 @@ static pascal OSStatus MouseEventHandler( EventHandlerCallRef handler , EventRef
|
|||||||
|
|
||||||
switch( GetEventKind(event) )
|
switch( GetEventKind(event) )
|
||||||
{
|
{
|
||||||
case kEventMouseDown :
|
case kEventMouseDown :
|
||||||
{
|
{
|
||||||
Point point ;
|
Point point ;
|
||||||
WindowRef window ;
|
WindowRef window ;
|
||||||
|
|
||||||
GetEventParameter( event, kEventParamMouseLocation, typeQDPoint, NULL,
|
GetEventParameter( event, kEventParamMouseLocation, typeQDPoint, NULL,
|
||||||
sizeof( Point ), NULL, &point );
|
sizeof( Point ), NULL, &point );
|
||||||
short windowPart = ::FindWindow(point, &window);
|
short windowPart = ::FindWindow(point, &window);
|
||||||
|
|
||||||
if ( windowPart == inMenuBar )
|
if ( windowPart == inMenuBar )
|
||||||
{
|
{
|
||||||
MenuSelect( point ) ;
|
MenuSelect( point ) ;
|
||||||
result = noErr ;
|
result = noErr ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result ;
|
return result ;
|
||||||
@@ -348,14 +348,14 @@ static pascal OSStatus CommandEventHandler( EventHandlerCallRef handler , EventR
|
|||||||
{
|
{
|
||||||
OSStatus result = eventNotHandledErr ;
|
OSStatus result = eventNotHandledErr ;
|
||||||
|
|
||||||
HICommand command ;
|
HICommand command ;
|
||||||
|
|
||||||
GetEventParameter( event, kEventParamDirectObject, typeHICommand, NULL,
|
GetEventParameter( event, kEventParamDirectObject, typeHICommand, NULL,
|
||||||
sizeof( HICommand ), NULL, &command );
|
sizeof( HICommand ), NULL, &command );
|
||||||
|
|
||||||
MenuCommand id = command.commandID ;
|
MenuCommand id = command.commandID ;
|
||||||
if ( id == kHICommandPreferences )
|
if ( id == kHICommandPreferences )
|
||||||
id = wxApp::s_macPreferencesMenuItemId ;
|
id = wxApp::s_macPreferencesMenuItemId ;
|
||||||
|
|
||||||
wxMenuBar* mbar = wxMenuBar::MacGetInstalledMenuBar() ;
|
wxMenuBar* mbar = wxMenuBar::MacGetInstalledMenuBar() ;
|
||||||
wxMenu* menu = NULL ;
|
wxMenu* menu = NULL ;
|
||||||
@@ -365,28 +365,28 @@ static pascal OSStatus CommandEventHandler( EventHandlerCallRef handler , EventR
|
|||||||
item = mbar->FindItem( id , &menu ) ;
|
item = mbar->FindItem( id , &menu ) ;
|
||||||
|
|
||||||
if ( item == NULL || menu == NULL || mbar == NULL )
|
if ( item == NULL || menu == NULL || mbar == NULL )
|
||||||
return result ;
|
return result ;
|
||||||
|
|
||||||
switch( GetEventKind( event ) )
|
switch( GetEventKind( event ) )
|
||||||
{
|
{
|
||||||
case kEventProcessCommand :
|
case kEventProcessCommand :
|
||||||
{
|
{
|
||||||
if (item->IsCheckable())
|
if (item->IsCheckable())
|
||||||
{
|
{
|
||||||
item->Check( !item->IsChecked() ) ;
|
item->Check( !item->IsChecked() ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
menu->SendEvent( id , item->IsCheckable() ? item->IsChecked() : -1 ) ;
|
menu->SendEvent( id , item->IsCheckable() ? item->IsChecked() : -1 ) ;
|
||||||
result = noErr ;
|
result = noErr ;
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
case kEventCommandUpdateStatus:
|
case kEventCommandUpdateStatus:
|
||||||
// eventually trigger an updateui round
|
// eventually trigger an updateui round
|
||||||
result = noErr ;
|
result = noErr ;
|
||||||
break ;
|
break ;
|
||||||
default :
|
default :
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result ;
|
return result ;
|
||||||
}
|
}
|
||||||
@@ -394,23 +394,23 @@ static pascal OSStatus CommandEventHandler( EventHandlerCallRef handler , EventR
|
|||||||
static pascal OSStatus ApplicationEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
|
static pascal OSStatus ApplicationEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
|
||||||
{
|
{
|
||||||
OSStatus result = eventNotHandledErr ;
|
OSStatus result = eventNotHandledErr ;
|
||||||
switch ( GetEventKind( event ) )
|
switch ( GetEventKind( event ) )
|
||||||
{
|
{
|
||||||
case kEventAppActivated :
|
case kEventAppActivated :
|
||||||
{
|
{
|
||||||
wxTheApp->MacResume( true ) ;
|
wxTheApp->MacResume( true ) ;
|
||||||
result = noErr ;
|
result = noErr ;
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
case kEventAppDeactivated :
|
case kEventAppDeactivated :
|
||||||
{
|
{
|
||||||
wxTheApp->MacSuspend( true ) ;
|
wxTheApp->MacSuspend( true ) ;
|
||||||
result = noErr ;
|
result = noErr ;
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
default :
|
default :
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
return result ;
|
return result ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -419,27 +419,27 @@ pascal OSStatus wxAppEventHandler( EventHandlerCallRef handler , EventRef event
|
|||||||
OSStatus result = eventNotHandledErr ;
|
OSStatus result = eventNotHandledErr ;
|
||||||
switch( GetEventClass( event ) )
|
switch( GetEventClass( event ) )
|
||||||
{
|
{
|
||||||
case kEventClassCommand :
|
case kEventClassCommand :
|
||||||
result = CommandEventHandler( handler , event , data ) ;
|
result = CommandEventHandler( handler , event , data ) ;
|
||||||
break ;
|
break ;
|
||||||
case kEventClassApplication :
|
case kEventClassApplication :
|
||||||
result = ApplicationEventHandler( handler , event , data ) ;
|
result = ApplicationEventHandler( handler , event , data ) ;
|
||||||
break ;
|
break ;
|
||||||
case kEventClassMenu :
|
case kEventClassMenu :
|
||||||
result = MenuEventHandler( handler , event , data ) ;
|
result = MenuEventHandler( handler , event , data ) ;
|
||||||
break ;
|
break ;
|
||||||
case kEventClassMouse :
|
case kEventClassMouse :
|
||||||
result = MouseEventHandler( handler , event , data ) ;
|
result = MouseEventHandler( handler , event , data ) ;
|
||||||
break ;
|
break ;
|
||||||
case kEventClassAppleEvent :
|
case kEventClassAppleEvent :
|
||||||
{
|
{
|
||||||
EventRecord rec ;
|
EventRecord rec ;
|
||||||
wxMacConvertEventToRecord( event , &rec ) ;
|
wxMacConvertEventToRecord( event , &rec ) ;
|
||||||
result = AEProcessAppleEvent( &rec ) ;
|
result = AEProcessAppleEvent( &rec ) ;
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
default :
|
default :
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result ;
|
return result ;
|
||||||
@@ -532,7 +532,7 @@ bool wxApp::Initialize()
|
|||||||
|
|
||||||
#ifndef __DARWIN__
|
#ifndef __DARWIN__
|
||||||
// now avoid exceptions thrown for new (bad_alloc)
|
// now avoid exceptions thrown for new (bad_alloc)
|
||||||
// FIXME CS for some changes outside wxMac does not compile anymore
|
// FIXME CS for some changes outside wxMac does not compile anymore
|
||||||
#if 0
|
#if 0
|
||||||
std::__throws_bad_alloc = 0 ;
|
std::__throws_bad_alloc = 0 ;
|
||||||
#endif
|
#endif
|
||||||
@@ -593,15 +593,15 @@ bool wxApp::Initialize()
|
|||||||
|
|
||||||
bool wxApp::OnInitGui()
|
bool wxApp::OnInitGui()
|
||||||
{
|
{
|
||||||
if( !wxAppBase::OnInitGui() )
|
if( !wxAppBase::OnInitGui() )
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
InstallStandardEventHandler( GetApplicationEventTarget() ) ;
|
InstallStandardEventHandler( GetApplicationEventTarget() ) ;
|
||||||
|
|
||||||
InstallApplicationEventHandler(
|
InstallApplicationEventHandler(
|
||||||
GetwxAppEventHandlerUPP(),
|
GetwxAppEventHandlerUPP(),
|
||||||
GetEventTypeCount(eventList), eventList, wxTheApp, &((EventHandlerRef)wxTheApp->m_macEventHandler));
|
GetEventTypeCount(eventList), eventList, wxTheApp, &((EventHandlerRef)wxTheApp->m_macEventHandler));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340)
|
#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340)
|
||||||
@@ -632,7 +632,7 @@ bool wxApp::OnInitGui()
|
|||||||
0 , FALSE ) ;
|
0 , FALSE ) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return TRUE ;
|
return TRUE ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxApp::CleanUp()
|
void wxApp::CleanUp()
|
||||||
@@ -879,7 +879,7 @@ void wxStAppResource::CloseSharedLibraryResource()
|
|||||||
// the __wxinitialize and __wxterminate must be used
|
// the __wxinitialize and __wxterminate must be used
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
void __sinit(void); /* (generated by linker) */
|
void __sinit(void); /* (generated by linker) */
|
||||||
pascal OSErr __initialize(const CFragInitBlock *theInitBlock);
|
pascal OSErr __initialize(const CFragInitBlock *theInitBlock);
|
||||||
pascal void __terminate(void);
|
pascal void __terminate(void);
|
||||||
}
|
}
|
||||||
@@ -1149,14 +1149,14 @@ bool wxApp::Initialized()
|
|||||||
|
|
||||||
int wxApp::MainLoop()
|
int wxApp::MainLoop()
|
||||||
{
|
{
|
||||||
m_keepGoing = TRUE;
|
m_keepGoing = TRUE;
|
||||||
|
|
||||||
while (m_keepGoing)
|
while (m_keepGoing)
|
||||||
{
|
{
|
||||||
MacDoOneEvent() ;
|
MacDoOneEvent() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns TRUE if more time is needed.
|
// Returns TRUE if more time is needed.
|
||||||
@@ -1171,18 +1171,18 @@ bool wxApp::ProcessIdle()
|
|||||||
|
|
||||||
void wxApp::ExitMainLoop()
|
void wxApp::ExitMainLoop()
|
||||||
{
|
{
|
||||||
m_keepGoing = FALSE;
|
m_keepGoing = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Is a message/event pending?
|
// Is a message/event pending?
|
||||||
bool wxApp::Pending()
|
bool wxApp::Pending()
|
||||||
{
|
{
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
return GetNumEventsInQueue( GetMainEventQueue() ) > 0 ;
|
return GetNumEventsInQueue( GetMainEventQueue() ) > 0 ;
|
||||||
#else
|
#else
|
||||||
EventRecord event ;
|
EventRecord event ;
|
||||||
|
|
||||||
return EventAvail( everyEvent , &event ) ;
|
return EventAvail( everyEvent , &event ) ;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1336,39 +1336,39 @@ bool wxApp::Yield(bool onlyIfNeeded)
|
|||||||
#if wxUSE_THREADS
|
#if wxUSE_THREADS
|
||||||
YieldToAnyThread() ;
|
YieldToAnyThread() ;
|
||||||
#endif
|
#endif
|
||||||
// by definition yield should handle all non-processed events
|
// by definition yield should handle all non-processed events
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
EventRef theEvent;
|
EventRef theEvent;
|
||||||
|
|
||||||
OSStatus status = noErr ;
|
OSStatus status = noErr ;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
s_inReceiveEvent = true ;
|
s_inReceiveEvent = true ;
|
||||||
status = ReceiveNextEvent(0, NULL,kEventDurationNoWait,true,&theEvent) ;
|
status = ReceiveNextEvent(0, NULL,kEventDurationNoWait,true,&theEvent) ;
|
||||||
s_inReceiveEvent = false ;
|
s_inReceiveEvent = false ;
|
||||||
|
|
||||||
if ( status == eventLoopTimedOutErr )
|
if ( status == eventLoopTimedOutErr )
|
||||||
{
|
{
|
||||||
// make sure next time the event loop will trigger idle events
|
// make sure next time the event loop will trigger idle events
|
||||||
sleepTime = kEventDurationNoWait ;
|
sleepTime = kEventDurationNoWait ;
|
||||||
}
|
}
|
||||||
else if ( status == eventLoopQuitErr )
|
else if ( status == eventLoopQuitErr )
|
||||||
{
|
{
|
||||||
// according to QA1061 this may also occur when a WakeUp Process
|
// according to QA1061 this may also occur when a WakeUp Process
|
||||||
// is executed
|
// is executed
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MacHandleOneEvent( theEvent ) ;
|
MacHandleOneEvent( theEvent ) ;
|
||||||
ReleaseEvent(theEvent);
|
ReleaseEvent(theEvent);
|
||||||
}
|
}
|
||||||
} while( status == noErr ) ;
|
} while( status == noErr ) ;
|
||||||
#else
|
#else
|
||||||
EventRecord event ;
|
EventRecord event ;
|
||||||
|
|
||||||
// having a larger value here leads to large performance slowdowns
|
// having a larger value here leads to large performance slowdowns
|
||||||
// so we cannot give background apps more processor time here
|
// so we cannot give background apps more processor time here
|
||||||
// we do so however having a large sleep value in the main event loop
|
// we do so however having a large sleep value in the main event loop
|
||||||
sleepTime = 0 ;
|
sleepTime = 0 ;
|
||||||
|
|
||||||
while ( !IsExiting() && WaitNextEvent(everyEvent, &event,sleepTime, (RgnHandle) wxApp::s_macCursorRgn))
|
while ( !IsExiting() && WaitNextEvent(everyEvent, &event,sleepTime, (RgnHandle) wxApp::s_macCursorRgn))
|
||||||
@@ -1449,32 +1449,32 @@ void wxApp::MacConvertPublicToPrivateScrap()
|
|||||||
void wxApp::MacDoOneEvent()
|
void wxApp::MacDoOneEvent()
|
||||||
{
|
{
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
EventRef theEvent;
|
EventRef theEvent;
|
||||||
|
|
||||||
s_inReceiveEvent = true ;
|
s_inReceiveEvent = true ;
|
||||||
OSStatus status = ReceiveNextEvent(0, NULL,sleepTime,true,&theEvent) ;
|
OSStatus status = ReceiveNextEvent(0, NULL,sleepTime,true,&theEvent) ;
|
||||||
s_inReceiveEvent = false ;
|
s_inReceiveEvent = false ;
|
||||||
if ( status == eventLoopTimedOutErr )
|
if ( status == eventLoopTimedOutErr )
|
||||||
{
|
{
|
||||||
if ( wxTheApp->ProcessIdle() )
|
if ( wxTheApp->ProcessIdle() )
|
||||||
sleepTime = kEventDurationNoWait ;
|
sleepTime = kEventDurationNoWait ;
|
||||||
else
|
else
|
||||||
sleepTime = kEventDurationForever ;
|
sleepTime = kEventDurationForever ;
|
||||||
}
|
}
|
||||||
else if ( status == eventLoopQuitErr )
|
else if ( status == eventLoopQuitErr )
|
||||||
{
|
{
|
||||||
// according to QA1061 this may also occur when a WakeUp Process
|
// according to QA1061 this may also occur when a WakeUp Process
|
||||||
// is executed
|
// is executed
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MacHandleOneEvent( theEvent ) ;
|
MacHandleOneEvent( theEvent ) ;
|
||||||
ReleaseEvent(theEvent);
|
ReleaseEvent(theEvent);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
EventRecord event ;
|
EventRecord event ;
|
||||||
|
|
||||||
EventMask eventMask = everyEvent ;
|
EventMask eventMask = everyEvent ;
|
||||||
|
|
||||||
if (WaitNextEvent(eventMask, &event, sleepTime, (RgnHandle) s_macCursorRgn))
|
if (WaitNextEvent(eventMask, &event, sleepTime, (RgnHandle) s_macCursorRgn))
|
||||||
{
|
{
|
||||||
@@ -1490,9 +1490,9 @@ void wxApp::MacDoOneEvent()
|
|||||||
::IdleControls( window ) ;
|
::IdleControls( window ) ;
|
||||||
|
|
||||||
if ( wxTheApp->ProcessIdle() )
|
if ( wxTheApp->ProcessIdle() )
|
||||||
sleepTime = 0 ;
|
sleepTime = 0 ;
|
||||||
else
|
else
|
||||||
sleepTime = GetCaretTime() / 2 ;
|
sleepTime = GetCaretTime() / 2 ;
|
||||||
}
|
}
|
||||||
if ( event.what != kHighLevelEvent )
|
if ( event.what != kHighLevelEvent )
|
||||||
SetRectRgn( (RgnHandle) s_macCursorRgn , event.where.h , event.where.v , event.where.h + 1 , event.where.v + 1 ) ;
|
SetRectRgn( (RgnHandle) s_macCursorRgn , event.where.h , event.where.v , event.where.h + 1 , event.where.v + 1 ) ;
|
||||||
@@ -1506,10 +1506,10 @@ void wxApp::MacDoOneEvent()
|
|||||||
void wxApp::MacHandleOneEvent( WXEVENTREF evr )
|
void wxApp::MacHandleOneEvent( WXEVENTREF evr )
|
||||||
{
|
{
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
EventTargetRef theTarget;
|
EventTargetRef theTarget;
|
||||||
theTarget = GetEventDispatcherTarget();
|
theTarget = GetEventDispatcherTarget();
|
||||||
m_macCurrentEvent = evr ;
|
m_macCurrentEvent = evr ;
|
||||||
SendEventToEventTarget ((EventRef) evr , theTarget);
|
SendEventToEventTarget ((EventRef) evr , theTarget);
|
||||||
#else
|
#else
|
||||||
EventRecord* ev = (EventRecord*) evr ;
|
EventRecord* ev = (EventRecord*) evr ;
|
||||||
m_macCurrentEvent = ev ;
|
m_macCurrentEvent = ev ;
|
||||||
@@ -1784,15 +1784,15 @@ void wxApp::MacHandleMouseUpEvent( WXEVENTREF evr )
|
|||||||
WindowRef window;
|
WindowRef window;
|
||||||
|
|
||||||
short windowPart = inNoWindow ;
|
short windowPart = inNoWindow ;
|
||||||
if ( wxTheApp->s_captureWindow )
|
if ( wxTheApp->s_captureWindow )
|
||||||
{
|
{
|
||||||
window = (WindowRef) s_captureWindow->MacGetRootWindow() ;
|
window = (WindowRef) s_captureWindow->MacGetRootWindow() ;
|
||||||
windowPart = inContent ;
|
windowPart = inContent ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
windowPart = ::FindWindow(ev->where, &window) ;
|
windowPart = ::FindWindow(ev->where, &window) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (windowPart)
|
switch (windowPart)
|
||||||
{
|
{
|
||||||
@@ -1990,13 +1990,13 @@ bool wxApp::MacSendKeyDownEvent( wxWindow* focus , long keymessage , long modifi
|
|||||||
keycode = short(keyInfo & keyCodeMask) >> 8 ;
|
keycode = short(keyInfo & keyCodeMask) >> 8 ;
|
||||||
}
|
}
|
||||||
long keyval = wxMacTranslateKey(keychar, keycode) ;
|
long keyval = wxMacTranslateKey(keychar, keycode) ;
|
||||||
long realkeyval = keyval ;
|
long realkeyval = keyval ;
|
||||||
if ( keyval == keychar )
|
if ( keyval == keychar )
|
||||||
{
|
{
|
||||||
// we are not on a special character combo -> pass the real os event-value to EVT_CHAR, but not to EVT_KEY (make upper first)
|
// we are not on a special character combo -> pass the real os event-value to EVT_CHAR, but not to EVT_KEY (make upper first)
|
||||||
realkeyval = short(keymessage & charCodeMask) ;
|
realkeyval = short(keymessage & charCodeMask) ;
|
||||||
keyval = wxToupper( keyval ) ;
|
keyval = wxToupper( keyval ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxKeyEvent event(wxEVT_KEY_DOWN);
|
wxKeyEvent event(wxEVT_KEY_DOWN);
|
||||||
bool handled = false ;
|
bool handled = false ;
|
||||||
@@ -2120,10 +2120,10 @@ bool wxApp::MacSendKeyUpEvent( wxWindow* focus , long keymessage , long modifier
|
|||||||
}
|
}
|
||||||
long keyval = wxMacTranslateKey(keychar, keycode) ;
|
long keyval = wxMacTranslateKey(keychar, keycode) ;
|
||||||
|
|
||||||
if ( keyval == keychar )
|
if ( keyval == keychar )
|
||||||
{
|
{
|
||||||
keyval = wxToupper( keyval ) ;
|
keyval = wxToupper( keyval ) ;
|
||||||
}
|
}
|
||||||
bool handled = false ;
|
bool handled = false ;
|
||||||
|
|
||||||
wxKeyEvent event(wxEVT_KEY_UP);
|
wxKeyEvent event(wxEVT_KEY_UP);
|
||||||
@@ -2248,15 +2248,15 @@ void wxApp::MacHandleOSEvent( WXEVENTREF evr )
|
|||||||
|
|
||||||
wxWindow* currentMouseWindow = NULL ;
|
wxWindow* currentMouseWindow = NULL ;
|
||||||
|
|
||||||
if (s_captureWindow )
|
if (s_captureWindow )
|
||||||
{
|
{
|
||||||
currentMouseWindow = s_captureWindow ;
|
currentMouseWindow = s_captureWindow ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxWindow::MacGetWindowFromPoint( wxPoint( ev->where.h , ev->where.v ) ,
|
wxWindow::MacGetWindowFromPoint( wxPoint( ev->where.h , ev->where.v ) ,
|
||||||
¤tMouseWindow ) ;
|
¤tMouseWindow ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( currentMouseWindow != wxWindow::s_lastMouseWindow )
|
if ( currentMouseWindow != wxWindow::s_lastMouseWindow )
|
||||||
{
|
{
|
||||||
@@ -2299,15 +2299,15 @@ void wxApp::MacHandleOSEvent( WXEVENTREF evr )
|
|||||||
|
|
||||||
short windowPart = inNoWindow ;
|
short windowPart = inNoWindow ;
|
||||||
|
|
||||||
if ( s_captureWindow )
|
if ( s_captureWindow )
|
||||||
{
|
{
|
||||||
window = (WindowRef) s_captureWindow->MacGetRootWindow() ;
|
window = (WindowRef) s_captureWindow->MacGetRootWindow() ;
|
||||||
windowPart = inContent ;
|
windowPart = inContent ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
windowPart = ::FindWindow(ev->where, &window);
|
windowPart = ::FindWindow(ev->where, &window);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (windowPart)
|
switch (windowPart)
|
||||||
{
|
{
|
||||||
@@ -2359,7 +2359,7 @@ void wxApp::MacHandleMenuCommand( wxUint32 id )
|
|||||||
item->Check( !item->IsChecked() ) ;
|
item->Check( !item->IsChecked() ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
menu->SendEvent( id , item->IsCheckable() ? item->IsChecked() : -1 ) ;
|
menu->SendEvent( id , item->IsCheckable() ? item->IsChecked() : -1 ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !TARGET_CARBON
|
#if !TARGET_CARBON
|
||||||
@@ -2384,7 +2384,7 @@ void wxApp::MacHandleMenuSelect( int macMenuId , int macMenuItemNum )
|
|||||||
{
|
{
|
||||||
MenuCommand id ;
|
MenuCommand id ;
|
||||||
GetMenuItemCommandID( GetMenuHandle(macMenuId) , macMenuItemNum , &id ) ;
|
GetMenuItemCommandID( GetMenuHandle(macMenuId) , macMenuItemNum , &id ) ;
|
||||||
MacHandleMenuCommand( id ) ;
|
MacHandleMenuCommand( id ) ;
|
||||||
}
|
}
|
||||||
HiliteMenu(0);
|
HiliteMenu(0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -218,8 +218,8 @@ CIconHandle wxMacCreateCIcon(GWorldPtr image , GWorldPtr mask , short dstDepth ,
|
|||||||
|
|
||||||
if ( mask )
|
if ( mask )
|
||||||
{
|
{
|
||||||
Rect r ;
|
Rect r ;
|
||||||
GetPortBounds( image , &r ) ;
|
GetPortBounds( image , &r ) ;
|
||||||
LockPixels(GetGWorldPixMap(mask) ) ;
|
LockPixels(GetGWorldPixMap(mask) ) ;
|
||||||
CopyBits(GetPortBitMapForCopyBits(mask) ,
|
CopyBits(GetPortBitMapForCopyBits(mask) ,
|
||||||
&(**icon).iconBMap , &r , &r, srcCopy , nil ) ;
|
&(**icon).iconBMap , &r , &r, srcCopy , nil ) ;
|
||||||
@@ -229,8 +229,8 @@ CIconHandle wxMacCreateCIcon(GWorldPtr image , GWorldPtr mask , short dstDepth ,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Rect r ;
|
Rect r ;
|
||||||
GetPortBounds( image , &r ) ;
|
GetPortBounds( image , &r ) ;
|
||||||
LockPixels(GetGWorldPixMap(image));
|
LockPixels(GetGWorldPixMap(image));
|
||||||
CopyBits(GetPortBitMapForCopyBits(image) ,
|
CopyBits(GetPortBitMapForCopyBits(image) ,
|
||||||
&(**icon).iconBMap , &r , &r, srcCopy , nil ) ;
|
&(**icon).iconBMap , &r , &r, srcCopy , nil ) ;
|
||||||
@@ -275,7 +275,7 @@ PicHandle wxMacCreatePict(GWorldPtr wp, GWorldPtr mask)
|
|||||||
if ( clipRgn )
|
if ( clipRgn )
|
||||||
GetRegionBounds( clipRgn , &portRect ) ;
|
GetRegionBounds( clipRgn , &portRect ) ;
|
||||||
else
|
else
|
||||||
GetPortBounds( wp , &portRect ) ;
|
GetPortBounds( wp , &portRect ) ;
|
||||||
pict = OpenPicture(&portRect);
|
pict = OpenPicture(&portRect);
|
||||||
if(pict)
|
if(pict)
|
||||||
{
|
{
|
||||||
@@ -283,7 +283,7 @@ PicHandle wxMacCreatePict(GWorldPtr wp, GWorldPtr mask)
|
|||||||
RGBBackColor( &white ) ;
|
RGBBackColor( &white ) ;
|
||||||
|
|
||||||
if ( clipRgn )
|
if ( clipRgn )
|
||||||
SetClip( clipRgn ) ;
|
SetClip( clipRgn ) ;
|
||||||
|
|
||||||
LockPixels( GetGWorldPixMap( wp ) ) ;
|
LockPixels( GetGWorldPixMap( wp ) ) ;
|
||||||
CopyBits(GetPortBitMapForCopyBits(wp),
|
CopyBits(GetPortBitMapForCopyBits(wp),
|
||||||
@@ -296,7 +296,7 @@ PicHandle wxMacCreatePict(GWorldPtr wp, GWorldPtr mask)
|
|||||||
}
|
}
|
||||||
SetGWorld( origPort , origDev ) ;
|
SetGWorld( origPort , origDev ) ;
|
||||||
if ( clipRgn )
|
if ( clipRgn )
|
||||||
DisposeRgn( clipRgn ) ;
|
DisposeRgn( clipRgn ) ;
|
||||||
return pict;
|
return pict;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -335,19 +335,19 @@ void wxMacCreateBitmapButton( ControlButtonContentInfo*info , const wxBitmap& bi
|
|||||||
info->contentType = kControlContentPictHandle ;
|
info->contentType = kControlContentPictHandle ;
|
||||||
if ( bitmap.GetMask() )
|
if ( bitmap.GetMask() )
|
||||||
{
|
{
|
||||||
info->u.picture = wxMacCreatePict( MAC_WXHBITMAP(bmap->m_hBitmap) , MAC_WXHBITMAP(bitmap.GetMask()->GetMaskBitmap() ) ) ;
|
info->u.picture = wxMacCreatePict( MAC_WXHBITMAP(bmap->m_hBitmap) , MAC_WXHBITMAP(bitmap.GetMask()->GetMaskBitmap() ) ) ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
info->u.picture = wxMacCreatePict( MAC_WXHBITMAP(bmap->m_hBitmap) , NULL ) ;
|
info->u.picture = wxMacCreatePict( MAC_WXHBITMAP(bmap->m_hBitmap) , NULL ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( bmap->m_bitmapType == kMacBitmapTypeIcon )
|
else if ( bmap->m_bitmapType == kMacBitmapTypeIcon )
|
||||||
{
|
{
|
||||||
info->contentType = kControlContentCIconHandle ;
|
info->contentType = kControlContentCIconHandle ;
|
||||||
info->u.cIconHandle = MAC_WXHICON(bmap->m_hIcon) ;
|
info->u.cIconHandle = MAC_WXHICON(bmap->m_hIcon) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -369,46 +369,46 @@ wxBitmapRefData::wxBitmapRefData()
|
|||||||
// TODO move this to a public function of Bitmap Ref
|
// TODO move this to a public function of Bitmap Ref
|
||||||
static void DisposeBitmapRefData(wxBitmapRefData *data)
|
static void DisposeBitmapRefData(wxBitmapRefData *data)
|
||||||
{
|
{
|
||||||
if ( !data )
|
if ( !data )
|
||||||
return ;
|
return ;
|
||||||
|
|
||||||
switch (data->m_bitmapType)
|
switch (data->m_bitmapType)
|
||||||
{
|
{
|
||||||
case kMacBitmapTypePict :
|
case kMacBitmapTypePict :
|
||||||
{
|
{
|
||||||
if ( data->m_hPict )
|
if ( data->m_hPict )
|
||||||
{
|
{
|
||||||
KillPicture( MAC_WXHMETAFILE( data->m_hPict ) ) ;
|
KillPicture( MAC_WXHMETAFILE( data->m_hPict ) ) ;
|
||||||
data->m_hPict = NULL ;
|
data->m_hPict = NULL ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
case kMacBitmapTypeGrafWorld :
|
case kMacBitmapTypeGrafWorld :
|
||||||
{
|
{
|
||||||
if ( data->m_hBitmap )
|
if ( data->m_hBitmap )
|
||||||
{
|
{
|
||||||
wxMacDestroyGWorld( MAC_WXHBITMAP(data->m_hBitmap) ) ;
|
wxMacDestroyGWorld( MAC_WXHBITMAP(data->m_hBitmap) ) ;
|
||||||
data->m_hBitmap = NULL ;
|
data->m_hBitmap = NULL ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
case kMacBitmapTypeIcon :
|
case kMacBitmapTypeIcon :
|
||||||
if ( data->m_hIcon )
|
if ( data->m_hIcon )
|
||||||
{
|
{
|
||||||
DisposeCIcon( MAC_WXHICON(data->m_hIcon) ) ;
|
DisposeCIcon( MAC_WXHICON(data->m_hIcon) ) ;
|
||||||
data->m_hIcon = NULL ;
|
data->m_hIcon = NULL ;
|
||||||
}
|
}
|
||||||
|
|
||||||
default :
|
default :
|
||||||
// unkown type ?
|
// unkown type ?
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data->m_bitmapMask)
|
if (data->m_bitmapMask)
|
||||||
{
|
{
|
||||||
delete data->m_bitmapMask;
|
delete data->m_bitmapMask;
|
||||||
data->m_bitmapMask = NULL;
|
data->m_bitmapMask = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxBitmapRefData::~wxBitmapRefData()
|
wxBitmapRefData::~wxBitmapRefData()
|
||||||
@@ -642,8 +642,8 @@ void wxBitmap::SetHBITMAP(WXHBITMAP bmp)
|
|||||||
{
|
{
|
||||||
if (!M_BITMAPDATA)
|
if (!M_BITMAPDATA)
|
||||||
m_refData = new wxBitmapRefData;
|
m_refData = new wxBitmapRefData;
|
||||||
else
|
else
|
||||||
DisposeBitmapRefData( M_BITMAPDATA ) ;
|
DisposeBitmapRefData( M_BITMAPDATA ) ;
|
||||||
|
|
||||||
M_BITMAPDATA->m_bitmapType = kMacBitmapTypeGrafWorld ;
|
M_BITMAPDATA->m_bitmapType = kMacBitmapTypeGrafWorld ;
|
||||||
M_BITMAPDATA->m_hBitmap = bmp ;
|
M_BITMAPDATA->m_hBitmap = bmp ;
|
||||||
@@ -654,8 +654,8 @@ void wxBitmap::SetHICON(WXHICON ico)
|
|||||||
{
|
{
|
||||||
if (!M_BITMAPDATA)
|
if (!M_BITMAPDATA)
|
||||||
m_refData = new wxBitmapRefData;
|
m_refData = new wxBitmapRefData;
|
||||||
else
|
else
|
||||||
DisposeBitmapRefData( M_BITMAPDATA ) ;
|
DisposeBitmapRefData( M_BITMAPDATA ) ;
|
||||||
|
|
||||||
M_BITMAPDATA->m_bitmapType = kMacBitmapTypeIcon ;
|
M_BITMAPDATA->m_bitmapType = kMacBitmapTypeIcon ;
|
||||||
M_BITMAPDATA->m_hIcon = ico ;
|
M_BITMAPDATA->m_hIcon = ico ;
|
||||||
@@ -666,8 +666,8 @@ void wxBitmap::SetPict(WXHMETAFILE pict)
|
|||||||
{
|
{
|
||||||
if (!M_BITMAPDATA)
|
if (!M_BITMAPDATA)
|
||||||
m_refData = new wxBitmapRefData;
|
m_refData = new wxBitmapRefData;
|
||||||
else
|
else
|
||||||
DisposeBitmapRefData( M_BITMAPDATA ) ;
|
DisposeBitmapRefData( M_BITMAPDATA ) ;
|
||||||
|
|
||||||
M_BITMAPDATA->m_bitmapType = kMacBitmapTypePict ;
|
M_BITMAPDATA->m_bitmapType = kMacBitmapTypePict ;
|
||||||
M_BITMAPDATA->m_hPict = pict ;
|
M_BITMAPDATA->m_hPict = pict ;
|
||||||
@@ -820,26 +820,26 @@ wxImage wxBitmap::ConvertToImage() const
|
|||||||
GetGWorld( &origPort, &origDevice );
|
GetGWorld( &origPort, &origDevice );
|
||||||
if ( GetBitmapType() != kMacBitmapTypeGrafWorld )
|
if ( GetBitmapType() != kMacBitmapTypeGrafWorld )
|
||||||
{
|
{
|
||||||
tempPort = wxMacCreateGWorld( width , height , -1) ;
|
tempPort = wxMacCreateGWorld( width , height , -1) ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tempPort = (GWorldPtr) GetHBITMAP() ;
|
tempPort = (GWorldPtr) GetHBITMAP() ;
|
||||||
}
|
}
|
||||||
LockPixels(GetGWorldPixMap(tempPort));
|
LockPixels(GetGWorldPixMap(tempPort));
|
||||||
SetGWorld( tempPort, NULL);
|
SetGWorld( tempPort, NULL);
|
||||||
if ( GetBitmapType() == kMacBitmapTypePict || GetBitmapType() == kMacBitmapTypeIcon )
|
if ( GetBitmapType() == kMacBitmapTypePict || GetBitmapType() == kMacBitmapTypeIcon )
|
||||||
{
|
{
|
||||||
Rect bitmaprect = { 0 , 0 , height, width };
|
Rect bitmaprect = { 0 , 0 , height, width };
|
||||||
if ( GetBitmapType() == kMacBitmapTypeIcon )
|
if ( GetBitmapType() == kMacBitmapTypeIcon )
|
||||||
{
|
{
|
||||||
::PlotCIconHandle( &bitmaprect , atNone , ttNone , MAC_WXHICON(GetHICON()) ) ;
|
::PlotCIconHandle( &bitmaprect , atNone , ttNone , MAC_WXHICON(GetHICON()) ) ;
|
||||||
maskRgn = NewRgn() ;
|
maskRgn = NewRgn() ;
|
||||||
BitMapToRegion( maskRgn , &(**(MAC_WXHICON(GetHICON()))).iconMask ) ;
|
BitMapToRegion( maskRgn , &(**(MAC_WXHICON(GetHICON()))).iconMask ) ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
::DrawPicture( (PicHandle) GetPict(), &bitmaprect ) ;
|
::DrawPicture( (PicHandle) GetPict(), &bitmaprect ) ;
|
||||||
}
|
}
|
||||||
// Copy data into image
|
// Copy data into image
|
||||||
index = 0;
|
index = 0;
|
||||||
for (int yy = 0; yy < height; yy++)
|
for (int yy = 0; yy < height; yy++)
|
||||||
@@ -855,27 +855,27 @@ wxImage wxBitmap::ConvertToImage() const
|
|||||||
data[index + 2] = b;
|
data[index + 2] = b;
|
||||||
if ( maskRgn )
|
if ( maskRgn )
|
||||||
{
|
{
|
||||||
Point pt ;
|
Point pt ;
|
||||||
pt.h = xx ;
|
pt.h = xx ;
|
||||||
pt.v = yy ;
|
pt.v = yy ;
|
||||||
if ( !PtInRgn( pt , maskRgn ) )
|
if ( !PtInRgn( pt , maskRgn ) )
|
||||||
{
|
{
|
||||||
data[index ] = mask_r;
|
data[index ] = mask_r;
|
||||||
data[index + 1] = mask_g;
|
data[index + 1] = mask_g;
|
||||||
data[index + 2] = mask_b;
|
data[index + 2] = mask_b;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (mask)
|
if (mask)
|
||||||
{
|
{
|
||||||
if (mask->PointMasked(xx,yy))
|
if (mask->PointMasked(xx,yy))
|
||||||
{
|
{
|
||||||
data[index ] = mask_r;
|
data[index ] = mask_r;
|
||||||
data[index + 1] = mask_g;
|
data[index + 1] = mask_g;
|
||||||
data[index + 2] = mask_b;
|
data[index + 2] = mask_b;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
index += 3;
|
index += 3;
|
||||||
}
|
}
|
||||||
@@ -891,11 +891,11 @@ wxImage wxBitmap::ConvertToImage() const
|
|||||||
SetGWorld(origPort, origDevice);
|
SetGWorld(origPort, origDevice);
|
||||||
if ( GetBitmapType() != kMacBitmapTypeGrafWorld )
|
if ( GetBitmapType() != kMacBitmapTypeGrafWorld )
|
||||||
{
|
{
|
||||||
wxMacDestroyGWorld( tempPort ) ;
|
wxMacDestroyGWorld( tempPort ) ;
|
||||||
}
|
}
|
||||||
if ( maskRgn )
|
if ( maskRgn )
|
||||||
{
|
{
|
||||||
DisposeRgn( maskRgn ) ;
|
DisposeRgn( maskRgn ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
return image;
|
return image;
|
||||||
@@ -1038,33 +1038,33 @@ WXHBITMAP wxBitmap::GetHBITMAP() const
|
|||||||
|
|
||||||
WXHMETAFILE wxBitmap::GetPict( bool *created ) const
|
WXHMETAFILE wxBitmap::GetPict( bool *created ) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( Ok(), NULL, wxT("invalid bitmap") );
|
wxCHECK_MSG( Ok(), NULL, wxT("invalid bitmap") );
|
||||||
|
|
||||||
PicHandle picture = NULL ; // This is the returned picture
|
PicHandle picture = NULL ; // This is the returned picture
|
||||||
if ( created )
|
if ( created )
|
||||||
(*created) = false ;
|
(*created) = false ;
|
||||||
// If bitmap already in Pict format return pointer
|
// If bitmap already in Pict format return pointer
|
||||||
if(M_BITMAPDATA->m_bitmapType == kMacBitmapTypePict) {
|
if(M_BITMAPDATA->m_bitmapType == kMacBitmapTypePict) {
|
||||||
return M_BITMAPDATA->m_hPict;
|
return M_BITMAPDATA->m_hPict;
|
||||||
}
|
|
||||||
else if(M_BITMAPDATA->m_bitmapType != kMacBitmapTypeGrafWorld) {
|
|
||||||
// Invalid bitmap
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ( GetMask() )
|
|
||||||
{
|
|
||||||
picture = wxMacCreatePict( MAC_WXHBITMAP(M_BITMAPDATA->m_hBitmap) , MAC_WXHBITMAP(GetMask()->GetMaskBitmap() ) ) ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
picture = wxMacCreatePict( MAC_WXHBITMAP(M_BITMAPDATA->m_hBitmap) , NULL ) ;
|
|
||||||
}
|
|
||||||
if ( created && picture )
|
|
||||||
(*created) = true ;
|
|
||||||
}
|
}
|
||||||
return picture ;
|
else if(M_BITMAPDATA->m_bitmapType != kMacBitmapTypeGrafWorld) {
|
||||||
|
// Invalid bitmap
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( GetMask() )
|
||||||
|
{
|
||||||
|
picture = wxMacCreatePict( MAC_WXHBITMAP(M_BITMAPDATA->m_hBitmap) , MAC_WXHBITMAP(GetMask()->GetMaskBitmap() ) ) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
picture = wxMacCreatePict( MAC_WXHBITMAP(M_BITMAPDATA->m_hBitmap) , NULL ) ;
|
||||||
|
}
|
||||||
|
if ( created && picture )
|
||||||
|
(*created) = true ;
|
||||||
|
}
|
||||||
|
return picture ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -45,35 +45,35 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit
|
|||||||
m_windowId = id;
|
m_windowId = id;
|
||||||
|
|
||||||
if ( width == -1 && bitmap.Ok())
|
if ( width == -1 && bitmap.Ok())
|
||||||
width = bitmap.GetWidth() + 2*m_marginX;
|
width = bitmap.GetWidth() + 2*m_marginX;
|
||||||
|
|
||||||
if ( height == -1 && bitmap.Ok())
|
if ( height == -1 && bitmap.Ok())
|
||||||
height = bitmap.GetHeight() + 2*m_marginY;
|
height = bitmap.GetHeight() + 2*m_marginY;
|
||||||
|
|
||||||
Rect bounds ;
|
Rect bounds ;
|
||||||
Str255 title ;
|
Str255 title ;
|
||||||
m_bmpNormal = bitmap;
|
m_bmpNormal = bitmap;
|
||||||
wxBitmapRefData * bmap = NULL ;
|
wxBitmapRefData * bmap = NULL ;
|
||||||
|
|
||||||
if ( m_bmpNormal.Ok() )
|
if ( m_bmpNormal.Ok() )
|
||||||
bmap = (wxBitmapRefData*) ( m_bmpNormal.GetRefData()) ;
|
bmap = (wxBitmapRefData*) ( m_bmpNormal.GetRefData()) ;
|
||||||
|
|
||||||
MacPreControlCreate( parent , id , "" , pos , wxSize( width , height ) ,style, validator , name , &bounds , title ) ;
|
MacPreControlCreate( parent , id , "" , pos , wxSize( width , height ) ,style, validator , name , &bounds , title ) ;
|
||||||
|
|
||||||
m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 ,
|
m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 ,
|
||||||
kControlBehaviorOffsetContents +
|
kControlBehaviorOffsetContents +
|
||||||
( bmap && bmap->m_bitmapType == kMacBitmapTypeIcon ?
|
( bmap && bmap->m_bitmapType == kMacBitmapTypeIcon ?
|
||||||
kControlContentCIconHandle : kControlContentPictHandle ) , 0,
|
kControlContentCIconHandle : kControlContentPictHandle ) , 0,
|
||||||
(( style & wxBU_AUTODRAW ) ? kControlBevelButtonSmallBevelProc : kControlBevelButtonNormalBevelProc ), (long) this ) ;
|
(( style & wxBU_AUTODRAW ) ? kControlBevelButtonSmallBevelProc : kControlBevelButtonNormalBevelProc ), (long) this ) ;
|
||||||
wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
|
wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
|
||||||
|
|
||||||
ControlButtonContentInfo info ;
|
ControlButtonContentInfo info ;
|
||||||
wxMacCreateBitmapButton( &info , m_bmpNormal ) ;
|
wxMacCreateBitmapButton( &info , m_bmpNormal ) ;
|
||||||
if ( info.contentType != kControlNoContent )
|
if ( info.contentType != kControlNoContent )
|
||||||
{
|
{
|
||||||
::SetControlData( (ControlHandle) m_macControl , kControlButtonPart , kControlBevelButtonContentTag , sizeof(info) , (char*) &info ) ;
|
::SetControlData( (ControlHandle) m_macControl , kControlButtonPart , kControlBevelButtonContentTag , sizeof(info) , (char*) &info ) ;
|
||||||
}
|
}
|
||||||
MacPostControlCreate() ;
|
MacPostControlCreate() ;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -112,17 +112,17 @@ wxBrush::wxBrush(ThemeBrush macThemeBrush )
|
|||||||
}
|
}
|
||||||
void wxBrush::Unshare()
|
void wxBrush::Unshare()
|
||||||
{
|
{
|
||||||
// Don't change shared data
|
// Don't change shared data
|
||||||
if (!m_refData)
|
if (!m_refData)
|
||||||
{
|
{
|
||||||
m_refData = new wxBrushRefData();
|
m_refData = new wxBrushRefData();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxBrushRefData* ref = new wxBrushRefData(*(wxBrushRefData*)m_refData);
|
wxBrushRefData* ref = new wxBrushRefData(*(wxBrushRefData*)m_refData);
|
||||||
UnRef();
|
UnRef();
|
||||||
m_refData = ref;
|
m_refData = ref;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxBrush::SetColour(const wxColour& col)
|
void wxBrush::SetColour(const wxColour& col)
|
||||||
@@ -203,25 +203,27 @@ unsigned long wxBrush::GetMacThemeBackground( WXRECTPTR extent) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
short wxBrush::GetMacTheme() const
|
short wxBrush::GetMacTheme() const
|
||||||
{
|
{
|
||||||
return (M_BRUSHDATA ? ( M_BRUSHDATA->m_macBrushKind == kwxMacBrushTheme ? M_BRUSHDATA->m_macThemeBrush : kThemeBrushBlack) : kThemeBrushBlack);
|
return (M_BRUSHDATA ? ( M_BRUSHDATA->m_macBrushKind == kwxMacBrushTheme ? M_BRUSHDATA->m_macThemeBrush : kThemeBrushBlack) : kThemeBrushBlack);
|
||||||
};
|
}
|
||||||
|
|
||||||
wxColour& wxBrush::GetColour() const
|
wxColour& wxBrush::GetColour() const
|
||||||
{ return (M_BRUSHDATA ? M_BRUSHDATA->m_colour : wxNullColour); };
|
{
|
||||||
|
return (M_BRUSHDATA ? M_BRUSHDATA->m_colour : wxNullColour);
|
||||||
|
}
|
||||||
|
|
||||||
int wxBrush::GetStyle() const
|
int wxBrush::GetStyle() const
|
||||||
{
|
{
|
||||||
return (M_BRUSHDATA ? M_BRUSHDATA->m_style : 0);
|
return (M_BRUSHDATA ? M_BRUSHDATA->m_style : 0);
|
||||||
};
|
}
|
||||||
|
|
||||||
wxBitmap *wxBrush::GetStipple() const
|
wxBitmap *wxBrush::GetStipple() const
|
||||||
{
|
{
|
||||||
return (M_BRUSHDATA ? & M_BRUSHDATA->m_stipple : 0);
|
return (M_BRUSHDATA ? & M_BRUSHDATA->m_stipple : 0);
|
||||||
};
|
}
|
||||||
|
|
||||||
wxMacBrushKind wxBrush::MacGetBrushKind() const
|
wxMacBrushKind wxBrush::MacGetBrushKind() const
|
||||||
{
|
{
|
||||||
return (M_BRUSHDATA ? M_BRUSHDATA->m_macBrushKind : kwxMacBrushColour);
|
return (M_BRUSHDATA ? M_BRUSHDATA->m_macBrushKind : kwxMacBrushColour);
|
||||||
};
|
}
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -34,8 +34,8 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label,
|
|||||||
const wxValidator& validator,
|
const wxValidator& validator,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
Rect bounds ;
|
Rect bounds ;
|
||||||
Str255 title ;
|
Str255 title ;
|
||||||
|
|
||||||
if ( UMAHasAquaLayout() )
|
if ( UMAHasAquaLayout() )
|
||||||
{
|
{
|
||||||
@@ -43,13 +43,13 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label,
|
|||||||
m_macVerticalBorder = kMacOSXVerticalBorder;
|
m_macVerticalBorder = kMacOSXVerticalBorder;
|
||||||
}
|
}
|
||||||
|
|
||||||
MacPreControlCreate( parent , id , label , pos , size ,style, validator , name , &bounds , title ) ;
|
MacPreControlCreate( parent , id , label , pos , size ,style, validator , name , &bounds , title ) ;
|
||||||
|
|
||||||
m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1,
|
m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1,
|
||||||
kControlPushButtonProc , (long) this ) ;
|
kControlPushButtonProc , (long) this ) ;
|
||||||
wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
|
wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
|
||||||
|
|
||||||
MacPostControlCreate() ;
|
MacPostControlCreate() ;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -65,19 +65,19 @@ void wxButton::SetDefault()
|
|||||||
parent->SetDefaultItem(this);
|
parent->SetDefaultItem(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
Boolean inData;
|
Boolean inData;
|
||||||
if ( btnOldDefault && btnOldDefault->m_macControl )
|
if ( btnOldDefault && btnOldDefault->m_macControl )
|
||||||
{
|
{
|
||||||
inData = 0;
|
inData = 0;
|
||||||
::SetControlData( (ControlHandle) btnOldDefault->m_macControl , kControlButtonPart ,
|
::SetControlData( (ControlHandle) btnOldDefault->m_macControl , kControlButtonPart ,
|
||||||
kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)(&inData) ) ;
|
kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)(&inData) ) ;
|
||||||
}
|
}
|
||||||
if ( (ControlHandle) m_macControl )
|
if ( (ControlHandle) m_macControl )
|
||||||
{
|
{
|
||||||
inData = 1;
|
inData = 1;
|
||||||
::SetControlData( (ControlHandle) m_macControl , kControlButtonPart ,
|
::SetControlData( (ControlHandle) m_macControl , kControlButtonPart ,
|
||||||
kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)(&inData) ) ;
|
kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)(&inData) ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSize wxButton::DoGetBestSize() const
|
wxSize wxButton::DoGetBestSize() const
|
||||||
@@ -94,7 +94,7 @@ wxSize wxButton::DoGetBestSize() const
|
|||||||
wxSize wxButton::GetDefaultSize()
|
wxSize wxButton::GetDefaultSize()
|
||||||
{
|
{
|
||||||
int wBtn = 70 ;
|
int wBtn = 70 ;
|
||||||
int hBtn = 20 ;
|
int hBtn = 20 ;
|
||||||
|
|
||||||
if ( UMAHasAquaLayout() )
|
if ( UMAHasAquaLayout() )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -289,21 +289,21 @@ void wxApp::MacNewFile()
|
|||||||
|
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
|
|
||||||
static const EventTypeSpec eventList[] =
|
static const EventTypeSpec eventList[] =
|
||||||
{
|
{
|
||||||
{ kEventClassCommand, kEventProcessCommand } ,
|
{ kEventClassCommand, kEventProcessCommand } ,
|
||||||
{ kEventClassCommand, kEventCommandUpdateStatus } ,
|
{ kEventClassCommand, kEventCommandUpdateStatus } ,
|
||||||
|
|
||||||
{ kEventClassApplication , kEventAppActivated } ,
|
{ kEventClassApplication , kEventAppActivated } ,
|
||||||
{ kEventClassApplication , kEventAppDeactivated } ,
|
{ kEventClassApplication , kEventAppDeactivated } ,
|
||||||
// handling the quit event is not recommended by apple
|
// handling the quit event is not recommended by apple
|
||||||
// rather using the quit apple event - which we do
|
// rather using the quit apple event - which we do
|
||||||
|
|
||||||
{ kEventClassAppleEvent , kEventAppleEvent } ,
|
{ kEventClassAppleEvent , kEventAppleEvent } ,
|
||||||
|
|
||||||
{ kEventClassMouse , kEventMouseDown } ,
|
{ kEventClassMouse , kEventMouseDown } ,
|
||||||
{ 'WXMC' , 'WXMC' }
|
{ 'WXMC' , 'WXMC' }
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
static pascal OSStatus MenuEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
|
static pascal OSStatus MenuEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
|
||||||
{
|
{
|
||||||
@@ -323,22 +323,22 @@ static pascal OSStatus MouseEventHandler( EventHandlerCallRef handler , EventRef
|
|||||||
|
|
||||||
switch( GetEventKind(event) )
|
switch( GetEventKind(event) )
|
||||||
{
|
{
|
||||||
case kEventMouseDown :
|
case kEventMouseDown :
|
||||||
{
|
{
|
||||||
Point point ;
|
Point point ;
|
||||||
WindowRef window ;
|
WindowRef window ;
|
||||||
|
|
||||||
GetEventParameter( event, kEventParamMouseLocation, typeQDPoint, NULL,
|
GetEventParameter( event, kEventParamMouseLocation, typeQDPoint, NULL,
|
||||||
sizeof( Point ), NULL, &point );
|
sizeof( Point ), NULL, &point );
|
||||||
short windowPart = ::FindWindow(point, &window);
|
short windowPart = ::FindWindow(point, &window);
|
||||||
|
|
||||||
if ( windowPart == inMenuBar )
|
if ( windowPart == inMenuBar )
|
||||||
{
|
{
|
||||||
MenuSelect( point ) ;
|
MenuSelect( point ) ;
|
||||||
result = noErr ;
|
result = noErr ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result ;
|
return result ;
|
||||||
@@ -348,14 +348,14 @@ static pascal OSStatus CommandEventHandler( EventHandlerCallRef handler , EventR
|
|||||||
{
|
{
|
||||||
OSStatus result = eventNotHandledErr ;
|
OSStatus result = eventNotHandledErr ;
|
||||||
|
|
||||||
HICommand command ;
|
HICommand command ;
|
||||||
|
|
||||||
GetEventParameter( event, kEventParamDirectObject, typeHICommand, NULL,
|
GetEventParameter( event, kEventParamDirectObject, typeHICommand, NULL,
|
||||||
sizeof( HICommand ), NULL, &command );
|
sizeof( HICommand ), NULL, &command );
|
||||||
|
|
||||||
MenuCommand id = command.commandID ;
|
MenuCommand id = command.commandID ;
|
||||||
if ( id == kHICommandPreferences )
|
if ( id == kHICommandPreferences )
|
||||||
id = wxApp::s_macPreferencesMenuItemId ;
|
id = wxApp::s_macPreferencesMenuItemId ;
|
||||||
|
|
||||||
wxMenuBar* mbar = wxMenuBar::MacGetInstalledMenuBar() ;
|
wxMenuBar* mbar = wxMenuBar::MacGetInstalledMenuBar() ;
|
||||||
wxMenu* menu = NULL ;
|
wxMenu* menu = NULL ;
|
||||||
@@ -365,28 +365,28 @@ static pascal OSStatus CommandEventHandler( EventHandlerCallRef handler , EventR
|
|||||||
item = mbar->FindItem( id , &menu ) ;
|
item = mbar->FindItem( id , &menu ) ;
|
||||||
|
|
||||||
if ( item == NULL || menu == NULL || mbar == NULL )
|
if ( item == NULL || menu == NULL || mbar == NULL )
|
||||||
return result ;
|
return result ;
|
||||||
|
|
||||||
switch( GetEventKind( event ) )
|
switch( GetEventKind( event ) )
|
||||||
{
|
{
|
||||||
case kEventProcessCommand :
|
case kEventProcessCommand :
|
||||||
{
|
{
|
||||||
if (item->IsCheckable())
|
if (item->IsCheckable())
|
||||||
{
|
{
|
||||||
item->Check( !item->IsChecked() ) ;
|
item->Check( !item->IsChecked() ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
menu->SendEvent( id , item->IsCheckable() ? item->IsChecked() : -1 ) ;
|
menu->SendEvent( id , item->IsCheckable() ? item->IsChecked() : -1 ) ;
|
||||||
result = noErr ;
|
result = noErr ;
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
case kEventCommandUpdateStatus:
|
case kEventCommandUpdateStatus:
|
||||||
// eventually trigger an updateui round
|
// eventually trigger an updateui round
|
||||||
result = noErr ;
|
result = noErr ;
|
||||||
break ;
|
break ;
|
||||||
default :
|
default :
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result ;
|
return result ;
|
||||||
}
|
}
|
||||||
@@ -394,23 +394,23 @@ static pascal OSStatus CommandEventHandler( EventHandlerCallRef handler , EventR
|
|||||||
static pascal OSStatus ApplicationEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
|
static pascal OSStatus ApplicationEventHandler( EventHandlerCallRef handler , EventRef event , void *data )
|
||||||
{
|
{
|
||||||
OSStatus result = eventNotHandledErr ;
|
OSStatus result = eventNotHandledErr ;
|
||||||
switch ( GetEventKind( event ) )
|
switch ( GetEventKind( event ) )
|
||||||
{
|
{
|
||||||
case kEventAppActivated :
|
case kEventAppActivated :
|
||||||
{
|
{
|
||||||
wxTheApp->MacResume( true ) ;
|
wxTheApp->MacResume( true ) ;
|
||||||
result = noErr ;
|
result = noErr ;
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
case kEventAppDeactivated :
|
case kEventAppDeactivated :
|
||||||
{
|
{
|
||||||
wxTheApp->MacSuspend( true ) ;
|
wxTheApp->MacSuspend( true ) ;
|
||||||
result = noErr ;
|
result = noErr ;
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
default :
|
default :
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
return result ;
|
return result ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -419,27 +419,27 @@ pascal OSStatus wxAppEventHandler( EventHandlerCallRef handler , EventRef event
|
|||||||
OSStatus result = eventNotHandledErr ;
|
OSStatus result = eventNotHandledErr ;
|
||||||
switch( GetEventClass( event ) )
|
switch( GetEventClass( event ) )
|
||||||
{
|
{
|
||||||
case kEventClassCommand :
|
case kEventClassCommand :
|
||||||
result = CommandEventHandler( handler , event , data ) ;
|
result = CommandEventHandler( handler , event , data ) ;
|
||||||
break ;
|
break ;
|
||||||
case kEventClassApplication :
|
case kEventClassApplication :
|
||||||
result = ApplicationEventHandler( handler , event , data ) ;
|
result = ApplicationEventHandler( handler , event , data ) ;
|
||||||
break ;
|
break ;
|
||||||
case kEventClassMenu :
|
case kEventClassMenu :
|
||||||
result = MenuEventHandler( handler , event , data ) ;
|
result = MenuEventHandler( handler , event , data ) ;
|
||||||
break ;
|
break ;
|
||||||
case kEventClassMouse :
|
case kEventClassMouse :
|
||||||
result = MouseEventHandler( handler , event , data ) ;
|
result = MouseEventHandler( handler , event , data ) ;
|
||||||
break ;
|
break ;
|
||||||
case kEventClassAppleEvent :
|
case kEventClassAppleEvent :
|
||||||
{
|
{
|
||||||
EventRecord rec ;
|
EventRecord rec ;
|
||||||
wxMacConvertEventToRecord( event , &rec ) ;
|
wxMacConvertEventToRecord( event , &rec ) ;
|
||||||
result = AEProcessAppleEvent( &rec ) ;
|
result = AEProcessAppleEvent( &rec ) ;
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
default :
|
default :
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result ;
|
return result ;
|
||||||
@@ -532,7 +532,7 @@ bool wxApp::Initialize()
|
|||||||
|
|
||||||
#ifndef __DARWIN__
|
#ifndef __DARWIN__
|
||||||
// now avoid exceptions thrown for new (bad_alloc)
|
// now avoid exceptions thrown for new (bad_alloc)
|
||||||
// FIXME CS for some changes outside wxMac does not compile anymore
|
// FIXME CS for some changes outside wxMac does not compile anymore
|
||||||
#if 0
|
#if 0
|
||||||
std::__throws_bad_alloc = 0 ;
|
std::__throws_bad_alloc = 0 ;
|
||||||
#endif
|
#endif
|
||||||
@@ -593,15 +593,15 @@ bool wxApp::Initialize()
|
|||||||
|
|
||||||
bool wxApp::OnInitGui()
|
bool wxApp::OnInitGui()
|
||||||
{
|
{
|
||||||
if( !wxAppBase::OnInitGui() )
|
if( !wxAppBase::OnInitGui() )
|
||||||
return false ;
|
return false ;
|
||||||
|
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
InstallStandardEventHandler( GetApplicationEventTarget() ) ;
|
InstallStandardEventHandler( GetApplicationEventTarget() ) ;
|
||||||
|
|
||||||
InstallApplicationEventHandler(
|
InstallApplicationEventHandler(
|
||||||
GetwxAppEventHandlerUPP(),
|
GetwxAppEventHandlerUPP(),
|
||||||
GetEventTypeCount(eventList), eventList, wxTheApp, &((EventHandlerRef)wxTheApp->m_macEventHandler));
|
GetEventTypeCount(eventList), eventList, wxTheApp, &((EventHandlerRef)wxTheApp->m_macEventHandler));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340)
|
#if defined(UNIVERSAL_INTERFACES_VERSION) && (UNIVERSAL_INTERFACES_VERSION >= 0x0340)
|
||||||
@@ -632,7 +632,7 @@ bool wxApp::OnInitGui()
|
|||||||
0 , FALSE ) ;
|
0 , FALSE ) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return TRUE ;
|
return TRUE ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxApp::CleanUp()
|
void wxApp::CleanUp()
|
||||||
@@ -879,7 +879,7 @@ void wxStAppResource::CloseSharedLibraryResource()
|
|||||||
// the __wxinitialize and __wxterminate must be used
|
// the __wxinitialize and __wxterminate must be used
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
void __sinit(void); /* (generated by linker) */
|
void __sinit(void); /* (generated by linker) */
|
||||||
pascal OSErr __initialize(const CFragInitBlock *theInitBlock);
|
pascal OSErr __initialize(const CFragInitBlock *theInitBlock);
|
||||||
pascal void __terminate(void);
|
pascal void __terminate(void);
|
||||||
}
|
}
|
||||||
@@ -1149,14 +1149,14 @@ bool wxApp::Initialized()
|
|||||||
|
|
||||||
int wxApp::MainLoop()
|
int wxApp::MainLoop()
|
||||||
{
|
{
|
||||||
m_keepGoing = TRUE;
|
m_keepGoing = TRUE;
|
||||||
|
|
||||||
while (m_keepGoing)
|
while (m_keepGoing)
|
||||||
{
|
{
|
||||||
MacDoOneEvent() ;
|
MacDoOneEvent() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns TRUE if more time is needed.
|
// Returns TRUE if more time is needed.
|
||||||
@@ -1171,18 +1171,18 @@ bool wxApp::ProcessIdle()
|
|||||||
|
|
||||||
void wxApp::ExitMainLoop()
|
void wxApp::ExitMainLoop()
|
||||||
{
|
{
|
||||||
m_keepGoing = FALSE;
|
m_keepGoing = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Is a message/event pending?
|
// Is a message/event pending?
|
||||||
bool wxApp::Pending()
|
bool wxApp::Pending()
|
||||||
{
|
{
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
return GetNumEventsInQueue( GetMainEventQueue() ) > 0 ;
|
return GetNumEventsInQueue( GetMainEventQueue() ) > 0 ;
|
||||||
#else
|
#else
|
||||||
EventRecord event ;
|
EventRecord event ;
|
||||||
|
|
||||||
return EventAvail( everyEvent , &event ) ;
|
return EventAvail( everyEvent , &event ) ;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1336,39 +1336,39 @@ bool wxApp::Yield(bool onlyIfNeeded)
|
|||||||
#if wxUSE_THREADS
|
#if wxUSE_THREADS
|
||||||
YieldToAnyThread() ;
|
YieldToAnyThread() ;
|
||||||
#endif
|
#endif
|
||||||
// by definition yield should handle all non-processed events
|
// by definition yield should handle all non-processed events
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
EventRef theEvent;
|
EventRef theEvent;
|
||||||
|
|
||||||
OSStatus status = noErr ;
|
OSStatus status = noErr ;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
s_inReceiveEvent = true ;
|
s_inReceiveEvent = true ;
|
||||||
status = ReceiveNextEvent(0, NULL,kEventDurationNoWait,true,&theEvent) ;
|
status = ReceiveNextEvent(0, NULL,kEventDurationNoWait,true,&theEvent) ;
|
||||||
s_inReceiveEvent = false ;
|
s_inReceiveEvent = false ;
|
||||||
|
|
||||||
if ( status == eventLoopTimedOutErr )
|
if ( status == eventLoopTimedOutErr )
|
||||||
{
|
{
|
||||||
// make sure next time the event loop will trigger idle events
|
// make sure next time the event loop will trigger idle events
|
||||||
sleepTime = kEventDurationNoWait ;
|
sleepTime = kEventDurationNoWait ;
|
||||||
}
|
}
|
||||||
else if ( status == eventLoopQuitErr )
|
else if ( status == eventLoopQuitErr )
|
||||||
{
|
{
|
||||||
// according to QA1061 this may also occur when a WakeUp Process
|
// according to QA1061 this may also occur when a WakeUp Process
|
||||||
// is executed
|
// is executed
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MacHandleOneEvent( theEvent ) ;
|
MacHandleOneEvent( theEvent ) ;
|
||||||
ReleaseEvent(theEvent);
|
ReleaseEvent(theEvent);
|
||||||
}
|
}
|
||||||
} while( status == noErr ) ;
|
} while( status == noErr ) ;
|
||||||
#else
|
#else
|
||||||
EventRecord event ;
|
EventRecord event ;
|
||||||
|
|
||||||
// having a larger value here leads to large performance slowdowns
|
// having a larger value here leads to large performance slowdowns
|
||||||
// so we cannot give background apps more processor time here
|
// so we cannot give background apps more processor time here
|
||||||
// we do so however having a large sleep value in the main event loop
|
// we do so however having a large sleep value in the main event loop
|
||||||
sleepTime = 0 ;
|
sleepTime = 0 ;
|
||||||
|
|
||||||
while ( !IsExiting() && WaitNextEvent(everyEvent, &event,sleepTime, (RgnHandle) wxApp::s_macCursorRgn))
|
while ( !IsExiting() && WaitNextEvent(everyEvent, &event,sleepTime, (RgnHandle) wxApp::s_macCursorRgn))
|
||||||
@@ -1449,32 +1449,32 @@ void wxApp::MacConvertPublicToPrivateScrap()
|
|||||||
void wxApp::MacDoOneEvent()
|
void wxApp::MacDoOneEvent()
|
||||||
{
|
{
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
EventRef theEvent;
|
EventRef theEvent;
|
||||||
|
|
||||||
s_inReceiveEvent = true ;
|
s_inReceiveEvent = true ;
|
||||||
OSStatus status = ReceiveNextEvent(0, NULL,sleepTime,true,&theEvent) ;
|
OSStatus status = ReceiveNextEvent(0, NULL,sleepTime,true,&theEvent) ;
|
||||||
s_inReceiveEvent = false ;
|
s_inReceiveEvent = false ;
|
||||||
if ( status == eventLoopTimedOutErr )
|
if ( status == eventLoopTimedOutErr )
|
||||||
{
|
{
|
||||||
if ( wxTheApp->ProcessIdle() )
|
if ( wxTheApp->ProcessIdle() )
|
||||||
sleepTime = kEventDurationNoWait ;
|
sleepTime = kEventDurationNoWait ;
|
||||||
else
|
else
|
||||||
sleepTime = kEventDurationForever ;
|
sleepTime = kEventDurationForever ;
|
||||||
}
|
}
|
||||||
else if ( status == eventLoopQuitErr )
|
else if ( status == eventLoopQuitErr )
|
||||||
{
|
{
|
||||||
// according to QA1061 this may also occur when a WakeUp Process
|
// according to QA1061 this may also occur when a WakeUp Process
|
||||||
// is executed
|
// is executed
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MacHandleOneEvent( theEvent ) ;
|
MacHandleOneEvent( theEvent ) ;
|
||||||
ReleaseEvent(theEvent);
|
ReleaseEvent(theEvent);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
EventRecord event ;
|
EventRecord event ;
|
||||||
|
|
||||||
EventMask eventMask = everyEvent ;
|
EventMask eventMask = everyEvent ;
|
||||||
|
|
||||||
if (WaitNextEvent(eventMask, &event, sleepTime, (RgnHandle) s_macCursorRgn))
|
if (WaitNextEvent(eventMask, &event, sleepTime, (RgnHandle) s_macCursorRgn))
|
||||||
{
|
{
|
||||||
@@ -1490,9 +1490,9 @@ void wxApp::MacDoOneEvent()
|
|||||||
::IdleControls( window ) ;
|
::IdleControls( window ) ;
|
||||||
|
|
||||||
if ( wxTheApp->ProcessIdle() )
|
if ( wxTheApp->ProcessIdle() )
|
||||||
sleepTime = 0 ;
|
sleepTime = 0 ;
|
||||||
else
|
else
|
||||||
sleepTime = GetCaretTime() / 2 ;
|
sleepTime = GetCaretTime() / 2 ;
|
||||||
}
|
}
|
||||||
if ( event.what != kHighLevelEvent )
|
if ( event.what != kHighLevelEvent )
|
||||||
SetRectRgn( (RgnHandle) s_macCursorRgn , event.where.h , event.where.v , event.where.h + 1 , event.where.v + 1 ) ;
|
SetRectRgn( (RgnHandle) s_macCursorRgn , event.where.h , event.where.v , event.where.h + 1 , event.where.v + 1 ) ;
|
||||||
@@ -1506,10 +1506,10 @@ void wxApp::MacDoOneEvent()
|
|||||||
void wxApp::MacHandleOneEvent( WXEVENTREF evr )
|
void wxApp::MacHandleOneEvent( WXEVENTREF evr )
|
||||||
{
|
{
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
EventTargetRef theTarget;
|
EventTargetRef theTarget;
|
||||||
theTarget = GetEventDispatcherTarget();
|
theTarget = GetEventDispatcherTarget();
|
||||||
m_macCurrentEvent = evr ;
|
m_macCurrentEvent = evr ;
|
||||||
SendEventToEventTarget ((EventRef) evr , theTarget);
|
SendEventToEventTarget ((EventRef) evr , theTarget);
|
||||||
#else
|
#else
|
||||||
EventRecord* ev = (EventRecord*) evr ;
|
EventRecord* ev = (EventRecord*) evr ;
|
||||||
m_macCurrentEvent = ev ;
|
m_macCurrentEvent = ev ;
|
||||||
@@ -1784,15 +1784,15 @@ void wxApp::MacHandleMouseUpEvent( WXEVENTREF evr )
|
|||||||
WindowRef window;
|
WindowRef window;
|
||||||
|
|
||||||
short windowPart = inNoWindow ;
|
short windowPart = inNoWindow ;
|
||||||
if ( wxTheApp->s_captureWindow )
|
if ( wxTheApp->s_captureWindow )
|
||||||
{
|
{
|
||||||
window = (WindowRef) s_captureWindow->MacGetRootWindow() ;
|
window = (WindowRef) s_captureWindow->MacGetRootWindow() ;
|
||||||
windowPart = inContent ;
|
windowPart = inContent ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
windowPart = ::FindWindow(ev->where, &window) ;
|
windowPart = ::FindWindow(ev->where, &window) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (windowPart)
|
switch (windowPart)
|
||||||
{
|
{
|
||||||
@@ -1990,13 +1990,13 @@ bool wxApp::MacSendKeyDownEvent( wxWindow* focus , long keymessage , long modifi
|
|||||||
keycode = short(keyInfo & keyCodeMask) >> 8 ;
|
keycode = short(keyInfo & keyCodeMask) >> 8 ;
|
||||||
}
|
}
|
||||||
long keyval = wxMacTranslateKey(keychar, keycode) ;
|
long keyval = wxMacTranslateKey(keychar, keycode) ;
|
||||||
long realkeyval = keyval ;
|
long realkeyval = keyval ;
|
||||||
if ( keyval == keychar )
|
if ( keyval == keychar )
|
||||||
{
|
{
|
||||||
// we are not on a special character combo -> pass the real os event-value to EVT_CHAR, but not to EVT_KEY (make upper first)
|
// we are not on a special character combo -> pass the real os event-value to EVT_CHAR, but not to EVT_KEY (make upper first)
|
||||||
realkeyval = short(keymessage & charCodeMask) ;
|
realkeyval = short(keymessage & charCodeMask) ;
|
||||||
keyval = wxToupper( keyval ) ;
|
keyval = wxToupper( keyval ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxKeyEvent event(wxEVT_KEY_DOWN);
|
wxKeyEvent event(wxEVT_KEY_DOWN);
|
||||||
bool handled = false ;
|
bool handled = false ;
|
||||||
@@ -2120,10 +2120,10 @@ bool wxApp::MacSendKeyUpEvent( wxWindow* focus , long keymessage , long modifier
|
|||||||
}
|
}
|
||||||
long keyval = wxMacTranslateKey(keychar, keycode) ;
|
long keyval = wxMacTranslateKey(keychar, keycode) ;
|
||||||
|
|
||||||
if ( keyval == keychar )
|
if ( keyval == keychar )
|
||||||
{
|
{
|
||||||
keyval = wxToupper( keyval ) ;
|
keyval = wxToupper( keyval ) ;
|
||||||
}
|
}
|
||||||
bool handled = false ;
|
bool handled = false ;
|
||||||
|
|
||||||
wxKeyEvent event(wxEVT_KEY_UP);
|
wxKeyEvent event(wxEVT_KEY_UP);
|
||||||
@@ -2248,15 +2248,15 @@ void wxApp::MacHandleOSEvent( WXEVENTREF evr )
|
|||||||
|
|
||||||
wxWindow* currentMouseWindow = NULL ;
|
wxWindow* currentMouseWindow = NULL ;
|
||||||
|
|
||||||
if (s_captureWindow )
|
if (s_captureWindow )
|
||||||
{
|
{
|
||||||
currentMouseWindow = s_captureWindow ;
|
currentMouseWindow = s_captureWindow ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxWindow::MacGetWindowFromPoint( wxPoint( ev->where.h , ev->where.v ) ,
|
wxWindow::MacGetWindowFromPoint( wxPoint( ev->where.h , ev->where.v ) ,
|
||||||
¤tMouseWindow ) ;
|
¤tMouseWindow ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( currentMouseWindow != wxWindow::s_lastMouseWindow )
|
if ( currentMouseWindow != wxWindow::s_lastMouseWindow )
|
||||||
{
|
{
|
||||||
@@ -2299,15 +2299,15 @@ void wxApp::MacHandleOSEvent( WXEVENTREF evr )
|
|||||||
|
|
||||||
short windowPart = inNoWindow ;
|
short windowPart = inNoWindow ;
|
||||||
|
|
||||||
if ( s_captureWindow )
|
if ( s_captureWindow )
|
||||||
{
|
{
|
||||||
window = (WindowRef) s_captureWindow->MacGetRootWindow() ;
|
window = (WindowRef) s_captureWindow->MacGetRootWindow() ;
|
||||||
windowPart = inContent ;
|
windowPart = inContent ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
windowPart = ::FindWindow(ev->where, &window);
|
windowPart = ::FindWindow(ev->where, &window);
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (windowPart)
|
switch (windowPart)
|
||||||
{
|
{
|
||||||
@@ -2359,7 +2359,7 @@ void wxApp::MacHandleMenuCommand( wxUint32 id )
|
|||||||
item->Check( !item->IsChecked() ) ;
|
item->Check( !item->IsChecked() ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
menu->SendEvent( id , item->IsCheckable() ? item->IsChecked() : -1 ) ;
|
menu->SendEvent( id , item->IsCheckable() ? item->IsChecked() : -1 ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !TARGET_CARBON
|
#if !TARGET_CARBON
|
||||||
@@ -2384,7 +2384,7 @@ void wxApp::MacHandleMenuSelect( int macMenuId , int macMenuItemNum )
|
|||||||
{
|
{
|
||||||
MenuCommand id ;
|
MenuCommand id ;
|
||||||
GetMenuItemCommandID( GetMenuHandle(macMenuId) , macMenuItemNum , &id ) ;
|
GetMenuItemCommandID( GetMenuHandle(macMenuId) , macMenuItemNum , &id ) ;
|
||||||
MacHandleMenuCommand( id ) ;
|
MacHandleMenuCommand( id ) ;
|
||||||
}
|
}
|
||||||
HiliteMenu(0);
|
HiliteMenu(0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -218,8 +218,8 @@ CIconHandle wxMacCreateCIcon(GWorldPtr image , GWorldPtr mask , short dstDepth ,
|
|||||||
|
|
||||||
if ( mask )
|
if ( mask )
|
||||||
{
|
{
|
||||||
Rect r ;
|
Rect r ;
|
||||||
GetPortBounds( image , &r ) ;
|
GetPortBounds( image , &r ) ;
|
||||||
LockPixels(GetGWorldPixMap(mask) ) ;
|
LockPixels(GetGWorldPixMap(mask) ) ;
|
||||||
CopyBits(GetPortBitMapForCopyBits(mask) ,
|
CopyBits(GetPortBitMapForCopyBits(mask) ,
|
||||||
&(**icon).iconBMap , &r , &r, srcCopy , nil ) ;
|
&(**icon).iconBMap , &r , &r, srcCopy , nil ) ;
|
||||||
@@ -229,8 +229,8 @@ CIconHandle wxMacCreateCIcon(GWorldPtr image , GWorldPtr mask , short dstDepth ,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Rect r ;
|
Rect r ;
|
||||||
GetPortBounds( image , &r ) ;
|
GetPortBounds( image , &r ) ;
|
||||||
LockPixels(GetGWorldPixMap(image));
|
LockPixels(GetGWorldPixMap(image));
|
||||||
CopyBits(GetPortBitMapForCopyBits(image) ,
|
CopyBits(GetPortBitMapForCopyBits(image) ,
|
||||||
&(**icon).iconBMap , &r , &r, srcCopy , nil ) ;
|
&(**icon).iconBMap , &r , &r, srcCopy , nil ) ;
|
||||||
@@ -275,7 +275,7 @@ PicHandle wxMacCreatePict(GWorldPtr wp, GWorldPtr mask)
|
|||||||
if ( clipRgn )
|
if ( clipRgn )
|
||||||
GetRegionBounds( clipRgn , &portRect ) ;
|
GetRegionBounds( clipRgn , &portRect ) ;
|
||||||
else
|
else
|
||||||
GetPortBounds( wp , &portRect ) ;
|
GetPortBounds( wp , &portRect ) ;
|
||||||
pict = OpenPicture(&portRect);
|
pict = OpenPicture(&portRect);
|
||||||
if(pict)
|
if(pict)
|
||||||
{
|
{
|
||||||
@@ -283,7 +283,7 @@ PicHandle wxMacCreatePict(GWorldPtr wp, GWorldPtr mask)
|
|||||||
RGBBackColor( &white ) ;
|
RGBBackColor( &white ) ;
|
||||||
|
|
||||||
if ( clipRgn )
|
if ( clipRgn )
|
||||||
SetClip( clipRgn ) ;
|
SetClip( clipRgn ) ;
|
||||||
|
|
||||||
LockPixels( GetGWorldPixMap( wp ) ) ;
|
LockPixels( GetGWorldPixMap( wp ) ) ;
|
||||||
CopyBits(GetPortBitMapForCopyBits(wp),
|
CopyBits(GetPortBitMapForCopyBits(wp),
|
||||||
@@ -296,7 +296,7 @@ PicHandle wxMacCreatePict(GWorldPtr wp, GWorldPtr mask)
|
|||||||
}
|
}
|
||||||
SetGWorld( origPort , origDev ) ;
|
SetGWorld( origPort , origDev ) ;
|
||||||
if ( clipRgn )
|
if ( clipRgn )
|
||||||
DisposeRgn( clipRgn ) ;
|
DisposeRgn( clipRgn ) ;
|
||||||
return pict;
|
return pict;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -335,19 +335,19 @@ void wxMacCreateBitmapButton( ControlButtonContentInfo*info , const wxBitmap& bi
|
|||||||
info->contentType = kControlContentPictHandle ;
|
info->contentType = kControlContentPictHandle ;
|
||||||
if ( bitmap.GetMask() )
|
if ( bitmap.GetMask() )
|
||||||
{
|
{
|
||||||
info->u.picture = wxMacCreatePict( MAC_WXHBITMAP(bmap->m_hBitmap) , MAC_WXHBITMAP(bitmap.GetMask()->GetMaskBitmap() ) ) ;
|
info->u.picture = wxMacCreatePict( MAC_WXHBITMAP(bmap->m_hBitmap) , MAC_WXHBITMAP(bitmap.GetMask()->GetMaskBitmap() ) ) ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
info->u.picture = wxMacCreatePict( MAC_WXHBITMAP(bmap->m_hBitmap) , NULL ) ;
|
info->u.picture = wxMacCreatePict( MAC_WXHBITMAP(bmap->m_hBitmap) , NULL ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( bmap->m_bitmapType == kMacBitmapTypeIcon )
|
else if ( bmap->m_bitmapType == kMacBitmapTypeIcon )
|
||||||
{
|
{
|
||||||
info->contentType = kControlContentCIconHandle ;
|
info->contentType = kControlContentCIconHandle ;
|
||||||
info->u.cIconHandle = MAC_WXHICON(bmap->m_hIcon) ;
|
info->u.cIconHandle = MAC_WXHICON(bmap->m_hIcon) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -369,46 +369,46 @@ wxBitmapRefData::wxBitmapRefData()
|
|||||||
// TODO move this to a public function of Bitmap Ref
|
// TODO move this to a public function of Bitmap Ref
|
||||||
static void DisposeBitmapRefData(wxBitmapRefData *data)
|
static void DisposeBitmapRefData(wxBitmapRefData *data)
|
||||||
{
|
{
|
||||||
if ( !data )
|
if ( !data )
|
||||||
return ;
|
return ;
|
||||||
|
|
||||||
switch (data->m_bitmapType)
|
switch (data->m_bitmapType)
|
||||||
{
|
{
|
||||||
case kMacBitmapTypePict :
|
case kMacBitmapTypePict :
|
||||||
{
|
{
|
||||||
if ( data->m_hPict )
|
if ( data->m_hPict )
|
||||||
{
|
{
|
||||||
KillPicture( MAC_WXHMETAFILE( data->m_hPict ) ) ;
|
KillPicture( MAC_WXHMETAFILE( data->m_hPict ) ) ;
|
||||||
data->m_hPict = NULL ;
|
data->m_hPict = NULL ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
case kMacBitmapTypeGrafWorld :
|
case kMacBitmapTypeGrafWorld :
|
||||||
{
|
{
|
||||||
if ( data->m_hBitmap )
|
if ( data->m_hBitmap )
|
||||||
{
|
{
|
||||||
wxMacDestroyGWorld( MAC_WXHBITMAP(data->m_hBitmap) ) ;
|
wxMacDestroyGWorld( MAC_WXHBITMAP(data->m_hBitmap) ) ;
|
||||||
data->m_hBitmap = NULL ;
|
data->m_hBitmap = NULL ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
case kMacBitmapTypeIcon :
|
case kMacBitmapTypeIcon :
|
||||||
if ( data->m_hIcon )
|
if ( data->m_hIcon )
|
||||||
{
|
{
|
||||||
DisposeCIcon( MAC_WXHICON(data->m_hIcon) ) ;
|
DisposeCIcon( MAC_WXHICON(data->m_hIcon) ) ;
|
||||||
data->m_hIcon = NULL ;
|
data->m_hIcon = NULL ;
|
||||||
}
|
}
|
||||||
|
|
||||||
default :
|
default :
|
||||||
// unkown type ?
|
// unkown type ?
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data->m_bitmapMask)
|
if (data->m_bitmapMask)
|
||||||
{
|
{
|
||||||
delete data->m_bitmapMask;
|
delete data->m_bitmapMask;
|
||||||
data->m_bitmapMask = NULL;
|
data->m_bitmapMask = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxBitmapRefData::~wxBitmapRefData()
|
wxBitmapRefData::~wxBitmapRefData()
|
||||||
@@ -642,8 +642,8 @@ void wxBitmap::SetHBITMAP(WXHBITMAP bmp)
|
|||||||
{
|
{
|
||||||
if (!M_BITMAPDATA)
|
if (!M_BITMAPDATA)
|
||||||
m_refData = new wxBitmapRefData;
|
m_refData = new wxBitmapRefData;
|
||||||
else
|
else
|
||||||
DisposeBitmapRefData( M_BITMAPDATA ) ;
|
DisposeBitmapRefData( M_BITMAPDATA ) ;
|
||||||
|
|
||||||
M_BITMAPDATA->m_bitmapType = kMacBitmapTypeGrafWorld ;
|
M_BITMAPDATA->m_bitmapType = kMacBitmapTypeGrafWorld ;
|
||||||
M_BITMAPDATA->m_hBitmap = bmp ;
|
M_BITMAPDATA->m_hBitmap = bmp ;
|
||||||
@@ -654,8 +654,8 @@ void wxBitmap::SetHICON(WXHICON ico)
|
|||||||
{
|
{
|
||||||
if (!M_BITMAPDATA)
|
if (!M_BITMAPDATA)
|
||||||
m_refData = new wxBitmapRefData;
|
m_refData = new wxBitmapRefData;
|
||||||
else
|
else
|
||||||
DisposeBitmapRefData( M_BITMAPDATA ) ;
|
DisposeBitmapRefData( M_BITMAPDATA ) ;
|
||||||
|
|
||||||
M_BITMAPDATA->m_bitmapType = kMacBitmapTypeIcon ;
|
M_BITMAPDATA->m_bitmapType = kMacBitmapTypeIcon ;
|
||||||
M_BITMAPDATA->m_hIcon = ico ;
|
M_BITMAPDATA->m_hIcon = ico ;
|
||||||
@@ -666,8 +666,8 @@ void wxBitmap::SetPict(WXHMETAFILE pict)
|
|||||||
{
|
{
|
||||||
if (!M_BITMAPDATA)
|
if (!M_BITMAPDATA)
|
||||||
m_refData = new wxBitmapRefData;
|
m_refData = new wxBitmapRefData;
|
||||||
else
|
else
|
||||||
DisposeBitmapRefData( M_BITMAPDATA ) ;
|
DisposeBitmapRefData( M_BITMAPDATA ) ;
|
||||||
|
|
||||||
M_BITMAPDATA->m_bitmapType = kMacBitmapTypePict ;
|
M_BITMAPDATA->m_bitmapType = kMacBitmapTypePict ;
|
||||||
M_BITMAPDATA->m_hPict = pict ;
|
M_BITMAPDATA->m_hPict = pict ;
|
||||||
@@ -820,26 +820,26 @@ wxImage wxBitmap::ConvertToImage() const
|
|||||||
GetGWorld( &origPort, &origDevice );
|
GetGWorld( &origPort, &origDevice );
|
||||||
if ( GetBitmapType() != kMacBitmapTypeGrafWorld )
|
if ( GetBitmapType() != kMacBitmapTypeGrafWorld )
|
||||||
{
|
{
|
||||||
tempPort = wxMacCreateGWorld( width , height , -1) ;
|
tempPort = wxMacCreateGWorld( width , height , -1) ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
tempPort = (GWorldPtr) GetHBITMAP() ;
|
tempPort = (GWorldPtr) GetHBITMAP() ;
|
||||||
}
|
}
|
||||||
LockPixels(GetGWorldPixMap(tempPort));
|
LockPixels(GetGWorldPixMap(tempPort));
|
||||||
SetGWorld( tempPort, NULL);
|
SetGWorld( tempPort, NULL);
|
||||||
if ( GetBitmapType() == kMacBitmapTypePict || GetBitmapType() == kMacBitmapTypeIcon )
|
if ( GetBitmapType() == kMacBitmapTypePict || GetBitmapType() == kMacBitmapTypeIcon )
|
||||||
{
|
{
|
||||||
Rect bitmaprect = { 0 , 0 , height, width };
|
Rect bitmaprect = { 0 , 0 , height, width };
|
||||||
if ( GetBitmapType() == kMacBitmapTypeIcon )
|
if ( GetBitmapType() == kMacBitmapTypeIcon )
|
||||||
{
|
{
|
||||||
::PlotCIconHandle( &bitmaprect , atNone , ttNone , MAC_WXHICON(GetHICON()) ) ;
|
::PlotCIconHandle( &bitmaprect , atNone , ttNone , MAC_WXHICON(GetHICON()) ) ;
|
||||||
maskRgn = NewRgn() ;
|
maskRgn = NewRgn() ;
|
||||||
BitMapToRegion( maskRgn , &(**(MAC_WXHICON(GetHICON()))).iconMask ) ;
|
BitMapToRegion( maskRgn , &(**(MAC_WXHICON(GetHICON()))).iconMask ) ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
::DrawPicture( (PicHandle) GetPict(), &bitmaprect ) ;
|
::DrawPicture( (PicHandle) GetPict(), &bitmaprect ) ;
|
||||||
}
|
}
|
||||||
// Copy data into image
|
// Copy data into image
|
||||||
index = 0;
|
index = 0;
|
||||||
for (int yy = 0; yy < height; yy++)
|
for (int yy = 0; yy < height; yy++)
|
||||||
@@ -855,27 +855,27 @@ wxImage wxBitmap::ConvertToImage() const
|
|||||||
data[index + 2] = b;
|
data[index + 2] = b;
|
||||||
if ( maskRgn )
|
if ( maskRgn )
|
||||||
{
|
{
|
||||||
Point pt ;
|
Point pt ;
|
||||||
pt.h = xx ;
|
pt.h = xx ;
|
||||||
pt.v = yy ;
|
pt.v = yy ;
|
||||||
if ( !PtInRgn( pt , maskRgn ) )
|
if ( !PtInRgn( pt , maskRgn ) )
|
||||||
{
|
{
|
||||||
data[index ] = mask_r;
|
data[index ] = mask_r;
|
||||||
data[index + 1] = mask_g;
|
data[index + 1] = mask_g;
|
||||||
data[index + 2] = mask_b;
|
data[index + 2] = mask_b;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (mask)
|
if (mask)
|
||||||
{
|
{
|
||||||
if (mask->PointMasked(xx,yy))
|
if (mask->PointMasked(xx,yy))
|
||||||
{
|
{
|
||||||
data[index ] = mask_r;
|
data[index ] = mask_r;
|
||||||
data[index + 1] = mask_g;
|
data[index + 1] = mask_g;
|
||||||
data[index + 2] = mask_b;
|
data[index + 2] = mask_b;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
index += 3;
|
index += 3;
|
||||||
}
|
}
|
||||||
@@ -891,11 +891,11 @@ wxImage wxBitmap::ConvertToImage() const
|
|||||||
SetGWorld(origPort, origDevice);
|
SetGWorld(origPort, origDevice);
|
||||||
if ( GetBitmapType() != kMacBitmapTypeGrafWorld )
|
if ( GetBitmapType() != kMacBitmapTypeGrafWorld )
|
||||||
{
|
{
|
||||||
wxMacDestroyGWorld( tempPort ) ;
|
wxMacDestroyGWorld( tempPort ) ;
|
||||||
}
|
}
|
||||||
if ( maskRgn )
|
if ( maskRgn )
|
||||||
{
|
{
|
||||||
DisposeRgn( maskRgn ) ;
|
DisposeRgn( maskRgn ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
return image;
|
return image;
|
||||||
@@ -1038,33 +1038,33 @@ WXHBITMAP wxBitmap::GetHBITMAP() const
|
|||||||
|
|
||||||
WXHMETAFILE wxBitmap::GetPict( bool *created ) const
|
WXHMETAFILE wxBitmap::GetPict( bool *created ) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( Ok(), NULL, wxT("invalid bitmap") );
|
wxCHECK_MSG( Ok(), NULL, wxT("invalid bitmap") );
|
||||||
|
|
||||||
PicHandle picture = NULL ; // This is the returned picture
|
PicHandle picture = NULL ; // This is the returned picture
|
||||||
if ( created )
|
if ( created )
|
||||||
(*created) = false ;
|
(*created) = false ;
|
||||||
// If bitmap already in Pict format return pointer
|
// If bitmap already in Pict format return pointer
|
||||||
if(M_BITMAPDATA->m_bitmapType == kMacBitmapTypePict) {
|
if(M_BITMAPDATA->m_bitmapType == kMacBitmapTypePict) {
|
||||||
return M_BITMAPDATA->m_hPict;
|
return M_BITMAPDATA->m_hPict;
|
||||||
}
|
|
||||||
else if(M_BITMAPDATA->m_bitmapType != kMacBitmapTypeGrafWorld) {
|
|
||||||
// Invalid bitmap
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ( GetMask() )
|
|
||||||
{
|
|
||||||
picture = wxMacCreatePict( MAC_WXHBITMAP(M_BITMAPDATA->m_hBitmap) , MAC_WXHBITMAP(GetMask()->GetMaskBitmap() ) ) ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
picture = wxMacCreatePict( MAC_WXHBITMAP(M_BITMAPDATA->m_hBitmap) , NULL ) ;
|
|
||||||
}
|
|
||||||
if ( created && picture )
|
|
||||||
(*created) = true ;
|
|
||||||
}
|
}
|
||||||
return picture ;
|
else if(M_BITMAPDATA->m_bitmapType != kMacBitmapTypeGrafWorld) {
|
||||||
|
// Invalid bitmap
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( GetMask() )
|
||||||
|
{
|
||||||
|
picture = wxMacCreatePict( MAC_WXHBITMAP(M_BITMAPDATA->m_hBitmap) , MAC_WXHBITMAP(GetMask()->GetMaskBitmap() ) ) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
picture = wxMacCreatePict( MAC_WXHBITMAP(M_BITMAPDATA->m_hBitmap) , NULL ) ;
|
||||||
|
}
|
||||||
|
if ( created && picture )
|
||||||
|
(*created) = true ;
|
||||||
|
}
|
||||||
|
return picture ;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -45,35 +45,35 @@ bool wxBitmapButton::Create(wxWindow *parent, wxWindowID id, const wxBitmap& bit
|
|||||||
m_windowId = id;
|
m_windowId = id;
|
||||||
|
|
||||||
if ( width == -1 && bitmap.Ok())
|
if ( width == -1 && bitmap.Ok())
|
||||||
width = bitmap.GetWidth() + 2*m_marginX;
|
width = bitmap.GetWidth() + 2*m_marginX;
|
||||||
|
|
||||||
if ( height == -1 && bitmap.Ok())
|
if ( height == -1 && bitmap.Ok())
|
||||||
height = bitmap.GetHeight() + 2*m_marginY;
|
height = bitmap.GetHeight() + 2*m_marginY;
|
||||||
|
|
||||||
Rect bounds ;
|
Rect bounds ;
|
||||||
Str255 title ;
|
Str255 title ;
|
||||||
m_bmpNormal = bitmap;
|
m_bmpNormal = bitmap;
|
||||||
wxBitmapRefData * bmap = NULL ;
|
wxBitmapRefData * bmap = NULL ;
|
||||||
|
|
||||||
if ( m_bmpNormal.Ok() )
|
if ( m_bmpNormal.Ok() )
|
||||||
bmap = (wxBitmapRefData*) ( m_bmpNormal.GetRefData()) ;
|
bmap = (wxBitmapRefData*) ( m_bmpNormal.GetRefData()) ;
|
||||||
|
|
||||||
MacPreControlCreate( parent , id , "" , pos , wxSize( width , height ) ,style, validator , name , &bounds , title ) ;
|
MacPreControlCreate( parent , id , "" , pos , wxSize( width , height ) ,style, validator , name , &bounds , title ) ;
|
||||||
|
|
||||||
m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 ,
|
m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 ,
|
||||||
kControlBehaviorOffsetContents +
|
kControlBehaviorOffsetContents +
|
||||||
( bmap && bmap->m_bitmapType == kMacBitmapTypeIcon ?
|
( bmap && bmap->m_bitmapType == kMacBitmapTypeIcon ?
|
||||||
kControlContentCIconHandle : kControlContentPictHandle ) , 0,
|
kControlContentCIconHandle : kControlContentPictHandle ) , 0,
|
||||||
(( style & wxBU_AUTODRAW ) ? kControlBevelButtonSmallBevelProc : kControlBevelButtonNormalBevelProc ), (long) this ) ;
|
(( style & wxBU_AUTODRAW ) ? kControlBevelButtonSmallBevelProc : kControlBevelButtonNormalBevelProc ), (long) this ) ;
|
||||||
wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
|
wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
|
||||||
|
|
||||||
ControlButtonContentInfo info ;
|
ControlButtonContentInfo info ;
|
||||||
wxMacCreateBitmapButton( &info , m_bmpNormal ) ;
|
wxMacCreateBitmapButton( &info , m_bmpNormal ) ;
|
||||||
if ( info.contentType != kControlNoContent )
|
if ( info.contentType != kControlNoContent )
|
||||||
{
|
{
|
||||||
::SetControlData( (ControlHandle) m_macControl , kControlButtonPart , kControlBevelButtonContentTag , sizeof(info) , (char*) &info ) ;
|
::SetControlData( (ControlHandle) m_macControl , kControlButtonPart , kControlBevelButtonContentTag , sizeof(info) , (char*) &info ) ;
|
||||||
}
|
}
|
||||||
MacPostControlCreate() ;
|
MacPostControlCreate() ;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -112,17 +112,17 @@ wxBrush::wxBrush(ThemeBrush macThemeBrush )
|
|||||||
}
|
}
|
||||||
void wxBrush::Unshare()
|
void wxBrush::Unshare()
|
||||||
{
|
{
|
||||||
// Don't change shared data
|
// Don't change shared data
|
||||||
if (!m_refData)
|
if (!m_refData)
|
||||||
{
|
{
|
||||||
m_refData = new wxBrushRefData();
|
m_refData = new wxBrushRefData();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxBrushRefData* ref = new wxBrushRefData(*(wxBrushRefData*)m_refData);
|
wxBrushRefData* ref = new wxBrushRefData(*(wxBrushRefData*)m_refData);
|
||||||
UnRef();
|
UnRef();
|
||||||
m_refData = ref;
|
m_refData = ref;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxBrush::SetColour(const wxColour& col)
|
void wxBrush::SetColour(const wxColour& col)
|
||||||
@@ -203,25 +203,27 @@ unsigned long wxBrush::GetMacThemeBackground( WXRECTPTR extent) const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
short wxBrush::GetMacTheme() const
|
short wxBrush::GetMacTheme() const
|
||||||
{
|
{
|
||||||
return (M_BRUSHDATA ? ( M_BRUSHDATA->m_macBrushKind == kwxMacBrushTheme ? M_BRUSHDATA->m_macThemeBrush : kThemeBrushBlack) : kThemeBrushBlack);
|
return (M_BRUSHDATA ? ( M_BRUSHDATA->m_macBrushKind == kwxMacBrushTheme ? M_BRUSHDATA->m_macThemeBrush : kThemeBrushBlack) : kThemeBrushBlack);
|
||||||
};
|
}
|
||||||
|
|
||||||
wxColour& wxBrush::GetColour() const
|
wxColour& wxBrush::GetColour() const
|
||||||
{ return (M_BRUSHDATA ? M_BRUSHDATA->m_colour : wxNullColour); };
|
{
|
||||||
|
return (M_BRUSHDATA ? M_BRUSHDATA->m_colour : wxNullColour);
|
||||||
|
}
|
||||||
|
|
||||||
int wxBrush::GetStyle() const
|
int wxBrush::GetStyle() const
|
||||||
{
|
{
|
||||||
return (M_BRUSHDATA ? M_BRUSHDATA->m_style : 0);
|
return (M_BRUSHDATA ? M_BRUSHDATA->m_style : 0);
|
||||||
};
|
}
|
||||||
|
|
||||||
wxBitmap *wxBrush::GetStipple() const
|
wxBitmap *wxBrush::GetStipple() const
|
||||||
{
|
{
|
||||||
return (M_BRUSHDATA ? & M_BRUSHDATA->m_stipple : 0);
|
return (M_BRUSHDATA ? & M_BRUSHDATA->m_stipple : 0);
|
||||||
};
|
}
|
||||||
|
|
||||||
wxMacBrushKind wxBrush::MacGetBrushKind() const
|
wxMacBrushKind wxBrush::MacGetBrushKind() const
|
||||||
{
|
{
|
||||||
return (M_BRUSHDATA ? M_BRUSHDATA->m_macBrushKind : kwxMacBrushColour);
|
return (M_BRUSHDATA ? M_BRUSHDATA->m_macBrushKind : kwxMacBrushColour);
|
||||||
};
|
}
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -34,8 +34,8 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label,
|
|||||||
const wxValidator& validator,
|
const wxValidator& validator,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
Rect bounds ;
|
Rect bounds ;
|
||||||
Str255 title ;
|
Str255 title ;
|
||||||
|
|
||||||
if ( UMAHasAquaLayout() )
|
if ( UMAHasAquaLayout() )
|
||||||
{
|
{
|
||||||
@@ -43,13 +43,13 @@ bool wxButton::Create(wxWindow *parent, wxWindowID id, const wxString& label,
|
|||||||
m_macVerticalBorder = kMacOSXVerticalBorder;
|
m_macVerticalBorder = kMacOSXVerticalBorder;
|
||||||
}
|
}
|
||||||
|
|
||||||
MacPreControlCreate( parent , id , label , pos , size ,style, validator , name , &bounds , title ) ;
|
MacPreControlCreate( parent , id , label , pos , size ,style, validator , name , &bounds , title ) ;
|
||||||
|
|
||||||
m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1,
|
m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1,
|
||||||
kControlPushButtonProc , (long) this ) ;
|
kControlPushButtonProc , (long) this ) ;
|
||||||
wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
|
wxASSERT_MSG( (ControlHandle) m_macControl != NULL , "No valid mac control" ) ;
|
||||||
|
|
||||||
MacPostControlCreate() ;
|
MacPostControlCreate() ;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -65,19 +65,19 @@ void wxButton::SetDefault()
|
|||||||
parent->SetDefaultItem(this);
|
parent->SetDefaultItem(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
Boolean inData;
|
Boolean inData;
|
||||||
if ( btnOldDefault && btnOldDefault->m_macControl )
|
if ( btnOldDefault && btnOldDefault->m_macControl )
|
||||||
{
|
{
|
||||||
inData = 0;
|
inData = 0;
|
||||||
::SetControlData( (ControlHandle) btnOldDefault->m_macControl , kControlButtonPart ,
|
::SetControlData( (ControlHandle) btnOldDefault->m_macControl , kControlButtonPart ,
|
||||||
kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)(&inData) ) ;
|
kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)(&inData) ) ;
|
||||||
}
|
}
|
||||||
if ( (ControlHandle) m_macControl )
|
if ( (ControlHandle) m_macControl )
|
||||||
{
|
{
|
||||||
inData = 1;
|
inData = 1;
|
||||||
::SetControlData( (ControlHandle) m_macControl , kControlButtonPart ,
|
::SetControlData( (ControlHandle) m_macControl , kControlButtonPart ,
|
||||||
kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)(&inData) ) ;
|
kControlPushButtonDefaultTag , sizeof( Boolean ) , (char*)(&inData) ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSize wxButton::DoGetBestSize() const
|
wxSize wxButton::DoGetBestSize() const
|
||||||
@@ -94,7 +94,7 @@ wxSize wxButton::DoGetBestSize() const
|
|||||||
wxSize wxButton::GetDefaultSize()
|
wxSize wxButton::GetDefaultSize()
|
||||||
{
|
{
|
||||||
int wBtn = 70 ;
|
int wBtn = 70 ;
|
||||||
int hBtn = 20 ;
|
int hBtn = 20 ;
|
||||||
|
|
||||||
if ( UMAHasAquaLayout() )
|
if ( UMAHasAquaLayout() )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -31,15 +31,15 @@ bool wxCheckBox::Create(wxWindow *parent, wxWindowID id, const wxString& label,
|
|||||||
const wxValidator& validator,
|
const wxValidator& validator,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
Rect bounds ;
|
Rect bounds ;
|
||||||
Str255 title ;
|
Str255 title ;
|
||||||
|
|
||||||
MacPreControlCreate( parent , id , label , pos , size ,style, validator , name , &bounds , title ) ;
|
MacPreControlCreate( parent , id , label , pos , size ,style, validator , name , &bounds , title ) ;
|
||||||
|
|
||||||
m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1,
|
m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1,
|
||||||
kControlCheckBoxProc , (long) this ) ;
|
kControlCheckBoxProc , (long) this ) ;
|
||||||
|
|
||||||
MacPostControlCreate() ;
|
MacPostControlCreate() ;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -63,7 +63,7 @@ void wxCheckBox::Command (wxCommandEvent & event)
|
|||||||
|
|
||||||
void wxCheckBox::MacHandleControlClick( WXWidget WXUNUSED(control), wxInt16 WXUNUSED(controlpart) )
|
void wxCheckBox::MacHandleControlClick( WXWidget WXUNUSED(control), wxInt16 WXUNUSED(controlpart) )
|
||||||
{
|
{
|
||||||
SetValue( !GetValue() ) ;
|
SetValue( !GetValue() ) ;
|
||||||
wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, m_windowId );
|
wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, m_windowId );
|
||||||
event.SetInt(GetValue());
|
event.SetInt(GetValue());
|
||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
|
|||||||
@@ -73,9 +73,9 @@ static pascal void wxMacCheckListDefinition( short message, Boolean isSelected,
|
|||||||
RgnHandle savedClipRegion;
|
RgnHandle savedClipRegion;
|
||||||
SInt32 savedPenMode;
|
SInt32 savedPenMode;
|
||||||
wxCheckListBox* list;
|
wxCheckListBox* list;
|
||||||
GetPort(&savePort);
|
GetPort(&savePort);
|
||||||
SetPort((**listHandle).port);
|
SetPort((**listHandle).port);
|
||||||
grafPtr = (**listHandle).port ;
|
grafPtr = (**listHandle).port ;
|
||||||
// typecast our refCon
|
// typecast our refCon
|
||||||
list = (wxCheckListBox*) GetControlReference( (ControlHandle) GetListRefCon(listHandle) );
|
list = (wxCheckListBox*) GetControlReference( (ControlHandle) GetListRefCon(listHandle) );
|
||||||
|
|
||||||
@@ -102,13 +102,13 @@ static pascal void wxMacCheckListDefinition( short message, Boolean isSelected,
|
|||||||
ClipRect( drawRect );
|
ClipRect( drawRect );
|
||||||
EraseRect( drawRect );
|
EraseRect( drawRect );
|
||||||
|
|
||||||
wxFontRefData * font = (wxFontRefData*) (list->GetFont().GetRefData()) ;
|
wxFontRefData * font = (wxFontRefData*) (list->GetFont().GetRefData()) ;
|
||||||
|
|
||||||
if ( font )
|
if ( font )
|
||||||
{
|
{
|
||||||
::TextFont( font->m_macFontNum ) ;
|
::TextFont( font->m_macFontNum ) ;
|
||||||
::TextSize( font->m_macFontSize) ;
|
::TextSize( font->m_macFontSize) ;
|
||||||
::TextFace( font->m_macFontStyle ) ;
|
::TextFace( font->m_macFontStyle ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
ThemeButtonDrawInfo info ;
|
ThemeButtonDrawInfo info ;
|
||||||
@@ -123,11 +123,11 @@ static pascal void wxMacCheckListDefinition( short message, Boolean isSelected,
|
|||||||
checkRect.right = checkRect.left + list->m_checkBoxWidth ;
|
checkRect.right = checkRect.left + list->m_checkBoxWidth ;
|
||||||
checkRect.bottom = checkRect.top + list->m_checkBoxHeight ;
|
checkRect.bottom = checkRect.top + list->m_checkBoxHeight ;
|
||||||
DrawThemeButton(&checkRect,kThemeCheckBox,
|
DrawThemeButton(&checkRect,kThemeCheckBox,
|
||||||
&info,NULL,NULL, NULL,0);
|
&info,NULL,NULL, NULL,0);
|
||||||
|
|
||||||
MoveTo(drawRect->left + 2 + list->m_checkBoxWidth+2, drawRect->top + list->m_TextBaseLineOffset );
|
MoveTo(drawRect->left + 2 + list->m_checkBoxWidth+2, drawRect->top + list->m_TextBaseLineOffset );
|
||||||
|
|
||||||
DrawText(text, 0 , text.Length());
|
DrawText(text, 0 , text.Length());
|
||||||
// If the cell is hilited, do the hilite now. Paint the cell contents with the
|
// If the cell is hilited, do the hilite now. Paint the cell contents with the
|
||||||
// appropriate QuickDraw transform mode.
|
// appropriate QuickDraw transform mode.
|
||||||
|
|
||||||
@@ -142,8 +142,8 @@ static pascal void wxMacCheckListDefinition( short message, Boolean isSelected,
|
|||||||
|
|
||||||
SetClip( savedClipRegion );
|
SetClip( savedClipRegion );
|
||||||
DisposeRgn( savedClipRegion );
|
DisposeRgn( savedClipRegion );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case lHiliteMsg:
|
case lHiliteMsg:
|
||||||
|
|
||||||
// Hilite or unhilite the cell. Paint the cell contents with the
|
// Hilite or unhilite the cell. Paint the cell contents with the
|
||||||
@@ -194,7 +194,7 @@ bool wxCheckListBox::Create(wxWindow *parent,
|
|||||||
GetThemeMetric(kThemeMetricCheckBoxWidth,(long *)&m_checkBoxWidth);
|
GetThemeMetric(kThemeMetricCheckBoxWidth,(long *)&m_checkBoxWidth);
|
||||||
GetThemeMetric(kThemeMetricCheckBoxHeight,&h);
|
GetThemeMetric(kThemeMetricCheckBoxHeight,&h);
|
||||||
#endif
|
#endif
|
||||||
wxFontRefData * font = (wxFontRefData*) (GetFont().GetRefData()) ;
|
wxFontRefData * font = (wxFontRefData*) (GetFont().GetRefData()) ;
|
||||||
|
|
||||||
FontInfo finfo;
|
FontInfo finfo;
|
||||||
FetchFontInfo(font->m_macFontNum,short(font->m_macFontSize),font->m_macFontStyle,&finfo);
|
FetchFontInfo(font->m_macFontNum,short(font->m_macFontSize),font->m_macFontStyle,&finfo);
|
||||||
@@ -202,11 +202,11 @@ bool wxCheckListBox::Create(wxWindow *parent,
|
|||||||
m_TextBaseLineOffset= finfo.leading+finfo.ascent;
|
m_TextBaseLineOffset= finfo.leading+finfo.ascent;
|
||||||
m_checkBoxHeight= finfo.leading+finfo.ascent+finfo.descent;
|
m_checkBoxHeight= finfo.leading+finfo.ascent+finfo.descent;
|
||||||
|
|
||||||
if (m_checkBoxHeight<h)
|
if (m_checkBoxHeight<h)
|
||||||
{
|
{
|
||||||
m_TextBaseLineOffset+= (h-m_checkBoxHeight)/2;
|
m_TextBaseLineOffset+= (h-m_checkBoxHeight)/2;
|
||||||
m_checkBoxHeight= h;
|
m_checkBoxHeight= h;
|
||||||
}
|
}
|
||||||
|
|
||||||
Rect bounds ;
|
Rect bounds ;
|
||||||
Str255 title ;
|
Str255 title ;
|
||||||
@@ -376,55 +376,55 @@ END_EVENT_TABLE()
|
|||||||
|
|
||||||
void wxCheckListBox::OnChar(wxKeyEvent& event)
|
void wxCheckListBox::OnChar(wxKeyEvent& event)
|
||||||
{
|
{
|
||||||
if ( event.GetKeyCode() == WXK_SPACE )
|
if ( event.GetKeyCode() == WXK_SPACE )
|
||||||
{
|
|
||||||
int index = GetSelection() ;
|
|
||||||
if ( index >= 0 )
|
|
||||||
{
|
{
|
||||||
Check(index, !IsChecked(index) ) ;
|
int index = GetSelection() ;
|
||||||
wxCommandEvent event(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, GetId());
|
if ( index >= 0 )
|
||||||
event.SetInt(index);
|
{
|
||||||
event.SetEventObject(this);
|
Check(index, !IsChecked(index) ) ;
|
||||||
GetEventHandler()->ProcessEvent(event);
|
wxCommandEvent event(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, GetId());
|
||||||
|
event.SetInt(index);
|
||||||
|
event.SetEventObject(this);
|
||||||
|
GetEventHandler()->ProcessEvent(event);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else
|
event.Skip();
|
||||||
event.Skip();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxCheckListBox::OnLeftClick(wxMouseEvent& event)
|
void wxCheckListBox::OnLeftClick(wxMouseEvent& event)
|
||||||
{
|
{
|
||||||
// clicking on the item selects it, clicking on the checkmark toggles
|
// clicking on the item selects it, clicking on the checkmark toggles
|
||||||
if ( event.GetX() <= 20 /*check width*/ ) {
|
if ( event.GetX() <= 20 /*check width*/ ) {
|
||||||
int lineheight ;
|
int lineheight ;
|
||||||
int topcell ;
|
int topcell ;
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
Point pt ;
|
Point pt ;
|
||||||
GetListCellSize( (ListHandle)m_macList , &pt ) ;
|
GetListCellSize( (ListHandle)m_macList , &pt ) ;
|
||||||
lineheight = pt.v ;
|
lineheight = pt.v ;
|
||||||
ListBounds visible ;
|
ListBounds visible ;
|
||||||
GetListVisibleCells( (ListHandle)m_macList , &visible ) ;
|
GetListVisibleCells( (ListHandle)m_macList , &visible ) ;
|
||||||
topcell = visible.top ;
|
topcell = visible.top ;
|
||||||
#else
|
#else
|
||||||
lineheight = (**(ListHandle)m_macList).cellSize.v ;
|
lineheight = (**(ListHandle)m_macList).cellSize.v ;
|
||||||
topcell = (**(ListHandle)m_macList).visible.top ;
|
topcell = (**(ListHandle)m_macList).visible.top ;
|
||||||
#endif
|
#endif
|
||||||
size_t nItem = ((size_t)event.GetY()) / lineheight + topcell ;
|
size_t nItem = ((size_t)event.GetY()) / lineheight + topcell ;
|
||||||
|
|
||||||
if ( nItem < (size_t)m_noItems )
|
if ( nItem < (size_t)m_noItems )
|
||||||
{
|
{
|
||||||
Check(nItem, !IsChecked(nItem) ) ;
|
Check(nItem, !IsChecked(nItem) ) ;
|
||||||
wxCommandEvent event(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, GetId());
|
wxCommandEvent event(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, GetId());
|
||||||
event.SetInt(nItem);
|
event.SetInt(nItem);
|
||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
GetEventHandler()->ProcessEvent(event);
|
GetEventHandler()->ProcessEvent(event);
|
||||||
|
}
|
||||||
|
//else: it's not an error, just click outside of client zone
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// implement default behaviour: clicking on the item selects it
|
||||||
|
event.Skip();
|
||||||
}
|
}
|
||||||
//else: it's not an error, just click outside of client zone
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// implement default behaviour: clicking on the item selects it
|
|
||||||
event.Skip();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_CHECKLISTBOX
|
#endif // wxUSE_CHECKLISTBOX
|
||||||
|
|||||||
@@ -6,19 +6,24 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma implementation "choice.h"
|
#pragma implementation "choice.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/defs.h"
|
#include "wx/defs.h"
|
||||||
#include "wx/choice.h"
|
#include "wx/choice.h"
|
||||||
#include "wx/menu.h"
|
#include "wx/menu.h"
|
||||||
#include "wx/mac/uma.h"
|
#include "wx/mac/uma.h"
|
||||||
|
|
||||||
#if !USE_SHARED_LIBRARY
|
#if !USE_SHARED_LIBRARY
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxChoice, wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxChoice, wxControl)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern MenuHandle NewUniqueMenu() ;
|
extern MenuHandle NewUniqueMenu() ;
|
||||||
|
|
||||||
wxChoice::~wxChoice()
|
wxChoice::~wxChoice()
|
||||||
{
|
{
|
||||||
if ( HasClientObjectData() )
|
if ( HasClientObjectData() )
|
||||||
@@ -30,49 +35,52 @@ wxChoice::~wxChoice()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// DeleteMenu( m_macPopUpMenuId ) ;
|
// DeleteMenu( m_macPopUpMenuId ) ;
|
||||||
// DisposeMenu( m_macPopUpMenuHandle ) ;
|
// DisposeMenu( m_macPopUpMenuHandle ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxChoice::Create(wxWindow *parent, wxWindowID id,
|
bool wxChoice::Create(wxWindow *parent, wxWindowID id,
|
||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
const wxSize& size,
|
const wxSize& size,
|
||||||
int n, const wxString choices[],
|
int n, const wxString choices[],
|
||||||
long style,
|
long style,
|
||||||
const wxValidator& validator,
|
const wxValidator& validator,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
Rect bounds ;
|
Rect bounds ;
|
||||||
Str255 title ;
|
Str255 title ;
|
||||||
|
|
||||||
MacPreControlCreate( parent , id , "" , pos , size ,style, validator , name , &bounds , title ) ;
|
MacPreControlCreate( parent , id , "" , pos , size ,style, validator , name , &bounds , title ) ;
|
||||||
m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , -12345 , 0 ,
|
m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , -12345 , 0 ,
|
||||||
kControlPopupButtonProc + kControlPopupFixedWidthVariant , (long) this ) ;
|
kControlPopupButtonProc + kControlPopupFixedWidthVariant , (long) this ) ;
|
||||||
|
|
||||||
m_macPopUpMenuHandle = NewUniqueMenu() ;
|
m_macPopUpMenuHandle = NewUniqueMenu() ;
|
||||||
SetControlData( (ControlHandle) m_macControl , kControlNoPart , kControlPopupButtonMenuHandleTag , sizeof( MenuHandle ) , (char*) &m_macPopUpMenuHandle) ;
|
SetControlData( (ControlHandle) m_macControl , kControlNoPart , kControlPopupButtonMenuHandleTag , sizeof( MenuHandle ) , (char*) &m_macPopUpMenuHandle) ;
|
||||||
SetControl32BitMinimum( (ControlHandle) m_macControl , 0 ) ;
|
SetControl32BitMinimum( (ControlHandle) m_macControl , 0 ) ;
|
||||||
SetControl32BitMaximum( (ControlHandle) m_macControl , 0) ;
|
SetControl32BitMaximum( (ControlHandle) m_macControl , 0) ;
|
||||||
if ( n > 0 )
|
if ( n > 0 )
|
||||||
SetControl32BitValue( (ControlHandle) m_macControl , 1 ) ;
|
SetControl32BitValue( (ControlHandle) m_macControl , 1 ) ;
|
||||||
MacPostControlCreate() ;
|
MacPostControlCreate() ;
|
||||||
for ( int i = 0; i < n; i++ )
|
for ( int i = 0; i < n; i++ )
|
||||||
{
|
{
|
||||||
Append(choices[i]);
|
Append(choices[i]);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// adding/deleting items to/from the list
|
// adding/deleting items to/from the list
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
int wxChoice::DoAppend(const wxString& item)
|
int wxChoice::DoAppend(const wxString& item)
|
||||||
{
|
{
|
||||||
UMAAppendMenuItem(MAC_WXHMENU( m_macPopUpMenuHandle ) , item);
|
UMAAppendMenuItem(MAC_WXHMENU( m_macPopUpMenuHandle ) , item);
|
||||||
m_strings.Add( item ) ;
|
m_strings.Add( item ) ;
|
||||||
m_datas.Add( NULL ) ;
|
m_datas.Add( NULL ) ;
|
||||||
int index = m_strings.GetCount() - 1 ;
|
int index = m_strings.GetCount() - 1 ;
|
||||||
DoSetItemClientData( index , NULL ) ;
|
DoSetItemClientData( index , NULL ) ;
|
||||||
SetControl32BitMaximum( (ControlHandle) m_macControl , GetCount()) ;
|
SetControl32BitMaximum( (ControlHandle) m_macControl , GetCount()) ;
|
||||||
return index ;
|
return index ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxChoice::Delete(int n)
|
void wxChoice::Delete(int n)
|
||||||
{
|
{
|
||||||
wxCHECK_RET( n < GetCount(), wxT("invalid item index in wxChoice::Delete") );
|
wxCHECK_RET( n < GetCount(), wxT("invalid item index in wxChoice::Delete") );
|
||||||
@@ -83,19 +91,21 @@ void wxChoice::Delete(int n)
|
|||||||
::DeleteMenuItem( MAC_WXHMENU(m_macPopUpMenuHandle) , n + 1) ;
|
::DeleteMenuItem( MAC_WXHMENU(m_macPopUpMenuHandle) , n + 1) ;
|
||||||
m_strings.Remove( n ) ;
|
m_strings.Remove( n ) ;
|
||||||
m_datas.RemoveAt( n ) ;
|
m_datas.RemoveAt( n ) ;
|
||||||
SetControl32BitMaximum( (ControlHandle) m_macControl , GetCount()) ;
|
SetControl32BitMaximum( (ControlHandle) m_macControl , GetCount()) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxChoice::Clear()
|
void wxChoice::Clear()
|
||||||
{
|
{
|
||||||
FreeData();
|
FreeData();
|
||||||
for ( int i = 0 ; i < GetCount() ; i++ )
|
for ( int i = 0 ; i < GetCount() ; i++ )
|
||||||
{
|
{
|
||||||
::DeleteMenuItem( MAC_WXHMENU(m_macPopUpMenuHandle) , 1 ) ;
|
::DeleteMenuItem( MAC_WXHMENU(m_macPopUpMenuHandle) , 1 ) ;
|
||||||
}
|
}
|
||||||
m_strings.Empty() ;
|
m_strings.Empty() ;
|
||||||
m_datas.Empty() ;
|
m_datas.Empty() ;
|
||||||
SetControl32BitMaximum( (ControlHandle) m_macControl , 0 ) ;
|
SetControl32BitMaximum( (ControlHandle) m_macControl , 0 ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxChoice::FreeData()
|
void wxChoice::FreeData()
|
||||||
{
|
{
|
||||||
if ( HasClientObjectData() )
|
if ( HasClientObjectData() )
|
||||||
@@ -107,6 +117,7 @@ void wxChoice::FreeData()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// selection
|
// selection
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -114,26 +125,31 @@ int wxChoice::GetSelection() const
|
|||||||
{
|
{
|
||||||
return GetControl32BitValue( (ControlHandle) m_macControl ) -1 ;
|
return GetControl32BitValue( (ControlHandle) m_macControl ) -1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxChoice::SetSelection(int n)
|
void wxChoice::SetSelection(int n)
|
||||||
{
|
{
|
||||||
SetControl32BitValue( (ControlHandle) m_macControl , n + 1 ) ;
|
SetControl32BitValue( (ControlHandle) m_macControl , n + 1 ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// string list functions
|
// string list functions
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
int wxChoice::GetCount() const
|
int wxChoice::GetCount() const
|
||||||
{
|
{
|
||||||
return m_strings.GetCount() ;
|
return m_strings.GetCount() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxChoice::FindString(const wxString& s) const
|
int wxChoice::FindString(const wxString& s) const
|
||||||
{
|
{
|
||||||
for( int i = 0 ; i < GetCount() ; i++ )
|
for( int i = 0 ; i < GetCount() ; i++ )
|
||||||
{
|
{
|
||||||
if ( GetString( i ).IsSameAs(s, FALSE) )
|
if ( GetString( i ).IsSameAs(s, FALSE) )
|
||||||
return i ;
|
return i ;
|
||||||
}
|
}
|
||||||
return wxNOT_FOUND ;
|
return wxNOT_FOUND ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxChoice::SetString(int n, const wxString& s)
|
void wxChoice::SetString(int n, const wxString& s)
|
||||||
{
|
{
|
||||||
wxFAIL_MSG(wxT("wxChoice::SetString() not yet implemented"));
|
wxFAIL_MSG(wxT("wxChoice::SetString() not yet implemented"));
|
||||||
@@ -145,7 +161,7 @@ void wxChoice::SetString(int n, const wxString& s)
|
|||||||
|
|
||||||
wxString wxChoice::GetString(int n) const
|
wxString wxChoice::GetString(int n) const
|
||||||
{
|
{
|
||||||
return m_strings[n] ;
|
return m_strings[n] ;
|
||||||
}
|
}
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// client data
|
// client data
|
||||||
@@ -157,20 +173,24 @@ void wxChoice::DoSetItemClientData( int n, void* clientData )
|
|||||||
|
|
||||||
m_datas[n] = (char*) clientData ;
|
m_datas[n] = (char*) clientData ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *wxChoice::DoGetItemClientData(int n) const
|
void *wxChoice::DoGetItemClientData(int n) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( n >= 0 && (size_t)n < m_datas.GetCount(), NULL,
|
wxCHECK_MSG( n >= 0 && (size_t)n < m_datas.GetCount(), NULL,
|
||||||
"invalid index in wxChoice::GetClientData" );
|
"invalid index in wxChoice::GetClientData" );
|
||||||
return (void *)m_datas[n];
|
return (void *)m_datas[n];
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxChoice::DoSetItemClientObject( int n, wxClientData* clientData )
|
void wxChoice::DoSetItemClientObject( int n, wxClientData* clientData )
|
||||||
{
|
{
|
||||||
DoSetItemClientData(n, clientData);
|
DoSetItemClientData(n, clientData);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxClientData* wxChoice::DoGetItemClientObject( int n ) const
|
wxClientData* wxChoice::DoGetItemClientObject( int n ) const
|
||||||
{
|
{
|
||||||
return (wxClientData *)DoGetItemClientData(n);
|
return (wxClientData *)DoGetItemClientData(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxChoice::MacHandleControlClick( WXWidget control , wxInt16 controlpart )
|
void wxChoice::MacHandleControlClick( WXWidget control , wxInt16 controlpart )
|
||||||
{
|
{
|
||||||
wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, m_windowId );
|
wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, m_windowId );
|
||||||
@@ -188,6 +208,7 @@ void wxChoice::MacHandleControlClick( WXWidget control , wxInt16 controlpart )
|
|||||||
ProcessCommand(event);
|
ProcessCommand(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSize wxChoice::DoGetBestSize() const
|
wxSize wxChoice::DoGetBestSize() const
|
||||||
{
|
{
|
||||||
int lbWidth = 100; // some defaults
|
int lbWidth = 100; // some defaults
|
||||||
@@ -198,35 +219,35 @@ wxSize wxChoice::DoGetBestSize() const
|
|||||||
GetThemeMetric(kThemeMetricPopupButtonHeight , &metric );
|
GetThemeMetric(kThemeMetricPopupButtonHeight , &metric );
|
||||||
lbHeight = metric ;
|
lbHeight = metric ;
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
wxMacPortStateHelper st( UMAGetWindowPort( (WindowRef) MacGetRootWindow() ) ) ;
|
wxMacPortStateHelper st( UMAGetWindowPort( (WindowRef) MacGetRootWindow() ) ) ;
|
||||||
Rect drawRect ;
|
Rect drawRect ;
|
||||||
wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ;
|
wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ;
|
||||||
if ( font )
|
if ( font )
|
||||||
{
|
{
|
||||||
::TextFont( font->m_macFontNum ) ;
|
::TextFont( font->m_macFontNum ) ;
|
||||||
::TextSize( short(font->m_macFontSize) ) ;
|
::TextSize( short(font->m_macFontSize) ) ;
|
||||||
::TextFace( font->m_macFontStyle ) ;
|
::TextFace( font->m_macFontStyle ) ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
::TextFont( kFontIDMonaco ) ;
|
::TextFont( kFontIDMonaco ) ;
|
||||||
::TextSize( 9 );
|
::TextSize( 9 );
|
||||||
::TextFace( 0 ) ;
|
::TextFace( 0 ) ;
|
||||||
}
|
}
|
||||||
// Find the widest line
|
// Find the widest line
|
||||||
for(int i = 0; i < GetCount(); i++) {
|
for(int i = 0; i < GetCount(); i++) {
|
||||||
wxString str(GetString(i));
|
wxString str(GetString(i));
|
||||||
wLine = ::TextWidth( str.c_str() , 0 , str.Length() ) ;
|
wLine = ::TextWidth( str.c_str() , 0 , str.Length() ) ;
|
||||||
lbWidth = wxMax(lbWidth, wLine);
|
lbWidth = wxMax(lbWidth, wLine);
|
||||||
}
|
}
|
||||||
// Add room for the popup arrow
|
// Add room for the popup arrow
|
||||||
lbWidth += 2 * lbHeight ;
|
lbWidth += 2 * lbHeight ;
|
||||||
// And just a bit more
|
// And just a bit more
|
||||||
int cy = 12 ;
|
int cy = 12 ;
|
||||||
int cx = ::TextWidth( "X" , 0 , 1 ) ;
|
int cx = ::TextWidth( "X" , 0 , 1 ) ;
|
||||||
lbWidth += cx ;
|
lbWidth += cx ;
|
||||||
|
|
||||||
}
|
}
|
||||||
return wxSize(lbWidth, lbHeight);
|
return wxSize(lbWidth, lbHeight);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,25 +44,25 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
|
|||||||
#else
|
#else
|
||||||
OSStatus err = noErr ;
|
OSStatus err = noErr ;
|
||||||
#endif
|
#endif
|
||||||
void * data = NULL ;
|
void * data = NULL ;
|
||||||
Size byteCount;
|
Size byteCount;
|
||||||
|
|
||||||
switch (dataFormat.GetType())
|
switch (dataFormat.GetType())
|
||||||
{
|
{
|
||||||
case wxDF_OEMTEXT:
|
case wxDF_OEMTEXT:
|
||||||
dataFormat = wxDF_TEXT;
|
dataFormat = wxDF_TEXT;
|
||||||
// fall through
|
// fall through
|
||||||
|
|
||||||
case wxDF_TEXT:
|
case wxDF_TEXT:
|
||||||
break;
|
break;
|
||||||
case wxDF_BITMAP :
|
case wxDF_BITMAP :
|
||||||
case wxDF_METAFILE :
|
case wxDF_METAFILE :
|
||||||
break ;
|
break ;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
wxLogError(_("Unsupported clipboard format."));
|
wxLogError(_("Unsupported clipboard format."));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
@@ -77,21 +77,21 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
|
|||||||
{
|
{
|
||||||
if (( err = GetScrapFlavorSize( scrapRef, dataFormat.GetFormatId(), &byteCount )) == noErr)
|
if (( err = GetScrapFlavorSize( scrapRef, dataFormat.GetFormatId(), &byteCount )) == noErr)
|
||||||
{
|
{
|
||||||
if ( dataFormat.GetType() == wxDF_TEXT )
|
|
||||||
byteCount++ ;
|
|
||||||
|
|
||||||
data = new char[ byteCount ] ;
|
|
||||||
if (( err = GetScrapFlavorData( scrapRef, dataFormat.GetFormatId(), &byteCount , data )) == noErr )
|
|
||||||
{
|
|
||||||
*len = byteCount ;
|
|
||||||
if ( dataFormat.GetType() == wxDF_TEXT )
|
if ( dataFormat.GetType() == wxDF_TEXT )
|
||||||
((char*)data)[byteCount] = 0 ;
|
byteCount++ ;
|
||||||
}
|
|
||||||
else
|
data = new char[ byteCount ] ;
|
||||||
{
|
if (( err = GetScrapFlavorData( scrapRef, dataFormat.GetFormatId(), &byteCount , data )) == noErr )
|
||||||
delete[] ((char *)data) ;
|
{
|
||||||
data = NULL ;
|
*len = byteCount ;
|
||||||
}
|
if ( dataFormat.GetType() == wxDF_TEXT )
|
||||||
|
((char*)data)[byteCount] = 0 ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
delete[] ((char *)data) ;
|
||||||
|
data = NULL ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -104,16 +104,16 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
|
|||||||
HUnlock( datahandle ) ;
|
HUnlock( datahandle ) ;
|
||||||
if ( GetHandleSize( datahandle ) > 0 )
|
if ( GetHandleSize( datahandle ) > 0 )
|
||||||
{
|
{
|
||||||
byteCount = GetHandleSize( datahandle ) ;
|
byteCount = GetHandleSize( datahandle ) ;
|
||||||
if ( dataFormat.GetType() == wxDF_TEXT )
|
if ( dataFormat.GetType() == wxDF_TEXT )
|
||||||
data = new char[ byteCount + 1] ;
|
data = new char[ byteCount + 1] ;
|
||||||
else
|
else
|
||||||
data = new char[ byteCount ] ;
|
data = new char[ byteCount ] ;
|
||||||
|
|
||||||
memcpy( (char*) data , (char*) *datahandle , byteCount ) ;
|
memcpy( (char*) data , (char*) *datahandle , byteCount ) ;
|
||||||
if ( dataFormat.GetType() == wxDF_TEXT )
|
if ( dataFormat.GetType() == wxDF_TEXT )
|
||||||
((char*)data)[byteCount] = 0 ;
|
((char*)data)[byteCount] = 0 ;
|
||||||
*len = byteCount ;
|
*len = byteCount ;
|
||||||
}
|
}
|
||||||
DisposeHandle( datahandle ) ;
|
DisposeHandle( datahandle ) ;
|
||||||
#endif
|
#endif
|
||||||
@@ -125,7 +125,7 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
|
|||||||
}
|
}
|
||||||
if ( dataFormat.GetType() == wxDF_TEXT && wxApp::s_macDefaultEncodingIsPC )
|
if ( dataFormat.GetType() == wxDF_TEXT && wxApp::s_macDefaultEncodingIsPC )
|
||||||
{
|
{
|
||||||
wxMacConvertToPC((char*)data,(char*)data,byteCount) ;
|
wxMacConvertToPC((char*)data,(char*)data,byteCount) ;
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
@@ -139,8 +139,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxClipboard, wxObject)
|
|||||||
|
|
||||||
wxClipboard::wxClipboard()
|
wxClipboard::wxClipboard()
|
||||||
{
|
{
|
||||||
m_open = false ;
|
m_open = false ;
|
||||||
m_data = NULL ;
|
m_data = NULL ;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxClipboard::~wxClipboard()
|
wxClipboard::~wxClipboard()
|
||||||
@@ -250,30 +250,30 @@ bool wxClipboard::AddData( wxDataObject *data )
|
|||||||
#if wxUSE_DRAG_AND_DROP
|
#if wxUSE_DRAG_AND_DROP
|
||||||
case wxDF_METAFILE:
|
case wxDF_METAFILE:
|
||||||
{
|
{
|
||||||
wxMetafileDataObject* metaFileDataObject =
|
wxMetafileDataObject* metaFileDataObject =
|
||||||
(wxMetafileDataObject*) data;
|
(wxMetafileDataObject*) data;
|
||||||
wxMetafile metaFile = metaFileDataObject->GetMetafile();
|
wxMetafile metaFile = metaFileDataObject->GetMetafile();
|
||||||
PicHandle pict = (PicHandle) metaFile.GetHMETAFILE() ;
|
PicHandle pict = (PicHandle) metaFile.GetHMETAFILE() ;
|
||||||
HLock( (Handle) pict ) ;
|
HLock( (Handle) pict ) ;
|
||||||
err = UMAPutScrap( GetHandleSize( (Handle) pict ) , 'PICT' , *pict ) ;
|
err = UMAPutScrap( GetHandleSize( (Handle) pict ) , 'PICT' , *pict ) ;
|
||||||
HUnlock( (Handle) pict ) ;
|
HUnlock( (Handle) pict ) ;
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
#endif
|
#endif
|
||||||
case wxDF_BITMAP:
|
case wxDF_BITMAP:
|
||||||
case wxDF_DIB:
|
case wxDF_DIB:
|
||||||
{
|
{
|
||||||
bool created = false ;
|
bool created = false ;
|
||||||
PicHandle pict = NULL ;
|
PicHandle pict = NULL ;
|
||||||
|
|
||||||
wxBitmapDataObject* bitmapDataObject = (wxBitmapDataObject*) data ;
|
wxBitmapDataObject* bitmapDataObject = (wxBitmapDataObject*) data ;
|
||||||
pict = (PicHandle) bitmapDataObject->GetBitmap().GetPict( &created ) ;
|
pict = (PicHandle) bitmapDataObject->GetBitmap().GetPict( &created ) ;
|
||||||
|
|
||||||
HLock( (Handle) pict ) ;
|
HLock( (Handle) pict ) ;
|
||||||
err = UMAPutScrap( GetHandleSize( (Handle) pict ) , 'PICT' , *pict ) ;
|
err = UMAPutScrap( GetHandleSize( (Handle) pict ) , 'PICT' , *pict ) ;
|
||||||
HUnlock( (Handle) pict ) ;
|
HUnlock( (Handle) pict ) ;
|
||||||
if ( created )
|
if ( created )
|
||||||
KillPicture( pict ) ;
|
KillPicture( pict ) ;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break ;
|
break ;
|
||||||
@@ -388,7 +388,7 @@ bool wxClipboard::GetData( wxDataObject& data )
|
|||||||
transferred = true ;
|
transferred = true ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
default :
|
default :
|
||||||
break ;
|
break ;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -50,20 +50,20 @@ bool wxColourDialog::Create(wxWindow *parent, wxColourData *data)
|
|||||||
|
|
||||||
int wxColourDialog::ShowModal()
|
int wxColourDialog::ShowModal()
|
||||||
{
|
{
|
||||||
Point where ;
|
Point where ;
|
||||||
RGBColor currentColor = *((RGBColor*)m_colourData.dataColour.GetPixel()) , newColor ;
|
RGBColor currentColor = *((RGBColor*)m_colourData.dataColour.GetPixel()) , newColor ;
|
||||||
|
|
||||||
where.h = where.v = -1;
|
where.h = where.v = -1;
|
||||||
|
|
||||||
if (GetColor( where, "\pSelect a new palette color.", ¤tColor, &newColor ))
|
if (GetColor( where, "\pSelect a new palette color.", ¤tColor, &newColor ))
|
||||||
{
|
{
|
||||||
m_colourData.dataColour.Set( (WXCOLORREF*) &newColor ) ;
|
m_colourData.dataColour.Set( (WXCOLORREF*) &newColor ) ;
|
||||||
return wxID_OK;
|
return wxID_OK;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return wxID_CANCEL;
|
return wxID_CANCEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
return wxID_CANCEL;
|
return wxID_CANCEL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -28,17 +28,17 @@ static void wxComposeRGBColor( WXCOLORREF* color , int red, int blue, int green
|
|||||||
static void wxComposeRGBColor( WXCOLORREF* color , int red, int blue, int green )
|
static void wxComposeRGBColor( WXCOLORREF* color , int red, int blue, int green )
|
||||||
{
|
{
|
||||||
RGBColor* col = (RGBColor*) color ;
|
RGBColor* col = (RGBColor*) color ;
|
||||||
col->red = (red << 8) + red;
|
col->red = (red << 8) + red;
|
||||||
col->blue = (blue << 8) + blue;
|
col->blue = (blue << 8) + blue;
|
||||||
col->green = (green << 8) + green;
|
col->green = (green << 8) + green;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxColour::wxColour ()
|
wxColour::wxColour ()
|
||||||
{
|
{
|
||||||
m_isInit = FALSE;
|
m_isInit = FALSE;
|
||||||
m_red = m_blue = m_green = 0;
|
m_red = m_blue = m_green = 0;
|
||||||
|
|
||||||
wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ) ;
|
wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxColour::wxColour (unsigned char r, unsigned char g, unsigned char b)
|
wxColour::wxColour (unsigned char r, unsigned char g, unsigned char b)
|
||||||
@@ -48,7 +48,7 @@ wxColour::wxColour (unsigned char r, unsigned char g, unsigned char b)
|
|||||||
m_blue = b;
|
m_blue = b;
|
||||||
m_isInit = TRUE;
|
m_isInit = TRUE;
|
||||||
|
|
||||||
wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ) ;
|
wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxColour::wxColour (const wxColour& col)
|
wxColour::wxColour (const wxColour& col)
|
||||||
@@ -74,14 +74,14 @@ wxColour::wxColour (const wxColour* col)
|
|||||||
|
|
||||||
wxColour& wxColour::operator =(const wxColour& col)
|
wxColour& wxColour::operator =(const wxColour& col)
|
||||||
{
|
{
|
||||||
m_red = col.m_red;
|
m_red = col.m_red;
|
||||||
m_green = col.m_green;
|
m_green = col.m_green;
|
||||||
m_blue = col.m_blue;
|
m_blue = col.m_blue;
|
||||||
m_isInit = col.m_isInit;
|
m_isInit = col.m_isInit;
|
||||||
|
|
||||||
memcpy( &m_pixel , &col.m_pixel , 6 ) ;
|
memcpy( &m_pixel , &col.m_pixel , 6 ) ;
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxColour::InitFromName(const wxString& col)
|
void wxColour::InitFromName(const wxString& col)
|
||||||
@@ -102,7 +102,7 @@ void wxColour::InitFromName(const wxString& col)
|
|||||||
m_isInit = FALSE;
|
m_isInit = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ) ;
|
wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxColour::~wxColour ()
|
wxColour::~wxColour ()
|
||||||
@@ -116,7 +116,7 @@ void wxColour::Set (unsigned char r, unsigned char g, unsigned char b)
|
|||||||
m_blue = b;
|
m_blue = b;
|
||||||
m_isInit = TRUE;
|
m_isInit = TRUE;
|
||||||
|
|
||||||
wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ) ;
|
wxComposeRGBColor( &m_pixel , m_red , m_blue , m_green ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxColour::Set( const WXCOLORREF* color )
|
void wxColour::Set( const WXCOLORREF* color )
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ protected:
|
|||||||
|
|
||||||
wxWindow *parent = GetParent();
|
wxWindow *parent = GetParent();
|
||||||
while( parent && !parent->IsTopLevel() && parent->GetDefaultItem() == NULL ) {
|
while( parent && !parent->IsTopLevel() && parent->GetDefaultItem() == NULL ) {
|
||||||
parent = parent->GetParent() ;
|
parent = parent->GetParent() ;
|
||||||
}
|
}
|
||||||
if ( parent && parent->GetDefaultItem() )
|
if ( parent && parent->GetDefaultItem() )
|
||||||
{
|
{
|
||||||
@@ -314,9 +314,9 @@ void wxComboBox::SetValue(const wxString& value)
|
|||||||
int s = FindString (value);
|
int s = FindString (value);
|
||||||
if (s == wxNOT_FOUND && !HasFlag(wxCB_READONLY) )
|
if (s == wxNOT_FOUND && !HasFlag(wxCB_READONLY) )
|
||||||
{
|
{
|
||||||
m_choice->Append(value) ;
|
m_choice->Append(value) ;
|
||||||
}
|
}
|
||||||
SetStringSelection( value ) ;
|
SetStringSelection( value ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clipboard operations
|
// Clipboard operations
|
||||||
|
|||||||
@@ -89,54 +89,54 @@ ControlDefUPP wxMacControlActionUPP = NULL ;
|
|||||||
pascal SInt32 wxMacControlDefinition(SInt16 varCode, ControlRef theControl, ControlDefProcMessage message, SInt32 param)
|
pascal SInt32 wxMacControlDefinition(SInt16 varCode, ControlRef theControl, ControlDefProcMessage message, SInt32 param)
|
||||||
{
|
{
|
||||||
|
|
||||||
wxControl* wx = (wxControl*) wxFindControlFromMacControl( theControl ) ;
|
wxControl* wx = (wxControl*) wxFindControlFromMacControl( theControl ) ;
|
||||||
if ( wx != NULL && wx->IsKindOf( CLASSINFO( wxControl ) ) )
|
if ( wx != NULL && wx->IsKindOf( CLASSINFO( wxControl ) ) )
|
||||||
{
|
{
|
||||||
if( message == drawCntl )
|
if( message == drawCntl )
|
||||||
{
|
{
|
||||||
wxMacWindowClipper clip( wx ) ;
|
wxMacWindowClipper clip( wx ) ;
|
||||||
return InvokeControlDefUPP( varCode , theControl , message , param , (ControlDefUPP) wx->MacGetControlAction() ) ;
|
return InvokeControlDefUPP( varCode , theControl , message , param , (ControlDefUPP) wx->MacGetControlAction() ) ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return InvokeControlDefUPP( varCode , theControl , message , param , (ControlDefUPP) wx->MacGetControlAction() ) ;
|
return InvokeControlDefUPP( varCode , theControl , message , param , (ControlDefUPP) wx->MacGetControlAction() ) ;
|
||||||
}
|
}
|
||||||
return NULL ;
|
return NULL ;
|
||||||
}
|
}
|
||||||
|
|
||||||
pascal OSStatus wxMacSetupControlBackground( ControlRef iControl , SInt16 iMessage , SInt16 iDepth , Boolean iIsColor )
|
pascal OSStatus wxMacSetupControlBackground( ControlRef iControl , SInt16 iMessage , SInt16 iDepth , Boolean iIsColor )
|
||||||
{
|
{
|
||||||
OSStatus status = noErr ;
|
OSStatus status = noErr ;
|
||||||
switch( iMessage )
|
switch( iMessage )
|
||||||
{
|
{
|
||||||
case kControlMsgSetUpBackground :
|
case kControlMsgSetUpBackground :
|
||||||
{
|
{
|
||||||
wxControl* wx = (wxControl*) GetControlReference( iControl ) ;
|
wxControl* wx = (wxControl*) GetControlReference( iControl ) ;
|
||||||
if ( wx != NULL && wx->IsKindOf( CLASSINFO( wxControl ) ) )
|
if ( wx != NULL && wx->IsKindOf( CLASSINFO( wxControl ) ) )
|
||||||
{
|
{
|
||||||
wxDC::MacSetupBackgroundForCurrentPort( wx->MacGetBackgroundBrush() ) ;
|
wxDC::MacSetupBackgroundForCurrentPort( wx->MacGetBackgroundBrush() ) ;
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
// under classic this would lead to partial redraws
|
// under classic this would lead to partial redraws
|
||||||
RgnHandle clip = NewRgn() ;
|
RgnHandle clip = NewRgn() ;
|
||||||
int x = 0 , y = 0;
|
int x = 0 , y = 0;
|
||||||
|
|
||||||
wx->MacWindowToRootWindow( &x,&y ) ;
|
wx->MacWindowToRootWindow( &x,&y ) ;
|
||||||
CopyRgn( (RgnHandle) wx->MacGetVisibleRegion(false).GetWXHRGN() , clip ) ;
|
CopyRgn( (RgnHandle) wx->MacGetVisibleRegion(false).GetWXHRGN() , clip ) ;
|
||||||
OffsetRgn( clip , x , y ) ;
|
OffsetRgn( clip , x , y ) ;
|
||||||
SetClip( clip ) ;
|
SetClip( clip ) ;
|
||||||
DisposeRgn( clip ) ;
|
DisposeRgn( clip ) ;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
status = paramErr ;
|
status = paramErr ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break ;
|
break ;
|
||||||
default :
|
default :
|
||||||
status = paramErr ;
|
status = paramErr ;
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
return status ;
|
return status ;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxControl::wxControl()
|
wxControl::wxControl()
|
||||||
@@ -389,14 +389,14 @@ void wxControl::MacPostControlCreate()
|
|||||||
m_macControlIsShown = true ;
|
m_macControlIsShown = true ;
|
||||||
|
|
||||||
wxAssociateControlWithMacControl( (ControlHandle) m_macControl , this ) ;
|
wxAssociateControlWithMacControl( (ControlHandle) m_macControl , this ) ;
|
||||||
if ( wxMacSetupControlBackgroundUPP == NULL )
|
if ( wxMacSetupControlBackgroundUPP == NULL )
|
||||||
{
|
{
|
||||||
wxMacSetupControlBackgroundUPP = NewControlColorUPP( wxMacSetupControlBackground ) ;
|
wxMacSetupControlBackgroundUPP = NewControlColorUPP( wxMacSetupControlBackground ) ;
|
||||||
}
|
}
|
||||||
if ( wxMacControlActionUPP == NULL )
|
if ( wxMacControlActionUPP == NULL )
|
||||||
{
|
{
|
||||||
wxMacControlActionUPP = NewControlDefUPP( wxMacControlDefinition ) ;
|
wxMacControlActionUPP = NewControlDefUPP( wxMacControlDefinition ) ;
|
||||||
}
|
}
|
||||||
// The following block of code is responsible for crashes when switching
|
// The following block of code is responsible for crashes when switching
|
||||||
// back to windows, which can be seen in the dialogs sample.
|
// back to windows, which can be seen in the dialogs sample.
|
||||||
// It is disabled until a proper solution can be found.
|
// It is disabled until a proper solution can be found.
|
||||||
@@ -414,35 +414,35 @@ void wxControl::MacPostControlCreate()
|
|||||||
cdef = (cdefHandle) NewHandle( sizeof(cdefRec) ) ;
|
cdef = (cdefHandle) NewHandle( sizeof(cdefRec) ) ;
|
||||||
if ( (**(ControlHandle)m_macControl).contrlDefProc != NULL )
|
if ( (**(ControlHandle)m_macControl).contrlDefProc != NULL )
|
||||||
{
|
{
|
||||||
(**cdef).instruction = 0x4EF9; /* JMP instruction */
|
(**cdef).instruction = 0x4EF9; /* JMP instruction */
|
||||||
(**cdef).function = (void(*)()) wxMacControlActionUPP;
|
(**cdef).function = (void(*)()) wxMacControlActionUPP;
|
||||||
(**(ControlHandle)m_macControl).contrlDefProc = (Handle) cdef ;
|
(**(ControlHandle)m_macControl).contrlDefProc = (Handle) cdef ;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
SetControlColorProc( (ControlHandle) m_macControl , wxMacSetupControlBackgroundUPP ) ;
|
SetControlColorProc( (ControlHandle) m_macControl , wxMacSetupControlBackgroundUPP ) ;
|
||||||
|
|
||||||
// Adjust the controls size and position
|
// Adjust the controls size and position
|
||||||
wxPoint pos(m_x, m_y);
|
wxPoint pos(m_x, m_y);
|
||||||
wxSize best_size( DoGetBestSize() );
|
wxSize best_size( DoGetBestSize() );
|
||||||
wxSize new_size( m_width, m_height );
|
wxSize new_size( m_width, m_height );
|
||||||
|
|
||||||
m_x = m_y = m_width = m_height = -1; // Forces SetSize to move/size the control
|
m_x = m_y = m_width = m_height = -1; // Forces SetSize to move/size the control
|
||||||
|
|
||||||
if (new_size.x == -1) {
|
if (new_size.x == -1) {
|
||||||
new_size.x = best_size.x;
|
new_size.x = best_size.x;
|
||||||
}
|
}
|
||||||
if (new_size.y == -1) {
|
if (new_size.y == -1) {
|
||||||
new_size.y = best_size.y;
|
new_size.y = best_size.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetSize(pos.x, pos.y, new_size.x, new_size.y);
|
SetSize(pos.x, pos.y, new_size.x, new_size.y);
|
||||||
|
|
||||||
UMAShowControl( (ControlHandle) m_macControl ) ;
|
UMAShowControl( (ControlHandle) m_macControl ) ;
|
||||||
|
|
||||||
SetCursor( *wxSTANDARD_CURSOR ) ;
|
SetCursor( *wxSTANDARD_CURSOR ) ;
|
||||||
|
|
||||||
Refresh() ;
|
Refresh() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxControl::MacAdjustControlRect()
|
void wxControl::MacAdjustControlRect()
|
||||||
@@ -496,7 +496,7 @@ void wxControl::MacAdjustControlRect()
|
|||||||
|
|
||||||
m_height += 2 * m_macVerticalBorder + MacGetTopBorderSize() + MacGetBottomBorderSize() ;
|
m_height += 2 * m_macVerticalBorder + MacGetTopBorderSize() + MacGetBottomBorderSize() ;
|
||||||
}
|
}
|
||||||
MacUpdateDimensions() ;
|
MacUpdateDimensions() ;
|
||||||
// UMASizeControl( (ControlHandle) m_macControl , m_width - 2 * m_macHorizontalBorder, m_height - 2 * m_macVerticalBorder ) ;
|
// UMASizeControl( (ControlHandle) m_macControl , m_width - 2 * m_macHorizontalBorder, m_height - 2 * m_macVerticalBorder ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -511,18 +511,18 @@ WXWidget wxControl::MacGetContainerForEmbedding()
|
|||||||
|
|
||||||
void wxControl::MacUpdateDimensions()
|
void wxControl::MacUpdateDimensions()
|
||||||
{
|
{
|
||||||
// actually in the current systems this should never be possible, but later reparenting
|
// actually in the current systems this should never be possible, but later reparenting
|
||||||
// may become a reality
|
// may become a reality
|
||||||
|
|
||||||
if ( (ControlHandle) m_macControl == NULL )
|
if ( (ControlHandle) m_macControl == NULL )
|
||||||
return ;
|
return ;
|
||||||
|
|
||||||
if ( GetParent() == NULL )
|
if ( GetParent() == NULL )
|
||||||
return ;
|
return ;
|
||||||
|
|
||||||
WindowRef rootwindow = (WindowRef) MacGetRootWindow() ;
|
WindowRef rootwindow = (WindowRef) MacGetRootWindow() ;
|
||||||
if ( rootwindow == NULL )
|
if ( rootwindow == NULL )
|
||||||
return ;
|
return ;
|
||||||
|
|
||||||
Rect oldBounds ;
|
Rect oldBounds ;
|
||||||
GetControlBounds( (ControlHandle) m_macControl , &oldBounds ) ;
|
GetControlBounds( (ControlHandle) m_macControl , &oldBounds ) ;
|
||||||
@@ -535,23 +535,23 @@ void wxControl::MacUpdateDimensions()
|
|||||||
GetParent()->MacWindowToRootWindow( & new_x , & new_y ) ;
|
GetParent()->MacWindowToRootWindow( & new_x , & new_y ) ;
|
||||||
bool doMove = new_x != oldBounds.left || new_y != oldBounds.top ;
|
bool doMove = new_x != oldBounds.left || new_y != oldBounds.top ;
|
||||||
bool doResize = ( oldBounds.right - oldBounds.left ) != new_width || (oldBounds.bottom - oldBounds.top ) != new_height ;
|
bool doResize = ( oldBounds.right - oldBounds.left ) != new_width || (oldBounds.bottom - oldBounds.top ) != new_height ;
|
||||||
if ( doMove || doResize )
|
if ( doMove || doResize )
|
||||||
{
|
{
|
||||||
InvalWindowRect( rootwindow, &oldBounds ) ;
|
InvalWindowRect( rootwindow, &oldBounds ) ;
|
||||||
if ( doMove )
|
if ( doMove )
|
||||||
{
|
{
|
||||||
UMAMoveControl( (ControlHandle) m_macControl , new_x , new_y ) ;
|
UMAMoveControl( (ControlHandle) m_macControl , new_x , new_y ) ;
|
||||||
}
|
}
|
||||||
if ( doResize )
|
if ( doResize )
|
||||||
{
|
{
|
||||||
UMASizeControl( (ControlHandle) m_macControl , new_width , new_height ) ;
|
UMASizeControl( (ControlHandle) m_macControl , new_width , new_height ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxControl::MacSuperChangedPosition()
|
void wxControl::MacSuperChangedPosition()
|
||||||
{
|
{
|
||||||
MacUpdateDimensions() ;
|
MacUpdateDimensions() ;
|
||||||
wxWindow::MacSuperChangedPosition() ;
|
wxWindow::MacSuperChangedPosition() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -561,7 +561,7 @@ void wxControl::MacSuperEnabled( bool enabled )
|
|||||||
wxWindow::MacSuperEnabled( enabled ) ;
|
wxWindow::MacSuperEnabled( enabled ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxControl::MacSuperShown( bool show )
|
void wxControl::MacSuperShown( bool show )
|
||||||
{
|
{
|
||||||
if ( (ControlHandle) m_macControl )
|
if ( (ControlHandle) m_macControl )
|
||||||
{
|
{
|
||||||
@@ -593,19 +593,19 @@ void wxControl::DoSetSize(int x, int y,
|
|||||||
wxWindow::DoSetSize( x , y ,width , height ,sizeFlags ) ;
|
wxWindow::DoSetSize( x , y ,width , height ,sizeFlags ) ;
|
||||||
#if 0
|
#if 0
|
||||||
{
|
{
|
||||||
Rect meta , control ;
|
Rect meta , control ;
|
||||||
GetControlBounds( (ControlHandle) m_macControl , &control ) ;
|
GetControlBounds( (ControlHandle) m_macControl , &control ) ;
|
||||||
RgnHandle rgn = NewRgn() ;
|
RgnHandle rgn = NewRgn() ;
|
||||||
GetControlRegion( (ControlHandle) m_macControl , kControlStructureMetaPart , rgn ) ;
|
GetControlRegion( (ControlHandle) m_macControl , kControlStructureMetaPart , rgn ) ;
|
||||||
GetRegionBounds( rgn , &meta ) ;
|
GetRegionBounds( rgn , &meta ) ;
|
||||||
if ( !EmptyRect( &meta ) )
|
if ( !EmptyRect( &meta ) )
|
||||||
{
|
{
|
||||||
wxASSERT( meta.left >= control.left - m_macHorizontalBorder ) ;
|
wxASSERT( meta.left >= control.left - m_macHorizontalBorder ) ;
|
||||||
wxASSERT( meta.right <= control.right + m_macHorizontalBorder ) ;
|
wxASSERT( meta.right <= control.right + m_macHorizontalBorder ) ;
|
||||||
wxASSERT( meta.top >= control.top - m_macVerticalBorder ) ;
|
wxASSERT( meta.top >= control.top - m_macVerticalBorder ) ;
|
||||||
wxASSERT( meta.bottom <= control.bottom + m_macVerticalBorder ) ;
|
wxASSERT( meta.bottom <= control.bottom + m_macVerticalBorder ) ;
|
||||||
}
|
}
|
||||||
DisposeRgn( rgn ) ;
|
DisposeRgn( rgn ) ;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return ;
|
return ;
|
||||||
@@ -814,13 +814,13 @@ void wxControl::OnKeyDown( wxKeyEvent &event )
|
|||||||
|
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
|
|
||||||
char charCode ;
|
char charCode ;
|
||||||
UInt32 keyCode ;
|
UInt32 keyCode ;
|
||||||
UInt32 modifiers ;
|
UInt32 modifiers ;
|
||||||
|
|
||||||
GetEventParameter( (EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyMacCharCodes, typeChar, NULL,sizeof(char), NULL,&charCode );
|
GetEventParameter( (EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyMacCharCodes, typeChar, NULL,sizeof(char), NULL,&charCode );
|
||||||
GetEventParameter( (EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode );
|
GetEventParameter( (EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode );
|
||||||
GetEventParameter((EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers);
|
GetEventParameter((EventRef) wxTheApp->MacGetCurrentEvent(), kEventParamKeyModifiers, typeUInt32, NULL, sizeof(UInt32), NULL, &modifiers);
|
||||||
|
|
||||||
::HandleControlKey( (ControlHandle) m_macControl , keyCode , charCode , modifiers ) ;
|
::HandleControlKey( (ControlHandle) m_macControl , keyCode , charCode , modifiers ) ;
|
||||||
|
|
||||||
@@ -895,11 +895,10 @@ void wxControl::OnMouseEvent( wxMouseEvent &event )
|
|||||||
|
|
||||||
bool wxControl::MacCanFocus() const
|
bool wxControl::MacCanFocus() const
|
||||||
{
|
{
|
||||||
{ if ( (ControlHandle) m_macControl == NULL )
|
if ( (ControlHandle) m_macControl == NULL )
|
||||||
return true ;
|
return true ;
|
||||||
else
|
else
|
||||||
return false ;
|
return false ;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxControl::MacHandleControlClick( WXWidget control , wxInt16 controlpart )
|
void wxControl::MacHandleControlClick( WXWidget control , wxInt16 controlpart )
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -41,7 +41,7 @@ const short kwxCursorSizeNESW = 22 ;
|
|||||||
const short kwxCursorSizeNWSE = 23 ;
|
const short kwxCursorSizeNWSE = 23 ;
|
||||||
const short kwxCursorRoller = 24 ;
|
const short kwxCursorRoller = 24 ;
|
||||||
|
|
||||||
wxCursor gMacCurrentCursor ;
|
wxCursor gMacCurrentCursor ;
|
||||||
|
|
||||||
wxCursorRefData::wxCursorRefData()
|
wxCursorRefData::wxCursorRefData()
|
||||||
{
|
{
|
||||||
@@ -60,15 +60,15 @@ wxCursorRefData::~wxCursorRefData()
|
|||||||
{
|
{
|
||||||
::DisposeCCursor( (CCrsrHandle) m_hCursor ) ;
|
::DisposeCCursor( (CCrsrHandle) m_hCursor ) ;
|
||||||
}
|
}
|
||||||
else if ( m_disposeHandle )
|
else if ( m_disposeHandle )
|
||||||
{
|
{
|
||||||
::DisposeHandle( (Handle ) m_hCursor ) ;
|
::DisposeHandle( (Handle ) m_hCursor ) ;
|
||||||
}
|
}
|
||||||
else if ( m_releaseHandle )
|
else if ( m_releaseHandle )
|
||||||
{
|
{
|
||||||
// we don't release the resource since it may already
|
// we don't release the resource since it may already
|
||||||
// be in use again
|
// be in use again
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cursors
|
// Cursors
|
||||||
@@ -91,14 +91,14 @@ void wxCursor::CreateFromImage(const wxImage & image)
|
|||||||
m_refData = new wxCursorRefData;
|
m_refData = new wxCursorRefData;
|
||||||
|
|
||||||
wxImage image16 = image.Scale(16,16) ;
|
wxImage image16 = image.Scale(16,16) ;
|
||||||
unsigned char * rgbBits = image16.GetData();
|
unsigned char * rgbBits = image16.GetData();
|
||||||
|
|
||||||
|
|
||||||
int w = image16.GetWidth() ;
|
int w = image16.GetWidth() ;
|
||||||
int h = image16.GetHeight() ;
|
int h = image16.GetHeight() ;
|
||||||
bool bHasMask = image16.HasMask() ;
|
bool bHasMask = image16.HasMask() ;
|
||||||
|
|
||||||
int hotSpotX = image16.GetOptionInt(wxCUR_HOTSPOT_X);
|
int hotSpotX = image16.GetOptionInt(wxCUR_HOTSPOT_X);
|
||||||
int hotSpotY = image16.GetOptionInt(wxCUR_HOTSPOT_Y);
|
int hotSpotY = image16.GetOptionInt(wxCUR_HOTSPOT_Y);
|
||||||
if (hotSpotX < 0 || hotSpotX >= w)
|
if (hotSpotX < 0 || hotSpotX >= w)
|
||||||
hotSpotX = 0;
|
hotSpotX = 0;
|
||||||
@@ -112,40 +112,40 @@ void wxCursor::CreateFromImage(const wxImage & image)
|
|||||||
memset( cp->data , 0 , sizeof( Bits16 ) ) ;
|
memset( cp->data , 0 , sizeof( Bits16 ) ) ;
|
||||||
memset( cp->mask , 0 , sizeof( Bits16 ) ) ;
|
memset( cp->mask , 0 , sizeof( Bits16 ) ) ;
|
||||||
|
|
||||||
unsigned char mr = image16.GetMaskRed() ;
|
unsigned char mr = image16.GetMaskRed() ;
|
||||||
unsigned char mg = image16.GetMaskGreen() ;
|
unsigned char mg = image16.GetMaskGreen() ;
|
||||||
unsigned char mb = image16.GetMaskBlue() ;
|
unsigned char mb = image16.GetMaskBlue() ;
|
||||||
for ( int y = 0 ; y < h ; ++y )
|
for ( int y = 0 ; y < h ; ++y )
|
||||||
{
|
{
|
||||||
short rowbits = 0 ;
|
short rowbits = 0 ;
|
||||||
short maskbits = 0 ;
|
short maskbits = 0 ;
|
||||||
|
|
||||||
for ( int x = 0 ; x < w ; ++x )
|
for ( int x = 0 ; x < w ; ++x )
|
||||||
{
|
{
|
||||||
long pos = (y * w + x) * 3;
|
long pos = (y * w + x) * 3;
|
||||||
|
|
||||||
unsigned char r = rgbBits[pos] ;
|
unsigned char r = rgbBits[pos] ;
|
||||||
unsigned char g = rgbBits[pos+1] ;
|
unsigned char g = rgbBits[pos+1] ;
|
||||||
unsigned char b = rgbBits[pos+2] ;
|
unsigned char b = rgbBits[pos+2] ;
|
||||||
if ( bHasMask && r==mr && g==mg && b==mb )
|
if ( bHasMask && r==mr && g==mg && b==mb )
|
||||||
{
|
{
|
||||||
// masked area, does not appear anywhere
|
// masked area, does not appear anywhere
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( (int)r + (int)g + (int)b < 0x60 )
|
if ( (int)r + (int)g + (int)b < 0x60 )
|
||||||
{
|
{
|
||||||
rowbits |= ( 1 << (15-x) ) ;
|
rowbits |= ( 1 << (15-x) ) ;
|
||||||
}
|
}
|
||||||
maskbits |= ( 1 << (15-x) ) ;
|
maskbits |= ( 1 << (15-x) ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cp->data[y] = rowbits ;
|
cp->data[y] = rowbits ;
|
||||||
cp->mask[y] = maskbits ;
|
cp->mask[y] = maskbits ;
|
||||||
}
|
}
|
||||||
if ( !bHasMask )
|
if ( !bHasMask )
|
||||||
{
|
{
|
||||||
memcpy( cp->mask , cp->data , sizeof( Bits16) ) ;
|
memcpy( cp->mask , cp->data , sizeof( Bits16) ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
cp->hotSpot.h = hotSpotX ;
|
cp->hotSpot.h = hotSpotX ;
|
||||||
@@ -158,40 +158,40 @@ wxCursor::wxCursor(const wxString& cursor_file, long flags, int hotSpotX, int ho
|
|||||||
m_refData = new wxCursorRefData;
|
m_refData = new wxCursorRefData;
|
||||||
if ( flags == wxBITMAP_TYPE_MACCURSOR_RESOURCE )
|
if ( flags == wxBITMAP_TYPE_MACCURSOR_RESOURCE )
|
||||||
{
|
{
|
||||||
Str255 theName ;
|
Str255 theName ;
|
||||||
|
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
c2pstrcpy( (StringPtr) theName , cursor_file ) ;
|
c2pstrcpy( (StringPtr) theName , cursor_file ) ;
|
||||||
#else
|
#else
|
||||||
strcpy( (char *) theName , cursor_file ) ;
|
strcpy( (char *) theName , cursor_file ) ;
|
||||||
c2pstr( (char *) theName ) ;
|
c2pstr( (char *) theName ) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wxStAppResource resload ;
|
wxStAppResource resload ;
|
||||||
Handle resHandle = ::GetNamedResource( 'crsr' , theName ) ;
|
Handle resHandle = ::GetNamedResource( 'crsr' , theName ) ;
|
||||||
if ( resHandle )
|
if ( resHandle )
|
||||||
{
|
{
|
||||||
short theId = -1 ;
|
short theId = -1 ;
|
||||||
OSType theType ;
|
OSType theType ;
|
||||||
GetResInfo( resHandle , &theId , &theType , theName ) ;
|
GetResInfo( resHandle , &theId , &theType , theName ) ;
|
||||||
ReleaseResource( resHandle ) ;
|
ReleaseResource( resHandle ) ;
|
||||||
M_CURSORDATA->m_hCursor = GetCCursor( theId ) ;
|
M_CURSORDATA->m_hCursor = GetCCursor( theId ) ;
|
||||||
if ( M_CURSORDATA->m_hCursor )
|
if ( M_CURSORDATA->m_hCursor )
|
||||||
M_CURSORDATA->m_isColorCursor = true ;
|
M_CURSORDATA->m_isColorCursor = true ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Handle resHandle = ::GetNamedResource( 'CURS' , theName ) ;
|
Handle resHandle = ::GetNamedResource( 'CURS' , theName ) ;
|
||||||
if ( resHandle )
|
if ( resHandle )
|
||||||
{
|
{
|
||||||
short theId = -1 ;
|
short theId = -1 ;
|
||||||
OSType theType ;
|
OSType theType ;
|
||||||
GetResInfo( resHandle , &theId , &theType , theName ) ;
|
GetResInfo( resHandle , &theId , &theType , theName ) ;
|
||||||
ReleaseResource( resHandle ) ;
|
ReleaseResource( resHandle ) ;
|
||||||
M_CURSORDATA->m_hCursor = GetCursor( theId ) ;
|
M_CURSORDATA->m_hCursor = GetCursor( theId ) ;
|
||||||
if ( M_CURSORDATA->m_hCursor )
|
if ( M_CURSORDATA->m_hCursor )
|
||||||
M_CURSORDATA->m_releaseHandle = true ;
|
M_CURSORDATA->m_releaseHandle = true ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -211,155 +211,155 @@ wxCursor::wxCursor(const wxString& cursor_file, long flags, int hotSpotX, int ho
|
|||||||
// Cursors by stock number
|
// Cursors by stock number
|
||||||
wxCursor::wxCursor(int cursor_type)
|
wxCursor::wxCursor(int cursor_type)
|
||||||
{
|
{
|
||||||
m_refData = new wxCursorRefData;
|
m_refData = new wxCursorRefData;
|
||||||
|
|
||||||
switch (cursor_type)
|
switch (cursor_type)
|
||||||
{
|
{
|
||||||
case wxCURSOR_WAIT:
|
case wxCURSOR_WAIT:
|
||||||
M_CURSORDATA->m_themeCursor = kThemeWatchCursor ;
|
M_CURSORDATA->m_themeCursor = kThemeWatchCursor ;
|
||||||
break;
|
break;
|
||||||
case wxCURSOR_IBEAM:
|
case wxCURSOR_IBEAM:
|
||||||
M_CURSORDATA->m_themeCursor = kThemeIBeamCursor ;
|
M_CURSORDATA->m_themeCursor = kThemeIBeamCursor ;
|
||||||
break;
|
break;
|
||||||
case wxCURSOR_CROSS:
|
case wxCURSOR_CROSS:
|
||||||
M_CURSORDATA->m_themeCursor = kThemeCrossCursor;
|
M_CURSORDATA->m_themeCursor = kThemeCrossCursor;
|
||||||
break;
|
break;
|
||||||
case wxCURSOR_SIZENWSE:
|
case wxCURSOR_SIZENWSE:
|
||||||
{
|
{
|
||||||
wxStAppResource resload ;
|
wxStAppResource resload ;
|
||||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSizeNWSE);
|
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSizeNWSE);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case wxCURSOR_SIZENESW:
|
case wxCURSOR_SIZENESW:
|
||||||
{
|
{
|
||||||
wxStAppResource resload ;
|
wxStAppResource resload ;
|
||||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSizeNESW);
|
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSizeNESW);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case wxCURSOR_SIZEWE:
|
case wxCURSOR_SIZEWE:
|
||||||
{
|
{
|
||||||
M_CURSORDATA->m_themeCursor = kThemeResizeLeftRightCursor;
|
M_CURSORDATA->m_themeCursor = kThemeResizeLeftRightCursor;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case wxCURSOR_SIZENS:
|
case wxCURSOR_SIZENS:
|
||||||
{
|
{
|
||||||
wxStAppResource resload ;
|
wxStAppResource resload ;
|
||||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSizeNS);
|
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSizeNS);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case wxCURSOR_SIZING:
|
case wxCURSOR_SIZING:
|
||||||
{
|
{
|
||||||
wxStAppResource resload ;
|
wxStAppResource resload ;
|
||||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSize);
|
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorSize);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case wxCURSOR_HAND:
|
case wxCURSOR_HAND:
|
||||||
{
|
{
|
||||||
M_CURSORDATA->m_themeCursor = kThemePointingHandCursor;
|
M_CURSORDATA->m_themeCursor = kThemePointingHandCursor;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case wxCURSOR_BULLSEYE:
|
case wxCURSOR_BULLSEYE:
|
||||||
{
|
{
|
||||||
wxStAppResource resload ;
|
wxStAppResource resload ;
|
||||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorBullseye);
|
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorBullseye);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case wxCURSOR_PENCIL:
|
case wxCURSOR_PENCIL:
|
||||||
{
|
{
|
||||||
wxStAppResource resload ;
|
wxStAppResource resload ;
|
||||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorPencil);
|
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorPencil);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case wxCURSOR_MAGNIFIER:
|
case wxCURSOR_MAGNIFIER:
|
||||||
{
|
{
|
||||||
wxStAppResource resload ;
|
wxStAppResource resload ;
|
||||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorMagnifier);
|
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorMagnifier);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case wxCURSOR_NO_ENTRY:
|
case wxCURSOR_NO_ENTRY:
|
||||||
{
|
{
|
||||||
wxStAppResource resload ;
|
wxStAppResource resload ;
|
||||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorNoEntry);
|
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorNoEntry);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case wxCURSOR_WATCH:
|
case wxCURSOR_WATCH:
|
||||||
{
|
{
|
||||||
M_CURSORDATA->m_themeCursor = kThemeWatchCursor;
|
M_CURSORDATA->m_themeCursor = kThemeWatchCursor;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case wxCURSOR_PAINT_BRUSH:
|
case wxCURSOR_PAINT_BRUSH:
|
||||||
{
|
{
|
||||||
wxStAppResource resload ;
|
wxStAppResource resload ;
|
||||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorPaintBrush);
|
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorPaintBrush);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case wxCURSOR_POINT_LEFT:
|
case wxCURSOR_POINT_LEFT:
|
||||||
{
|
{
|
||||||
wxStAppResource resload ;
|
wxStAppResource resload ;
|
||||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorPointLeft);
|
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorPointLeft);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case wxCURSOR_POINT_RIGHT:
|
case wxCURSOR_POINT_RIGHT:
|
||||||
{
|
{
|
||||||
wxStAppResource resload ;
|
wxStAppResource resload ;
|
||||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorPointRight);
|
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorPointRight);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case wxCURSOR_QUESTION_ARROW:
|
case wxCURSOR_QUESTION_ARROW:
|
||||||
{
|
{
|
||||||
wxStAppResource resload ;
|
wxStAppResource resload ;
|
||||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorQuestionArrow);
|
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorQuestionArrow);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case wxCURSOR_BLANK:
|
case wxCURSOR_BLANK:
|
||||||
{
|
{
|
||||||
wxStAppResource resload ;
|
wxStAppResource resload ;
|
||||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorBlank);
|
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorBlank);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case wxCURSOR_RIGHT_ARROW:
|
case wxCURSOR_RIGHT_ARROW:
|
||||||
{
|
{
|
||||||
wxStAppResource resload ;
|
wxStAppResource resload ;
|
||||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorRightArrow);
|
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorRightArrow);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case wxCURSOR_SPRAYCAN:
|
case wxCURSOR_SPRAYCAN:
|
||||||
{
|
{
|
||||||
wxStAppResource resload ;
|
wxStAppResource resload ;
|
||||||
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorRoller);
|
M_CURSORDATA->m_hCursor = ::GetCursor(kwxCursorRoller);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case wxCURSOR_CHAR:
|
case wxCURSOR_CHAR:
|
||||||
case wxCURSOR_ARROW:
|
case wxCURSOR_ARROW:
|
||||||
case wxCURSOR_LEFT_BUTTON:
|
case wxCURSOR_LEFT_BUTTON:
|
||||||
case wxCURSOR_RIGHT_BUTTON:
|
case wxCURSOR_RIGHT_BUTTON:
|
||||||
case wxCURSOR_MIDDLE_BUTTON:
|
case wxCURSOR_MIDDLE_BUTTON:
|
||||||
default:
|
default:
|
||||||
M_CURSORDATA->m_themeCursor = kThemeArrowCursor ;
|
M_CURSORDATA->m_themeCursor = kThemeArrowCursor ;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if ( M_CURSORDATA->m_themeCursor == -1 )
|
if ( M_CURSORDATA->m_themeCursor == -1 )
|
||||||
M_CURSORDATA->m_releaseHandle = true ;
|
M_CURSORDATA->m_releaseHandle = true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxCursor::MacInstall() const
|
void wxCursor::MacInstall() const
|
||||||
{
|
{
|
||||||
gMacCurrentCursor = *this ;
|
gMacCurrentCursor = *this ;
|
||||||
if ( m_refData && M_CURSORDATA->m_themeCursor != -1 )
|
if ( m_refData && M_CURSORDATA->m_themeCursor != -1 )
|
||||||
{
|
{
|
||||||
SetThemeCursor( M_CURSORDATA->m_themeCursor ) ;
|
SetThemeCursor( M_CURSORDATA->m_themeCursor ) ;
|
||||||
}
|
}
|
||||||
else if ( m_refData && M_CURSORDATA->m_hCursor )
|
else if ( m_refData && M_CURSORDATA->m_hCursor )
|
||||||
{
|
{
|
||||||
if ( M_CURSORDATA->m_isColorCursor )
|
if ( M_CURSORDATA->m_isColorCursor )
|
||||||
::SetCCursor( (CCrsrHandle) M_CURSORDATA->m_hCursor ) ;
|
::SetCCursor( (CCrsrHandle) M_CURSORDATA->m_hCursor ) ;
|
||||||
else
|
else
|
||||||
::SetCursor( * (CursHandle) M_CURSORDATA->m_hCursor ) ;
|
::SetCursor( * (CursHandle) M_CURSORDATA->m_hCursor ) ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetThemeCursor( kThemeArrowCursor ) ;
|
SetThemeCursor( kThemeArrowCursor ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxCursor::~wxCursor()
|
wxCursor::~wxCursor()
|
||||||
@@ -369,7 +369,7 @@ wxCursor::~wxCursor()
|
|||||||
// Global cursor setting
|
// Global cursor setting
|
||||||
void wxSetCursor(const wxCursor& cursor)
|
void wxSetCursor(const wxCursor& cursor)
|
||||||
{
|
{
|
||||||
cursor.MacInstall() ;
|
cursor.MacInstall() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -137,7 +137,7 @@ const wxChar *wxDoubleToStringStr = wxT("%.2f");
|
|||||||
const wxEventTable *wxEvtHandler::GetEventTable() const { return &wxEvtHandler::sm_eventTable; }
|
const wxEventTable *wxEvtHandler::GetEventTable() const { return &wxEvtHandler::sm_eventTable; }
|
||||||
|
|
||||||
const wxEventTable wxEvtHandler::sm_eventTable =
|
const wxEventTable wxEvtHandler::sm_eventTable =
|
||||||
{ NULL, &wxEvtHandler::sm_eventTableEntries[0] };
|
{ NULL, &wxEvtHandler::sm_eventTableEntries[0] };
|
||||||
|
|
||||||
const wxEventTableEntry wxEvtHandler::sm_eventTableEntries[] = { { 0, 0, 0, NULL } };
|
const wxEventTableEntry wxEvtHandler::sm_eventTableEntries[] = { { 0, 0, 0, NULL } };
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ bool wxDataObject::IsSupportedFormat(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxDataFormat* pFormats = new wxDataFormat[nFormatCount];
|
wxDataFormat* pFormats = new wxDataFormat[nFormatCount];
|
||||||
GetAllFormats( pFormats
|
GetAllFormats( pFormats
|
||||||
,vDir
|
,vDir
|
||||||
);
|
);
|
||||||
@@ -183,7 +183,7 @@ bool wxFileDataObject::GetDataHere(
|
|||||||
|
|
||||||
size_t wxFileDataObject::GetDataSize() const
|
size_t wxFileDataObject::GetDataSize() const
|
||||||
{
|
{
|
||||||
size_t nRes = 0;
|
size_t nRes = 0;
|
||||||
|
|
||||||
for (size_t i = 0; i < m_filenames.GetCount(); i++)
|
for (size_t i = 0; i < m_filenames.GetCount(); i++)
|
||||||
{
|
{
|
||||||
@@ -201,7 +201,7 @@ bool wxFileDataObject::SetData(
|
|||||||
{
|
{
|
||||||
m_filenames.Empty();
|
m_filenames.Empty();
|
||||||
|
|
||||||
wxString sFile( (const char *)pBuf); /* char, not wxChar */
|
wxString sFile( (const char *)pBuf); /* char, not wxChar */
|
||||||
|
|
||||||
AddFile(sFile);
|
AddFile(sFile);
|
||||||
|
|
||||||
@@ -225,15 +225,15 @@ wxBitmapDataObject::wxBitmapDataObject()
|
|||||||
}
|
}
|
||||||
|
|
||||||
wxBitmapDataObject::wxBitmapDataObject(
|
wxBitmapDataObject::wxBitmapDataObject(
|
||||||
const wxBitmap& rBitmap
|
const wxBitmap& rBitmap
|
||||||
)
|
)
|
||||||
: wxBitmapDataObjectBase(rBitmap)
|
: wxBitmapDataObjectBase(rBitmap)
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
if ( m_bitmap.Ok() )
|
if ( m_bitmap.Ok() )
|
||||||
{
|
{
|
||||||
m_pictHandle = m_bitmap.GetPict( &m_pictCreated ) ;
|
m_pictHandle = m_bitmap.GetPict( &m_pictCreated ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxBitmapDataObject::~wxBitmapDataObject()
|
wxBitmapDataObject::~wxBitmapDataObject()
|
||||||
@@ -249,23 +249,23 @@ void wxBitmapDataObject::SetBitmap(
|
|||||||
wxBitmapDataObjectBase::SetBitmap(rBitmap);
|
wxBitmapDataObjectBase::SetBitmap(rBitmap);
|
||||||
if ( m_bitmap.Ok() )
|
if ( m_bitmap.Ok() )
|
||||||
{
|
{
|
||||||
m_pictHandle = m_bitmap.GetPict( &m_pictCreated ) ;
|
m_pictHandle = m_bitmap.GetPict( &m_pictCreated ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxBitmapDataObject::Init()
|
void wxBitmapDataObject::Init()
|
||||||
{
|
{
|
||||||
m_pictHandle = NULL ;
|
m_pictHandle = NULL ;
|
||||||
m_pictCreated = false ;
|
m_pictCreated = false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxBitmapDataObject::Clear()
|
void wxBitmapDataObject::Clear()
|
||||||
{
|
{
|
||||||
if ( m_pictCreated && m_pictHandle )
|
if ( m_pictCreated && m_pictHandle )
|
||||||
{
|
{
|
||||||
KillPicture( (PicHandle) m_pictHandle ) ;
|
KillPicture( (PicHandle) m_pictHandle ) ;
|
||||||
}
|
}
|
||||||
m_pictHandle = NULL ;
|
m_pictHandle = NULL ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxBitmapDataObject::GetDataHere(
|
bool wxBitmapDataObject::GetDataHere(
|
||||||
@@ -283,7 +283,7 @@ bool wxBitmapDataObject::GetDataHere(
|
|||||||
|
|
||||||
size_t wxBitmapDataObject::GetDataSize() const
|
size_t wxBitmapDataObject::GetDataSize() const
|
||||||
{
|
{
|
||||||
return GetHandleSize((Handle)m_pictHandle) ;
|
return GetHandleSize((Handle)m_pictHandle) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxBitmapDataObject::SetData(
|
bool wxBitmapDataObject::SetData(
|
||||||
@@ -299,7 +299,7 @@ bool wxBitmapDataObject::SetData(
|
|||||||
Rect frame = (**picHandle).picFrame ;
|
Rect frame = (**picHandle).picFrame ;
|
||||||
|
|
||||||
m_bitmap.SetPict( picHandle ) ;
|
m_bitmap.SetPict( picHandle ) ;
|
||||||
m_bitmap.SetWidth( frame.right - frame.left ) ;
|
m_bitmap.SetWidth( frame.right - frame.left ) ;
|
||||||
m_bitmap.SetHeight( frame.bottom - frame.top ) ;
|
m_bitmap.SetHeight( frame.bottom - frame.top ) ;
|
||||||
return m_bitmap.Ok();
|
return m_bitmap.Ok();
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -6,7 +6,7 @@
|
|||||||
// Created: 01/02/97
|
// Created: 01/02/97
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -49,24 +49,24 @@ wxWindowDC::wxWindowDC()
|
|||||||
|
|
||||||
wxWindowDC::wxWindowDC(wxWindow *the_canvas)
|
wxWindowDC::wxWindowDC(wxWindow *the_canvas)
|
||||||
{
|
{
|
||||||
wxTopLevelWindowMac* rootwindow = the_canvas->MacGetTopLevelWindow() ;
|
wxTopLevelWindowMac* rootwindow = the_canvas->MacGetTopLevelWindow() ;
|
||||||
WindowRef windowref = (WindowRef) rootwindow->MacGetWindowRef() ;
|
WindowRef windowref = (WindowRef) rootwindow->MacGetWindowRef() ;
|
||||||
|
|
||||||
int x , y ;
|
int x , y ;
|
||||||
x = y = 0 ;
|
x = y = 0 ;
|
||||||
the_canvas->MacWindowToRootWindow( &x , &y ) ;
|
the_canvas->MacWindowToRootWindow( &x , &y ) ;
|
||||||
m_macLocalOrigin.x = x ;
|
m_macLocalOrigin.x = x ;
|
||||||
m_macLocalOrigin.y = y ;
|
m_macLocalOrigin.y = y ;
|
||||||
CopyRgn( (RgnHandle) the_canvas->MacGetVisibleRegion().GetWXHRGN() , (RgnHandle) m_macBoundaryClipRgn ) ;
|
CopyRgn( (RgnHandle) the_canvas->MacGetVisibleRegion().GetWXHRGN() , (RgnHandle) m_macBoundaryClipRgn ) ;
|
||||||
OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_macLocalOrigin.x , m_macLocalOrigin.y ) ;
|
OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_macLocalOrigin.x , m_macLocalOrigin.y ) ;
|
||||||
CopyRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ;
|
CopyRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ;
|
||||||
m_macPort = UMAGetWindowPort( windowref ) ;
|
m_macPort = UMAGetWindowPort( windowref ) ;
|
||||||
m_minY = m_minX = 0;
|
m_minY = m_minX = 0;
|
||||||
wxSize size = the_canvas->GetSize() ;
|
wxSize size = the_canvas->GetSize() ;
|
||||||
m_maxX = size.x ;
|
m_maxX = size.x ;
|
||||||
m_maxY = size.y ;
|
m_maxY = size.y ;
|
||||||
|
|
||||||
m_ok = TRUE ;
|
m_ok = TRUE ;
|
||||||
SetBackground(the_canvas->MacGetBackgroundBrush());
|
SetBackground(the_canvas->MacGetBackgroundBrush());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,30 +84,30 @@ wxClientDC::wxClientDC()
|
|||||||
|
|
||||||
wxClientDC::wxClientDC(wxWindow *window)
|
wxClientDC::wxClientDC(wxWindow *window)
|
||||||
{
|
{
|
||||||
wxTopLevelWindowMac* rootwindow = window->MacGetTopLevelWindow() ;
|
wxTopLevelWindowMac* rootwindow = window->MacGetTopLevelWindow() ;
|
||||||
if (!rootwindow)
|
if (!rootwindow)
|
||||||
return;
|
return;
|
||||||
WindowRef windowref = (WindowRef) rootwindow->MacGetWindowRef() ;
|
WindowRef windowref = (WindowRef) rootwindow->MacGetWindowRef() ;
|
||||||
wxPoint origin = window->GetClientAreaOrigin() ;
|
wxPoint origin = window->GetClientAreaOrigin() ;
|
||||||
wxSize size = window->GetClientSize() ;
|
wxSize size = window->GetClientSize() ;
|
||||||
int x , y ;
|
int x , y ;
|
||||||
x = origin.x ;
|
x = origin.x ;
|
||||||
y = origin.y ;
|
y = origin.y ;
|
||||||
window->MacWindowToRootWindow( &x , &y ) ;
|
window->MacWindowToRootWindow( &x , &y ) ;
|
||||||
m_macLocalOrigin.x = x ;
|
m_macLocalOrigin.x = x ;
|
||||||
m_macLocalOrigin.y = y ;
|
m_macLocalOrigin.y = y ;
|
||||||
SetRectRgn( (RgnHandle) m_macBoundaryClipRgn , origin.x , origin.y , origin.x + size.x , origin.y + size.y ) ;
|
SetRectRgn( (RgnHandle) m_macBoundaryClipRgn , origin.x , origin.y , origin.x + size.x , origin.y + size.y ) ;
|
||||||
SectRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) window->MacGetVisibleRegion().GetWXHRGN() , (RgnHandle) m_macBoundaryClipRgn ) ;
|
SectRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) window->MacGetVisibleRegion().GetWXHRGN() , (RgnHandle) m_macBoundaryClipRgn ) ;
|
||||||
OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
|
OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
|
||||||
OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_macLocalOrigin.x , m_macLocalOrigin.y ) ;
|
OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_macLocalOrigin.x , m_macLocalOrigin.y ) ;
|
||||||
CopyRgn( (RgnHandle) m_macBoundaryClipRgn ,(RgnHandle) m_macCurrentClipRgn ) ;
|
CopyRgn( (RgnHandle) m_macBoundaryClipRgn ,(RgnHandle) m_macCurrentClipRgn ) ;
|
||||||
m_macPort = UMAGetWindowPort( windowref ) ;
|
m_macPort = UMAGetWindowPort( windowref ) ;
|
||||||
m_minY = m_minX = 0;
|
m_minY = m_minX = 0;
|
||||||
m_maxX = size.x ;
|
m_maxX = size.x ;
|
||||||
m_maxY = size.y ;
|
m_maxY = size.y ;
|
||||||
m_ok = TRUE ;
|
m_ok = TRUE ;
|
||||||
SetBackground(window->MacGetBackgroundBrush());
|
SetBackground(window->MacGetBackgroundBrush());
|
||||||
SetFont( window->GetFont() ) ;
|
SetFont( window->GetFont() ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxClientDC::~wxClientDC()
|
wxClientDC::~wxClientDC()
|
||||||
@@ -124,29 +124,29 @@ wxPaintDC::wxPaintDC()
|
|||||||
|
|
||||||
wxPaintDC::wxPaintDC(wxWindow *window)
|
wxPaintDC::wxPaintDC(wxWindow *window)
|
||||||
{
|
{
|
||||||
wxTopLevelWindowMac* rootwindow = window->MacGetTopLevelWindow() ;
|
wxTopLevelWindowMac* rootwindow = window->MacGetTopLevelWindow() ;
|
||||||
WindowRef windowref = (WindowRef) rootwindow->MacGetWindowRef() ;
|
WindowRef windowref = (WindowRef) rootwindow->MacGetWindowRef() ;
|
||||||
wxPoint origin = window->GetClientAreaOrigin() ;
|
wxPoint origin = window->GetClientAreaOrigin() ;
|
||||||
wxSize size = window->GetClientSize() ;
|
wxSize size = window->GetClientSize() ;
|
||||||
int x , y ;
|
int x , y ;
|
||||||
x = origin.x ;
|
x = origin.x ;
|
||||||
y = origin.y ;
|
y = origin.y ;
|
||||||
window->MacWindowToRootWindow( &x , &y ) ;
|
window->MacWindowToRootWindow( &x , &y ) ;
|
||||||
m_macLocalOrigin.x = x ;
|
m_macLocalOrigin.x = x ;
|
||||||
m_macLocalOrigin.y = y ;
|
m_macLocalOrigin.y = y ;
|
||||||
SetRectRgn( (RgnHandle) m_macBoundaryClipRgn , origin.x , origin.y , origin.x + size.x , origin.y + size.y ) ;
|
SetRectRgn( (RgnHandle) m_macBoundaryClipRgn , origin.x , origin.y , origin.x + size.x , origin.y + size.y ) ;
|
||||||
SectRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) window->MacGetVisibleRegion().GetWXHRGN() , (RgnHandle) m_macBoundaryClipRgn ) ;
|
SectRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) window->MacGetVisibleRegion().GetWXHRGN() , (RgnHandle) m_macBoundaryClipRgn ) ;
|
||||||
OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
|
OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
|
||||||
SectRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) window->GetUpdateRegion().GetWXHRGN() , (RgnHandle) m_macBoundaryClipRgn ) ;
|
SectRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) window->GetUpdateRegion().GetWXHRGN() , (RgnHandle) m_macBoundaryClipRgn ) ;
|
||||||
OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_macLocalOrigin.x , m_macLocalOrigin.y ) ;
|
OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_macLocalOrigin.x , m_macLocalOrigin.y ) ;
|
||||||
CopyRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ;
|
CopyRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ;
|
||||||
m_macPort = UMAGetWindowPort( windowref ) ;
|
m_macPort = UMAGetWindowPort( windowref ) ;
|
||||||
m_minY = m_minX = 0;
|
m_minY = m_minX = 0;
|
||||||
m_maxX = size.x ;
|
m_maxX = size.x ;
|
||||||
m_maxY = size.y ;
|
m_maxY = size.y ;
|
||||||
m_ok = TRUE ;
|
m_ok = TRUE ;
|
||||||
SetBackground(window->MacGetBackgroundBrush());
|
SetBackground(window->MacGetBackgroundBrush());
|
||||||
SetFont( window->GetFont() ) ;
|
SetFont( window->GetFont() ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPaintDC::~wxPaintDC()
|
wxPaintDC::~wxPaintDC()
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 01/02/97
|
// Created: 01/02/97
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -23,78 +23,78 @@
|
|||||||
IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxPaintDC)
|
IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxPaintDC)
|
||||||
|
|
||||||
wxMemoryDC::wxMemoryDC(void)
|
wxMemoryDC::wxMemoryDC(void)
|
||||||
: m_selected()
|
: m_selected()
|
||||||
{
|
{
|
||||||
m_ok = TRUE;
|
m_ok = TRUE;
|
||||||
SetBackground(*wxWHITE_BRUSH);
|
SetBackground(*wxWHITE_BRUSH);
|
||||||
SetBrush(*wxWHITE_BRUSH);
|
SetBrush(*wxWHITE_BRUSH);
|
||||||
SetPen(*wxBLACK_PEN);
|
SetPen(*wxBLACK_PEN);
|
||||||
m_ok = FALSE;
|
m_ok = FALSE;
|
||||||
};
|
};
|
||||||
|
|
||||||
wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) )
|
wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) )
|
||||||
: m_selected()
|
: m_selected()
|
||||||
{
|
{
|
||||||
m_ok = TRUE;
|
m_ok = TRUE;
|
||||||
SetBackground(*wxWHITE_BRUSH);
|
SetBackground(*wxWHITE_BRUSH);
|
||||||
SetBrush(*wxWHITE_BRUSH);
|
SetBrush(*wxWHITE_BRUSH);
|
||||||
SetPen(*wxBLACK_PEN);
|
SetPen(*wxBLACK_PEN);
|
||||||
m_ok = FALSE;
|
m_ok = FALSE;
|
||||||
};
|
};
|
||||||
|
|
||||||
wxMemoryDC::~wxMemoryDC()
|
wxMemoryDC::~wxMemoryDC()
|
||||||
{
|
{
|
||||||
if ( m_selected.Ok() )
|
if ( m_selected.Ok() )
|
||||||
{
|
{
|
||||||
UnlockPixels( GetGWorldPixMap(MAC_WXHBITMAP(m_selected.GetHBITMAP())) );
|
UnlockPixels( GetGWorldPixMap(MAC_WXHBITMAP(m_selected.GetHBITMAP())) );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
|
void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
|
||||||
{
|
{
|
||||||
if ( m_selected.Ok() )
|
if ( m_selected.Ok() )
|
||||||
{
|
{
|
||||||
UnlockPixels( GetGWorldPixMap(MAC_WXHBITMAP(m_selected.GetHBITMAP())) );
|
UnlockPixels( GetGWorldPixMap(MAC_WXHBITMAP(m_selected.GetHBITMAP())) );
|
||||||
}
|
}
|
||||||
m_selected = bitmap;
|
m_selected = bitmap;
|
||||||
if (m_selected.Ok())
|
if (m_selected.Ok())
|
||||||
{
|
{
|
||||||
if ( m_selected.GetHBITMAP() )
|
if ( m_selected.GetHBITMAP() )
|
||||||
{
|
{
|
||||||
m_macPort = (GrafPtr) m_selected.GetHBITMAP() ;
|
m_macPort = (GrafPtr) m_selected.GetHBITMAP() ;
|
||||||
LockPixels( GetGWorldPixMap( (CGrafPtr) m_macPort ) ) ;
|
LockPixels( GetGWorldPixMap( (CGrafPtr) m_macPort ) ) ;
|
||||||
wxMask * mask = bitmap.GetMask() ;
|
wxMask * mask = bitmap.GetMask() ;
|
||||||
if ( mask )
|
if ( mask )
|
||||||
{
|
{
|
||||||
m_macMask = mask->GetMaskBitmap() ;
|
m_macMask = mask->GetMaskBitmap() ;
|
||||||
}
|
}
|
||||||
SetRectRgn( (RgnHandle) m_macBoundaryClipRgn , 0 , 0 , m_selected.GetWidth() , m_selected.GetHeight() ) ;
|
SetRectRgn( (RgnHandle) m_macBoundaryClipRgn , 0 , 0 , m_selected.GetWidth() , m_selected.GetHeight() ) ;
|
||||||
CopyRgn( (RgnHandle) m_macBoundaryClipRgn ,(RgnHandle) m_macCurrentClipRgn ) ;
|
CopyRgn( (RgnHandle) m_macBoundaryClipRgn ,(RgnHandle) m_macCurrentClipRgn ) ;
|
||||||
m_ok = TRUE ;
|
m_ok = TRUE ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_ok = FALSE;
|
m_ok = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_ok = FALSE;
|
m_ok = FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMemoryDC::DoGetSize( int *width, int *height ) const
|
void wxMemoryDC::DoGetSize( int *width, int *height ) const
|
||||||
{
|
{
|
||||||
if (m_selected.Ok())
|
if (m_selected.Ok())
|
||||||
{
|
{
|
||||||
if (width) (*width) = m_selected.GetWidth();
|
if (width) (*width) = m_selected.GetWidth();
|
||||||
if (height) (*height) = m_selected.GetHeight();
|
if (height) (*height) = m_selected.GetHeight();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (width) (*width) = 0;
|
if (width) (*width) = 0;
|
||||||
if (height) (*height) = 0;
|
if (height) (*height) = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 01/02/97
|
// Created: 01/02/97
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart and Markus Holzem
|
// Copyright: (c) Julian Smart and Markus Holzem
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -46,172 +46,172 @@ GrafPtr macPrintFormerPort = NULL ;
|
|||||||
|
|
||||||
wxPrinterDC::wxPrinterDC(const wxPrintData& printdata)
|
wxPrinterDC::wxPrinterDC(const wxPrintData& printdata)
|
||||||
{
|
{
|
||||||
OSStatus err ;
|
OSStatus err ;
|
||||||
wxString message ;
|
wxString message ;
|
||||||
|
|
||||||
m_printData = printdata ;
|
m_printData = printdata ;
|
||||||
m_printData.ConvertToNative() ;
|
m_printData.ConvertToNative() ;
|
||||||
|
|
||||||
#if TARGET_CARBON && PM_USE_SESSION_APIS
|
#if TARGET_CARBON && PM_USE_SESSION_APIS
|
||||||
err = UMAPrOpen(&m_macPrintSessionPort) ;
|
err = UMAPrOpen(&m_macPrintSessionPort) ;
|
||||||
if ( err != noErr || m_macPrintSessionPort == kPMNoData )
|
if ( err != noErr || m_macPrintSessionPort == kPMNoData )
|
||||||
#else
|
#else
|
||||||
err = UMAPrOpen(NULL) ;
|
err = UMAPrOpen(NULL) ;
|
||||||
if ( err != noErr )
|
if ( err != noErr )
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
message.Printf( "Print Error %ld", err ) ;
|
message.Printf( "Print Error %ld", err ) ;
|
||||||
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
|
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
|
||||||
dialog.ShowModal();
|
dialog.ShowModal();
|
||||||
#if TARGET_CARBON && PM_USE_SESSION_APIS
|
#if TARGET_CARBON && PM_USE_SESSION_APIS
|
||||||
UMAPrClose(&m_macPrintSessionPort) ;
|
UMAPrClose(&m_macPrintSessionPort) ;
|
||||||
#else
|
#else
|
||||||
UMAPrClose(NULL) ;
|
UMAPrClose(NULL) ;
|
||||||
#endif
|
#endif
|
||||||
m_ok = FALSE;
|
m_ok = FALSE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !TARGET_CARBON
|
#if !TARGET_CARBON
|
||||||
if ( ::PrValidate( (THPrint) m_printData.m_macPrintSettings ) )
|
if ( ::PrValidate( (THPrint) m_printData.m_macPrintSettings ) )
|
||||||
{
|
{
|
||||||
::PrStlDialog( (THPrint) m_printData.m_macPrintSettings ) ;
|
::PrStlDialog( (THPrint) m_printData.m_macPrintSettings ) ;
|
||||||
// the driver has changed in the mean time, should we pop up a page setup dialog ?
|
// the driver has changed in the mean time, should we pop up a page setup dialog ?
|
||||||
}
|
}
|
||||||
err = PrError() ;
|
err = PrError() ;
|
||||||
if ( err != noErr )
|
if ( err != noErr )
|
||||||
{
|
{
|
||||||
message.Printf( "Print Error %ld", err ) ;
|
message.Printf( "Print Error %ld", err ) ;
|
||||||
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
|
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
|
||||||
dialog.ShowModal();
|
dialog.ShowModal();
|
||||||
UMAPrClose(NULL) ;
|
UMAPrClose(NULL) ;
|
||||||
m_ok = FALSE;
|
m_ok = FALSE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
::GetPort( &macPrintFormerPort ) ;
|
::GetPort( &macPrintFormerPort ) ;
|
||||||
m_macPrintSessionPort = ::PrOpenDoc( (THPrint) m_printData.m_macPrintSettings , NULL , NULL ) ;
|
m_macPrintSessionPort = ::PrOpenDoc( (THPrint) m_printData.m_macPrintSettings , NULL , NULL ) ;
|
||||||
err = PrError() ;
|
err = PrError() ;
|
||||||
if ( err )
|
if ( err )
|
||||||
{
|
{
|
||||||
message.Printf( "Print Error %ld", err ) ;
|
message.Printf( "Print Error %ld", err ) ;
|
||||||
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
|
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
|
||||||
dialog.ShowModal();
|
dialog.ShowModal();
|
||||||
UMAPrClose(NULL) ;
|
UMAPrClose(NULL) ;
|
||||||
m_ok = FALSE;
|
m_ok = FALSE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// sets current port
|
// sets current port
|
||||||
m_macPort = (GrafPtr ) m_macPrintSessionPort ;
|
m_macPort = (GrafPtr ) m_macPrintSessionPort ;
|
||||||
#else
|
#else
|
||||||
#if PM_USE_SESSION_APIS
|
#if PM_USE_SESSION_APIS
|
||||||
err = PMSessionBeginDocument((PMPrintSession)m_macPrintSessionPort,
|
err = PMSessionBeginDocument((PMPrintSession)m_macPrintSessionPort,
|
||||||
(PMPrintSettings)m_printData.m_macPrintSettings,
|
(PMPrintSettings)m_printData.m_macPrintSettings,
|
||||||
(PMPageFormat)m_printData.m_macPageFormat);
|
(PMPageFormat)m_printData.m_macPageFormat);
|
||||||
if ( err != noErr )
|
if ( err != noErr )
|
||||||
#else
|
#else
|
||||||
m_macPrintSessionPort = kPMNoReference ;
|
m_macPrintSessionPort = kPMNoReference ;
|
||||||
err = PMBeginDocument(
|
err = PMBeginDocument(
|
||||||
m_printData.m_macPrintSettings,
|
m_printData.m_macPrintSettings,
|
||||||
m_printData.m_macPageFormat,
|
m_printData.m_macPageFormat,
|
||||||
&m_macPrintSessionPort);
|
&m_macPrintSessionPort);
|
||||||
if ( err != noErr || m_macPrintSessionPort == kPMNoReference )
|
if ( err != noErr || m_macPrintSessionPort == kPMNoReference )
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
message.Printf( "Print Error %ld", err ) ;
|
message.Printf( "Print Error %ld", err ) ;
|
||||||
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
|
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
|
||||||
dialog.ShowModal();
|
dialog.ShowModal();
|
||||||
#if TARGET_CARBON && PM_USE_SESSION_APIS
|
#if TARGET_CARBON && PM_USE_SESSION_APIS
|
||||||
UMAPrClose(&m_macPrintSessionPort) ;
|
UMAPrClose(&m_macPrintSessionPort) ;
|
||||||
#else
|
#else
|
||||||
UMAPrClose(NULL) ;
|
UMAPrClose(NULL) ;
|
||||||
#endif
|
#endif
|
||||||
m_ok = FALSE;
|
m_ok = FALSE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// sets current port
|
// sets current port
|
||||||
::GetPort( (GrafPtr *)&m_macPort ) ;
|
::GetPort( (GrafPtr *)&m_macPort ) ;
|
||||||
#endif
|
#endif
|
||||||
m_ok = TRUE ;
|
m_ok = TRUE ;
|
||||||
m_minY = m_minX = 0 ;
|
m_minY = m_minX = 0 ;
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
PMRect rPaper;
|
PMRect rPaper;
|
||||||
|
|
||||||
err = PMGetAdjustedPaperRect((PMPageFormat)m_printData.m_macPageFormat, &rPaper);
|
err = PMGetAdjustedPaperRect((PMPageFormat)m_printData.m_macPageFormat, &rPaper);
|
||||||
if ( err != noErr )
|
if ( err != noErr )
|
||||||
{
|
{
|
||||||
message.Printf( "Print Error %ld", err ) ;
|
message.Printf( "Print Error %ld", err ) ;
|
||||||
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
|
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
|
||||||
dialog.ShowModal();
|
dialog.ShowModal();
|
||||||
#if TARGET_CARBON && PM_USE_SESSION_APIS
|
#if TARGET_CARBON && PM_USE_SESSION_APIS
|
||||||
UMAPrClose(&m_macPrintSessionPort) ;
|
UMAPrClose(&m_macPrintSessionPort) ;
|
||||||
#else
|
#else
|
||||||
UMAPrClose(NULL) ;
|
UMAPrClose(NULL) ;
|
||||||
#endif
|
#endif
|
||||||
m_ok = FALSE;
|
m_ok = FALSE;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_maxX = wxCoord(rPaper.right - rPaper.left) ;
|
m_maxX = wxCoord(rPaper.right - rPaper.left) ;
|
||||||
m_maxY = wxCoord(rPaper.bottom - rPaper.top);
|
m_maxY = wxCoord(rPaper.bottom - rPaper.top);
|
||||||
#else
|
#else
|
||||||
m_maxX = (**(THPrint)m_printData.m_macPrintSettings).rPaper.right - (**(THPrint)m_printData.m_macPrintSettings).rPaper.left ;
|
m_maxX = (**(THPrint)m_printData.m_macPrintSettings).rPaper.right - (**(THPrint)m_printData.m_macPrintSettings).rPaper.left ;
|
||||||
m_maxY = (**(THPrint)m_printData.m_macPrintSettings).rPaper.bottom - (**(THPrint)m_printData.m_macPrintSettings).rPaper.top ;
|
m_maxY = (**(THPrint)m_printData.m_macPrintSettings).rPaper.bottom - (**(THPrint)m_printData.m_macPrintSettings).rPaper.top ;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPrinterDC::~wxPrinterDC(void)
|
wxPrinterDC::~wxPrinterDC(void)
|
||||||
{
|
{
|
||||||
OSStatus err ;
|
OSStatus err ;
|
||||||
wxString message ;
|
wxString message ;
|
||||||
#if !TARGET_CARBON
|
#if !TARGET_CARBON
|
||||||
if ( m_ok )
|
if ( m_ok )
|
||||||
{
|
{
|
||||||
::PrCloseDoc( (TPPrPort) m_macPrintSessionPort ) ;
|
::PrCloseDoc( (TPPrPort) m_macPrintSessionPort ) ;
|
||||||
err = PrError() ;
|
err = PrError() ;
|
||||||
|
|
||||||
if ( err == noErr )
|
if ( err == noErr )
|
||||||
{
|
{
|
||||||
if ( (**(THPrint)m_printData.m_macPrintSettings).prJob.bJDocLoop == bSpoolLoop )
|
if ( (**(THPrint)m_printData.m_macPrintSettings).prJob.bJDocLoop == bSpoolLoop )
|
||||||
{
|
{
|
||||||
TPrStatus status ;
|
TPrStatus status ;
|
||||||
::PrPicFile( (THPrint) m_printData.m_macPrintSettings , NULL , NULL , NULL , &status ) ;
|
::PrPicFile( (THPrint) m_printData.m_macPrintSettings , NULL , NULL , NULL , &status ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
message.Printf( "Print Error %ld", err ) ;
|
message.Printf( "Print Error %ld", err ) ;
|
||||||
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
|
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
|
||||||
dialog.ShowModal();
|
dialog.ShowModal();
|
||||||
}
|
}
|
||||||
::UMAPrClose(NULL) ;
|
::UMAPrClose(NULL) ;
|
||||||
// ::SetPort( macPrintFormerPort ) ;
|
// ::SetPort( macPrintFormerPort ) ;
|
||||||
::SetPort( LMGetWMgrPort() ) ;
|
::SetPort( LMGetWMgrPort() ) ;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if ( m_ok )
|
if ( m_ok )
|
||||||
{
|
{
|
||||||
#if PM_USE_SESSION_APIS
|
#if PM_USE_SESSION_APIS
|
||||||
err = PMSessionEndDocument((PMPrintSession)m_macPrintSessionPort);
|
err = PMSessionEndDocument((PMPrintSession)m_macPrintSessionPort);
|
||||||
#else
|
#else
|
||||||
err = PMEndDocument(m_macPrintSessionPort);
|
err = PMEndDocument(m_macPrintSessionPort);
|
||||||
#endif
|
#endif
|
||||||
if ( err != noErr )
|
if ( err != noErr )
|
||||||
{
|
{
|
||||||
message.Printf( "Print Error %ld", err ) ;
|
message.Printf( "Print Error %ld", err ) ;
|
||||||
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
|
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
|
||||||
dialog.ShowModal();
|
dialog.ShowModal();
|
||||||
}
|
}
|
||||||
#if TARGET_CARBON && PM_USE_SESSION_APIS
|
#if TARGET_CARBON && PM_USE_SESSION_APIS
|
||||||
UMAPrClose(&m_macPrintSessionPort) ;
|
UMAPrClose(&m_macPrintSessionPort) ;
|
||||||
#else
|
#else
|
||||||
UMAPrClose(NULL) ;
|
UMAPrClose(NULL) ;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxPrinterDC::StartDoc( const wxString& WXUNUSED(message) )
|
bool wxPrinterDC::StartDoc( const wxString& WXUNUSED(message) )
|
||||||
{
|
{
|
||||||
return m_ok ;
|
return m_ok ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPrinterDC::EndDoc(void)
|
void wxPrinterDC::EndDoc(void)
|
||||||
@@ -220,117 +220,117 @@ void wxPrinterDC::EndDoc(void)
|
|||||||
|
|
||||||
void wxPrinterDC::StartPage(void)
|
void wxPrinterDC::StartPage(void)
|
||||||
{
|
{
|
||||||
if ( !m_ok )
|
if ( !m_ok )
|
||||||
return ;
|
return ;
|
||||||
|
|
||||||
m_logicalFunction = wxCOPY;
|
m_logicalFunction = wxCOPY;
|
||||||
// m_textAlignment = wxALIGN_TOP_LEFT;
|
// m_textAlignment = wxALIGN_TOP_LEFT;
|
||||||
m_backgroundMode = wxTRANSPARENT;
|
m_backgroundMode = wxTRANSPARENT;
|
||||||
|
|
||||||
m_textForegroundColour = *wxBLACK;
|
m_textForegroundColour = *wxBLACK;
|
||||||
m_textBackgroundColour = *wxWHITE;
|
m_textBackgroundColour = *wxWHITE;
|
||||||
m_pen = *wxBLACK_PEN;
|
m_pen = *wxBLACK_PEN;
|
||||||
m_font = *wxNORMAL_FONT;
|
m_font = *wxNORMAL_FONT;
|
||||||
m_brush = *wxTRANSPARENT_BRUSH;
|
m_brush = *wxTRANSPARENT_BRUSH;
|
||||||
m_backgroundBrush = *wxWHITE_BRUSH;
|
m_backgroundBrush = *wxWHITE_BRUSH;
|
||||||
|
|
||||||
m_macFontInstalled = false ;
|
m_macFontInstalled = false ;
|
||||||
m_macBrushInstalled = false ;
|
m_macBrushInstalled = false ;
|
||||||
m_macPenInstalled = false ;
|
m_macPenInstalled = false ;
|
||||||
|
|
||||||
|
|
||||||
OSStatus err ;
|
OSStatus err ;
|
||||||
wxString message ;
|
wxString message ;
|
||||||
|
|
||||||
#if !TARGET_CARBON
|
#if !TARGET_CARBON
|
||||||
PrOpenPage( (TPPrPort) m_macPrintSessionPort , NULL ) ;
|
PrOpenPage( (TPPrPort) m_macPrintSessionPort , NULL ) ;
|
||||||
m_macLocalOrigin.x = (**(THPrint)m_printData.m_macPrintSettings).rPaper.left ;
|
m_macLocalOrigin.x = (**(THPrint)m_printData.m_macPrintSettings).rPaper.left ;
|
||||||
m_macLocalOrigin.y = (**(THPrint)m_printData.m_macPrintSettings).rPaper.top ;
|
m_macLocalOrigin.y = (**(THPrint)m_printData.m_macPrintSettings).rPaper.top ;
|
||||||
|
|
||||||
Rect clip = { -32000 , -32000 , 32000 , 32000 } ;
|
Rect clip = { -32000 , -32000 , 32000 , 32000 } ;
|
||||||
::ClipRect( &clip ) ;
|
::ClipRect( &clip ) ;
|
||||||
err = PrError() ;
|
err = PrError() ;
|
||||||
if ( err != noErr )
|
if ( err != noErr )
|
||||||
{
|
{
|
||||||
message.Printf( "Print Error %ld", err ) ;
|
message.Printf( "Print Error %ld", err ) ;
|
||||||
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
|
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
|
||||||
dialog.ShowModal();
|
dialog.ShowModal();
|
||||||
::PrClosePage( (TPPrPort) m_macPrintSessionPort ) ;
|
::PrClosePage( (TPPrPort) m_macPrintSessionPort ) ;
|
||||||
::PrCloseDoc( (TPPrPort) m_macPrintSessionPort ) ;
|
::PrCloseDoc( (TPPrPort) m_macPrintSessionPort ) ;
|
||||||
::UMAPrClose(NULL) ;
|
::UMAPrClose(NULL) ;
|
||||||
::SetPort( macPrintFormerPort ) ;
|
::SetPort( macPrintFormerPort ) ;
|
||||||
m_ok = FALSE ;
|
m_ok = FALSE ;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#if PM_USE_SESSION_APIS
|
#if PM_USE_SESSION_APIS
|
||||||
err = PMSessionBeginPage((PMPrintSession)m_macPrintSessionPort,
|
err = PMSessionBeginPage((PMPrintSession)m_macPrintSessionPort,
|
||||||
(PMPageFormat)m_printData.m_macPageFormat,
|
(PMPageFormat)m_printData.m_macPageFormat,
|
||||||
nil);
|
nil);
|
||||||
#else
|
#else
|
||||||
err = PMBeginPage(m_macPrintSessionPort, nil);
|
err = PMBeginPage(m_macPrintSessionPort, nil);
|
||||||
#endif
|
#endif
|
||||||
if ( err != noErr )
|
if ( err != noErr )
|
||||||
{
|
{
|
||||||
message.Printf( "Print Error %ld", err ) ;
|
message.Printf( "Print Error %ld", err ) ;
|
||||||
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
|
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
|
||||||
dialog.ShowModal();
|
dialog.ShowModal();
|
||||||
#if PM_USE_SESSION_APIS
|
#if PM_USE_SESSION_APIS
|
||||||
PMSessionEndPage((PMPrintSession)m_macPrintSessionPort);
|
PMSessionEndPage((PMPrintSession)m_macPrintSessionPort);
|
||||||
PMSessionEndDocument((PMPrintSession)m_macPrintSessionPort);
|
PMSessionEndDocument((PMPrintSession)m_macPrintSessionPort);
|
||||||
UMAPrClose(&m_macPrintSessionPort) ;
|
UMAPrClose(&m_macPrintSessionPort) ;
|
||||||
#else
|
#else
|
||||||
PMEndPage(m_macPrintSessionPort);
|
PMEndPage(m_macPrintSessionPort);
|
||||||
PMEndDocument(m_macPrintSessionPort);
|
PMEndDocument(m_macPrintSessionPort);
|
||||||
UMAPrClose(NULL) ;
|
UMAPrClose(NULL) ;
|
||||||
#endif
|
#endif
|
||||||
::SetPort( macPrintFormerPort ) ;
|
::SetPort( macPrintFormerPort ) ;
|
||||||
m_ok = FALSE ;
|
m_ok = FALSE ;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxPrinterDC::EndPage(void)
|
void wxPrinterDC::EndPage(void)
|
||||||
{
|
{
|
||||||
if ( !m_ok )
|
if ( !m_ok )
|
||||||
return ;
|
return ;
|
||||||
|
|
||||||
OSStatus err ;
|
OSStatus err ;
|
||||||
wxString message ;
|
wxString message ;
|
||||||
|
|
||||||
#if !TARGET_CARBON
|
#if !TARGET_CARBON
|
||||||
PrClosePage( (TPPrPort) m_macPort ) ;
|
PrClosePage( (TPPrPort) m_macPort ) ;
|
||||||
err = PrError() ;
|
err = PrError() ;
|
||||||
if ( err != noErr )
|
if ( err != noErr )
|
||||||
{
|
{
|
||||||
message.Printf( "Print Error %ld", err ) ;
|
message.Printf( "Print Error %ld", err ) ;
|
||||||
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
|
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
|
||||||
dialog.ShowModal();
|
dialog.ShowModal();
|
||||||
::PrCloseDoc( (TPPrPort) m_macPrintSessionPort ) ;
|
::PrCloseDoc( (TPPrPort) m_macPrintSessionPort ) ;
|
||||||
::UMAPrClose(NULL) ;
|
::UMAPrClose(NULL) ;
|
||||||
::SetPort( macPrintFormerPort ) ;
|
::SetPort( macPrintFormerPort ) ;
|
||||||
m_ok = FALSE ;
|
m_ok = FALSE ;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#if PM_USE_SESSION_APIS
|
#if PM_USE_SESSION_APIS
|
||||||
err = PMSessionEndPage((PMPrintSession)m_macPrintSessionPort);
|
err = PMSessionEndPage((PMPrintSession)m_macPrintSessionPort);
|
||||||
#else
|
#else
|
||||||
err = PMEndPage(m_macPrintSessionPort);
|
err = PMEndPage(m_macPrintSessionPort);
|
||||||
#endif
|
#endif
|
||||||
if ( err != noErr )
|
if ( err != noErr )
|
||||||
{
|
{
|
||||||
message.Printf( "Print Error %ld", err ) ;
|
message.Printf( "Print Error %ld", err ) ;
|
||||||
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
|
wxMessageDialog dialog( NULL , message , "", wxICON_HAND | wxOK) ;
|
||||||
dialog.ShowModal();
|
dialog.ShowModal();
|
||||||
#if PM_USE_SESSION_APIS
|
#if PM_USE_SESSION_APIS
|
||||||
PMSessionEndDocument((PMPrintSession)m_macPrintSessionPort);
|
PMSessionEndDocument((PMPrintSession)m_macPrintSessionPort);
|
||||||
UMAPrClose(&m_macPrintSessionPort) ;
|
UMAPrClose(&m_macPrintSessionPort) ;
|
||||||
#else
|
#else
|
||||||
PMEndDocument(m_macPrintSessionPort);
|
PMEndDocument(m_macPrintSessionPort);
|
||||||
UMAPrClose(NULL) ;
|
UMAPrClose(NULL) ;
|
||||||
#endif
|
#endif
|
||||||
::SetPort( macPrintFormerPort ) ;
|
::SetPort( macPrintFormerPort ) ;
|
||||||
m_ok = FALSE ;
|
m_ok = FALSE ;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -24,36 +24,36 @@ IMPLEMENT_DYNAMIC_CLASS(wxScreenDC, wxWindowDC)
|
|||||||
wxScreenDC::wxScreenDC()
|
wxScreenDC::wxScreenDC()
|
||||||
{
|
{
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
m_macPort = GetQDGlobalsThePort() ;
|
m_macPort = GetQDGlobalsThePort() ;
|
||||||
GrafPtr port ;
|
GrafPtr port ;
|
||||||
GetPort( &port ) ;
|
GetPort( &port ) ;
|
||||||
SetPort( (GrafPtr) m_macPort ) ;
|
SetPort( (GrafPtr) m_macPort ) ;
|
||||||
Point pt = { 0,0 } ;
|
Point pt = { 0,0 } ;
|
||||||
LocalToGlobal( &pt ) ;
|
LocalToGlobal( &pt ) ;
|
||||||
SetPort( port ) ;
|
SetPort( port ) ;
|
||||||
m_macLocalOrigin.x = -pt.h ;
|
m_macLocalOrigin.x = -pt.h ;
|
||||||
m_macLocalOrigin.y = -pt.v ;
|
m_macLocalOrigin.y = -pt.v ;
|
||||||
#else
|
#else
|
||||||
m_macPort = LMGetWMgrPort() ;
|
m_macPort = LMGetWMgrPort() ;
|
||||||
m_macLocalOrigin.x = 0 ;
|
m_macLocalOrigin.x = 0 ;
|
||||||
m_macLocalOrigin.y = 0 ;
|
m_macLocalOrigin.y = 0 ;
|
||||||
#endif
|
#endif
|
||||||
m_ok = TRUE ;
|
m_ok = TRUE ;
|
||||||
BitMap screenBits;
|
BitMap screenBits;
|
||||||
GetQDGlobalsScreenBits( &screenBits );
|
GetQDGlobalsScreenBits( &screenBits );
|
||||||
m_minX = screenBits.bounds.left ;
|
m_minX = screenBits.bounds.left ;
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
SInt16 height ;
|
SInt16 height ;
|
||||||
GetThemeMenuBarHeight( &height ) ;
|
GetThemeMenuBarHeight( &height ) ;
|
||||||
m_minY = screenBits.bounds.top + height ;
|
m_minY = screenBits.bounds.top + height ;
|
||||||
#else
|
#else
|
||||||
m_minY = screenBits.bounds.top + LMGetMBarHeight() ;
|
m_minY = screenBits.bounds.top + LMGetMBarHeight() ;
|
||||||
#endif
|
#endif
|
||||||
m_maxX = screenBits.bounds.right ;
|
m_maxX = screenBits.bounds.right ;
|
||||||
m_maxY = screenBits.bounds.bottom ;
|
m_maxY = screenBits.bounds.bottom ;
|
||||||
MacSetRectRgn( (RgnHandle) m_macBoundaryClipRgn , m_minX , m_minY , m_maxX , m_maxY ) ;
|
MacSetRectRgn( (RgnHandle) m_macBoundaryClipRgn , m_minX , m_minY , m_maxX , m_maxY ) ;
|
||||||
OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_macLocalOrigin.x , m_macLocalOrigin.y ) ;
|
OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_macLocalOrigin.x , m_macLocalOrigin.y ) ;
|
||||||
CopyRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ;
|
CopyRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxScreenDC::~wxScreenDC()
|
wxScreenDC::~wxScreenDC()
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -46,7 +46,7 @@ END_EVENT_TABLE()
|
|||||||
|
|
||||||
wxDialog::wxDialog()
|
wxDialog::wxDialog()
|
||||||
{
|
{
|
||||||
m_isShown = FALSE;
|
m_isShown = FALSE;
|
||||||
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
|
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,23 +57,23 @@ bool wxDialog::Create(wxWindow *parent, wxWindowID id,
|
|||||||
long style,
|
long style,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
|
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
|
||||||
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
|
|
||||||
|
|
||||||
|
|
||||||
if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) )
|
if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
MacCreateRealWindow( title , pos , size , MacRemoveBordersFromStyle(style) , name ) ;
|
MacCreateRealWindow( title , pos , size , MacRemoveBordersFromStyle(style) , name ) ;
|
||||||
|
|
||||||
m_macWindowBackgroundTheme = kThemeBrushDialogBackgroundActive ;
|
m_macWindowBackgroundTheme = kThemeBrushDialogBackgroundActive ;
|
||||||
SetThemeWindowBackground( (WindowRef) m_macWindow , m_macWindowBackgroundTheme , false ) ;
|
SetThemeWindowBackground( (WindowRef) m_macWindow , m_macWindowBackgroundTheme , false ) ;
|
||||||
return TRUE;
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDialog::SetModal(bool flag)
|
void wxDialog::SetModal(bool flag)
|
||||||
{
|
{
|
||||||
if ( flag )
|
if ( flag )
|
||||||
{
|
{
|
||||||
m_windowStyle |= wxDIALOG_MODAL;
|
m_windowStyle |= wxDIALOG_MODAL;
|
||||||
|
|
||||||
@@ -89,28 +89,27 @@ void wxDialog::SetModal(bool flag)
|
|||||||
|
|
||||||
wxDialog::~wxDialog()
|
wxDialog::~wxDialog()
|
||||||
{
|
{
|
||||||
m_isBeingDeleted = TRUE ;
|
m_isBeingDeleted = TRUE ;
|
||||||
Show(FALSE);
|
Show(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// By default, pressing escape cancels the dialog , on mac command-stop does the same thing
|
// By default, pressing escape cancels the dialog , on mac command-stop does the same thing
|
||||||
void wxDialog::OnCharHook(wxKeyEvent& event)
|
void wxDialog::OnCharHook(wxKeyEvent& event)
|
||||||
{
|
{
|
||||||
if (
|
if (( event.m_keyCode == WXK_ESCAPE ||
|
||||||
( event.m_keyCode == WXK_ESCAPE ||
|
( event.m_keyCode == '.' && event.MetaDown() ) )
|
||||||
( event.m_keyCode == '.' && event.MetaDown() ) )
|
&& FindWindow(wxID_CANCEL) )
|
||||||
&& FindWindow(wxID_CANCEL) )
|
{
|
||||||
{
|
// Behaviour changed in 2.0: we'll send a Cancel message
|
||||||
// Behaviour changed in 2.0: we'll send a Cancel message
|
// to the dialog instead of Close.
|
||||||
// to the dialog instead of Close.
|
wxCommandEvent cancelEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
|
||||||
wxCommandEvent cancelEvent(wxEVT_COMMAND_BUTTON_CLICKED, wxID_CANCEL);
|
cancelEvent.SetEventObject( this );
|
||||||
cancelEvent.SetEventObject( this );
|
GetEventHandler()->ProcessEvent(cancelEvent);
|
||||||
GetEventHandler()->ProcessEvent(cancelEvent);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// We didn't process this event.
|
// We didn't process this event.
|
||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxDialog::IsModal() const
|
bool wxDialog::IsModal() const
|
||||||
@@ -165,7 +164,7 @@ void wxDialog::DoShowModal()
|
|||||||
|
|
||||||
wxModalDialogs.Append(this);
|
wxModalDialogs.Append(this);
|
||||||
|
|
||||||
wxWindow *parent = GetParent();
|
wxWindow *parent = GetParent();
|
||||||
|
|
||||||
// remember where the focus was
|
// remember where the focus was
|
||||||
wxWindow *winFocus = FindFocus();
|
wxWindow *winFocus = FindFocus();
|
||||||
@@ -178,23 +177,23 @@ void wxDialog::DoShowModal()
|
|||||||
winFocus = wxTheApp->GetTopWindow();
|
winFocus = wxTheApp->GetTopWindow();
|
||||||
}
|
}
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
BeginAppModalStateForWindow( (WindowRef) MacGetWindowRef()) ;
|
BeginAppModalStateForWindow( (WindowRef) MacGetWindowRef()) ;
|
||||||
#else
|
#else
|
||||||
// TODO : test whether parent gets disabled
|
// TODO : test whether parent gets disabled
|
||||||
bool formerModal = s_macIsInModalLoop ;
|
bool formerModal = s_macIsInModalLoop ;
|
||||||
s_macIsInModalLoop = true ;
|
s_macIsInModalLoop = true ;
|
||||||
#endif
|
#endif
|
||||||
while ( IsModalShowing() )
|
while ( IsModalShowing() )
|
||||||
{
|
{
|
||||||
wxTheApp->MacDoOneEvent() ;
|
wxTheApp->MacDoOneEvent() ;
|
||||||
// calls process idle itself
|
// calls process idle itself
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
EndAppModalStateForWindow( (WindowRef) MacGetWindowRef() ) ;
|
EndAppModalStateForWindow( (WindowRef) MacGetWindowRef() ) ;
|
||||||
#else
|
#else
|
||||||
// TODO probably reenable the parent window if any
|
// TODO probably reenable the parent window if any
|
||||||
s_macIsInModalLoop = formerModal ;
|
s_macIsInModalLoop = formerModal ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@@ -209,13 +208,13 @@ void wxDialog::DoShowModal()
|
|||||||
// Replacement for Show(TRUE) for modal dialogs - returns return code
|
// Replacement for Show(TRUE) for modal dialogs - returns return code
|
||||||
int wxDialog::ShowModal()
|
int wxDialog::ShowModal()
|
||||||
{
|
{
|
||||||
if ( !IsModal() )
|
if ( !IsModal() )
|
||||||
{
|
{
|
||||||
SetModal(TRUE);
|
SetModal(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
Show(TRUE);
|
Show(TRUE);
|
||||||
return GetReturnCode();
|
return GetReturnCode();
|
||||||
}
|
}
|
||||||
|
|
||||||
// NB: this function (surprizingly) may be called for both modal and modeless
|
// NB: this function (surprizingly) may be called for both modal and modeless
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -40,107 +40,107 @@ wxDirDialog::wxDirDialog(wxWindow *parent,
|
|||||||
const wxSize& WXUNUSED(size),
|
const wxSize& WXUNUSED(size),
|
||||||
const wxString& WXUNUSED(name))
|
const wxString& WXUNUSED(name))
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( NavServicesAvailable() , "Navigation Services are not running" ) ;
|
wxASSERT_MSG( NavServicesAvailable() , "Navigation Services are not running" ) ;
|
||||||
m_message = message;
|
m_message = message;
|
||||||
m_dialogStyle = style;
|
m_dialogStyle = style;
|
||||||
m_parent = parent;
|
m_parent = parent;
|
||||||
m_path = defaultPath;
|
m_path = defaultPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxDirDialog::ShowModal()
|
int wxDirDialog::ShowModal()
|
||||||
{
|
{
|
||||||
NavDialogOptions mNavOptions;
|
NavDialogOptions mNavOptions;
|
||||||
NavObjectFilterUPP mNavFilterUPP = NULL;
|
NavObjectFilterUPP mNavFilterUPP = NULL;
|
||||||
NavPreviewUPP mNavPreviewUPP = NULL ;
|
NavPreviewUPP mNavPreviewUPP = NULL ;
|
||||||
NavReplyRecord mNavReply;
|
NavReplyRecord mNavReply;
|
||||||
AEDesc* mDefaultLocation = NULL ;
|
AEDesc* mDefaultLocation = NULL ;
|
||||||
bool mSelectDefault = false ;
|
bool mSelectDefault = false ;
|
||||||
|
|
||||||
::NavGetDefaultDialogOptions(&mNavOptions);
|
::NavGetDefaultDialogOptions(&mNavOptions);
|
||||||
|
|
||||||
mNavFilterUPP = nil;
|
mNavFilterUPP = nil;
|
||||||
mNavPreviewUPP = nil;
|
mNavPreviewUPP = nil;
|
||||||
mSelectDefault = false;
|
mSelectDefault = false;
|
||||||
mNavReply.validRecord = false;
|
mNavReply.validRecord = false;
|
||||||
mNavReply.replacing = false;
|
mNavReply.replacing = false;
|
||||||
mNavReply.isStationery = false;
|
mNavReply.isStationery = false;
|
||||||
mNavReply.translationNeeded = false;
|
mNavReply.translationNeeded = false;
|
||||||
mNavReply.selection.descriptorType = typeNull;
|
mNavReply.selection.descriptorType = typeNull;
|
||||||
mNavReply.selection.dataHandle = nil;
|
mNavReply.selection.dataHandle = nil;
|
||||||
mNavReply.keyScript = smSystemScript;
|
mNavReply.keyScript = smSystemScript;
|
||||||
mNavReply.fileTranslation = nil;
|
mNavReply.fileTranslation = nil;
|
||||||
|
|
||||||
// Set default location, the location
|
// Set default location, the location
|
||||||
// that's displayed when the dialog
|
// that's displayed when the dialog
|
||||||
// first appears
|
// first appears
|
||||||
|
|
||||||
if ( mDefaultLocation ) {
|
if ( mDefaultLocation ) {
|
||||||
|
|
||||||
if (mSelectDefault) {
|
if (mSelectDefault) {
|
||||||
mNavOptions.dialogOptionFlags |= kNavSelectDefaultLocation;
|
mNavOptions.dialogOptionFlags |= kNavSelectDefaultLocation;
|
||||||
} else {
|
} else {
|
||||||
mNavOptions.dialogOptionFlags &= ~kNavSelectDefaultLocation;
|
mNavOptions.dialogOptionFlags &= ~kNavSelectDefaultLocation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OSErr err = ::NavChooseFolder(
|
OSErr err = ::NavChooseFolder(
|
||||||
mDefaultLocation,
|
mDefaultLocation,
|
||||||
&mNavReply,
|
&mNavReply,
|
||||||
&mNavOptions,
|
&mNavOptions,
|
||||||
NULL,
|
NULL,
|
||||||
mNavFilterUPP,
|
mNavFilterUPP,
|
||||||
0L); // User Data
|
0L); // User Data
|
||||||
|
|
||||||
if ( (err != noErr) && (err != userCanceledErr) ) {
|
if ( (err != noErr) && (err != userCanceledErr) ) {
|
||||||
m_path = "" ;
|
m_path = "" ;
|
||||||
return wxID_CANCEL ;
|
return wxID_CANCEL ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mNavReply.validRecord) { // User chose a folder
|
if (mNavReply.validRecord) { // User chose a folder
|
||||||
|
|
||||||
FSSpec folderInfo;
|
FSSpec folderInfo;
|
||||||
FSSpec outFileSpec ;
|
FSSpec outFileSpec ;
|
||||||
AEDesc specDesc ;
|
AEDesc specDesc ;
|
||||||
|
|
||||||
OSErr err = ::AECoerceDesc( &mNavReply.selection , typeFSS, &specDesc);
|
OSErr err = ::AECoerceDesc( &mNavReply.selection , typeFSS, &specDesc);
|
||||||
if ( err != noErr ) {
|
if ( err != noErr ) {
|
||||||
m_path = "" ;
|
m_path = "" ;
|
||||||
return wxID_CANCEL ;
|
return wxID_CANCEL ;
|
||||||
}
|
}
|
||||||
folderInfo = **(FSSpec**) specDesc.dataHandle;
|
folderInfo = **(FSSpec**) specDesc.dataHandle;
|
||||||
if (specDesc.dataHandle != nil) {
|
if (specDesc.dataHandle != nil) {
|
||||||
::AEDisposeDesc(&specDesc);
|
::AEDisposeDesc(&specDesc);
|
||||||
}
|
}
|
||||||
|
|
||||||
// mNavReply.GetFileSpec(folderInfo);
|
// mNavReply.GetFileSpec(folderInfo);
|
||||||
|
|
||||||
// The FSSpec from NavChooseFolder is NOT the file spec
|
// The FSSpec from NavChooseFolder is NOT the file spec
|
||||||
// for the folder. The parID field is actually the DirID
|
// for the folder. The parID field is actually the DirID
|
||||||
// of the folder itself, not the folder's parent, and
|
// of the folder itself, not the folder's parent, and
|
||||||
// the name field is empty. We must call PBGetCatInfo
|
// the name field is empty. We must call PBGetCatInfo
|
||||||
// to get the parent DirID and folder name
|
// to get the parent DirID and folder name
|
||||||
|
|
||||||
Str255 name;
|
Str255 name;
|
||||||
CInfoPBRec thePB; // Directory Info Parameter Block
|
CInfoPBRec thePB; // Directory Info Parameter Block
|
||||||
thePB.dirInfo.ioCompletion = nil;
|
thePB.dirInfo.ioCompletion = nil;
|
||||||
thePB.dirInfo.ioVRefNum = folderInfo.vRefNum; // Volume is right
|
thePB.dirInfo.ioVRefNum = folderInfo.vRefNum; // Volume is right
|
||||||
thePB.dirInfo.ioDrDirID = folderInfo.parID; // Folder's DirID
|
thePB.dirInfo.ioDrDirID = folderInfo.parID; // Folder's DirID
|
||||||
thePB.dirInfo.ioNamePtr = name;
|
thePB.dirInfo.ioNamePtr = name;
|
||||||
thePB.dirInfo.ioFDirIndex = -1; // Lookup using Volume and DirID
|
thePB.dirInfo.ioFDirIndex = -1; // Lookup using Volume and DirID
|
||||||
|
|
||||||
err = ::PBGetCatInfoSync(&thePB);
|
err = ::PBGetCatInfoSync(&thePB);
|
||||||
if ( err != noErr ) {
|
if ( err != noErr ) {
|
||||||
m_path = "" ;
|
m_path = "" ;
|
||||||
return wxID_CANCEL ;
|
return wxID_CANCEL ;
|
||||||
}
|
}
|
||||||
// Create cannonical FSSpec
|
// Create cannonical FSSpec
|
||||||
::FSMakeFSSpec(thePB.dirInfo.ioVRefNum, thePB.dirInfo.ioDrParID,
|
::FSMakeFSSpec(thePB.dirInfo.ioVRefNum, thePB.dirInfo.ioDrParID,
|
||||||
name, &outFileSpec);
|
name, &outFileSpec);
|
||||||
|
|
||||||
// outFolderDirID = thePB.dirInfo.ioDrDirID;
|
// outFolderDirID = thePB.dirInfo.ioDrDirID;
|
||||||
m_path = wxMacFSSpec2MacFilename( &outFileSpec ) ;
|
m_path = wxMacFSSpec2MacFilename( &outFileSpec ) ;
|
||||||
return wxID_OK ;
|
return wxID_OK ;
|
||||||
}
|
}
|
||||||
return wxID_CANCEL;
|
return wxID_CANCEL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -83,11 +83,11 @@ public:
|
|||||||
const wxString& GetName() const { return m_dirname; }
|
const wxString& GetName() const { return m_dirname; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CInfoPBRec m_CPB ;
|
CInfoPBRec m_CPB ;
|
||||||
wxInt16 m_index ;
|
wxInt16 m_index ;
|
||||||
long m_dirId ;
|
long m_dirId ;
|
||||||
Str255 m_name ;
|
Str255 m_name ;
|
||||||
Boolean m_isDir ;
|
Boolean m_isDir ;
|
||||||
|
|
||||||
wxString m_dirname;
|
wxString m_dirname;
|
||||||
wxString m_filespec;
|
wxString m_filespec;
|
||||||
@@ -145,7 +145,7 @@ wxDirData::~wxDirData()
|
|||||||
|
|
||||||
void wxDirData::Rewind()
|
void wxDirData::Rewind()
|
||||||
{
|
{
|
||||||
m_index = 0 ;
|
m_index = 0 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxDirData::Read(wxString *filename)
|
bool wxDirData::Read(wxString *filename)
|
||||||
@@ -154,7 +154,7 @@ bool wxDirData::Read(wxString *filename)
|
|||||||
return FALSE ;
|
return FALSE ;
|
||||||
|
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
char c_name[256] ;
|
char c_name[256] ;
|
||||||
#endif
|
#endif
|
||||||
wxString result;
|
wxString result;
|
||||||
|
|
||||||
@@ -164,7 +164,7 @@ bool wxDirData::Read(wxString *filename)
|
|||||||
{
|
{
|
||||||
m_index++ ;
|
m_index++ ;
|
||||||
m_CPB.dirInfo.ioFDirIndex = m_index;
|
m_CPB.dirInfo.ioFDirIndex = m_index;
|
||||||
m_CPB.dirInfo.ioDrDirID = m_dirId; /* we need to do this every time */
|
m_CPB.dirInfo.ioDrDirID = m_dirId; /* we need to do this every time */
|
||||||
err = PBGetCatInfoSync((CInfoPBPtr)&m_CPB);
|
err = PBGetCatInfoSync((CInfoPBPtr)&m_CPB);
|
||||||
if ( err != noErr )
|
if ( err != noErr )
|
||||||
break ;
|
break ;
|
||||||
@@ -270,12 +270,12 @@ wxString wxDir::GetName() const
|
|||||||
wxString name;
|
wxString name;
|
||||||
if ( m_data )
|
if ( m_data )
|
||||||
{
|
{
|
||||||
name = M_DIR->GetName();
|
name = M_DIR->GetName();
|
||||||
if ( !name.empty() && (name.Last() == _T('/')) )
|
if ( !name.empty() && (name.Last() == _T('/')) )
|
||||||
{
|
{
|
||||||
// chop off the last (back)slash
|
// chop off the last (back)slash
|
||||||
name.Truncate(name.length() - 1);
|
name.Truncate(name.length() - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return name;
|
return name;
|
||||||
|
|||||||
@@ -44,7 +44,7 @@
|
|||||||
class wxDisplayMacPriv
|
class wxDisplayMacPriv
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GDHandle m_hndl;
|
GDHandle m_hndl;
|
||||||
};
|
};
|
||||||
|
|
||||||
size_t wxDisplayBase::GetCount()
|
size_t wxDisplayBase::GetCount()
|
||||||
|
|||||||
@@ -82,47 +82,47 @@ bool wxDropTarget::CurrentDragHasSupportedFormat()
|
|||||||
bool supported = false ;
|
bool supported = false ;
|
||||||
if ( gTrackingGlobals.m_currentSource != NULL )
|
if ( gTrackingGlobals.m_currentSource != NULL )
|
||||||
{
|
{
|
||||||
wxDataObject* data = gTrackingGlobals.m_currentSource->GetDataObject() ;
|
wxDataObject* data = gTrackingGlobals.m_currentSource->GetDataObject() ;
|
||||||
|
|
||||||
if ( data )
|
if ( data )
|
||||||
{
|
|
||||||
size_t formatcount = data->GetFormatCount() ;
|
|
||||||
wxDataFormat *array = new wxDataFormat[ formatcount ];
|
|
||||||
data->GetAllFormats( array );
|
|
||||||
for (size_t i = 0; !supported && i < formatcount ; i++)
|
|
||||||
{
|
{
|
||||||
wxDataFormat format = array[i] ;
|
size_t formatcount = data->GetFormatCount() ;
|
||||||
if ( m_dataObject->IsSupported( format ) )
|
wxDataFormat *array = new wxDataFormat[ formatcount ];
|
||||||
|
data->GetAllFormats( array );
|
||||||
|
for (size_t i = 0; !supported && i < formatcount ; i++)
|
||||||
{
|
{
|
||||||
supported = true ;
|
wxDataFormat format = array[i] ;
|
||||||
break ;
|
if ( m_dataObject->IsSupported( format ) )
|
||||||
|
{
|
||||||
|
supported = true ;
|
||||||
|
break ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
delete[] array ;
|
||||||
}
|
}
|
||||||
delete[] array ;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if ( !supported )
|
if ( !supported )
|
||||||
{
|
{
|
||||||
UInt16 items ;
|
UInt16 items ;
|
||||||
OSErr result;
|
OSErr result;
|
||||||
CountDragItems((DragReference)m_currentDrag, &items);
|
CountDragItems((DragReference)m_currentDrag, &items);
|
||||||
for (UInt16 index = 1; index <= items && supported == false ; ++index)
|
for (UInt16 index = 1; index <= items && supported == false ; ++index)
|
||||||
{
|
{
|
||||||
ItemReference theItem;
|
ItemReference theItem;
|
||||||
FlavorType theType ;
|
FlavorType theType ;
|
||||||
UInt16 flavors = 0 ;
|
UInt16 flavors = 0 ;
|
||||||
GetDragItemReferenceNumber((DragReference)m_currentDrag, index, &theItem);
|
GetDragItemReferenceNumber((DragReference)m_currentDrag, index, &theItem);
|
||||||
CountDragItemFlavors( (DragReference)m_currentDrag, theItem , &flavors ) ;
|
CountDragItemFlavors( (DragReference)m_currentDrag, theItem , &flavors ) ;
|
||||||
for ( UInt16 flavor = 1 ; flavor <= flavors ; ++flavor )
|
for ( UInt16 flavor = 1 ; flavor <= flavors ; ++flavor )
|
||||||
{
|
|
||||||
result = GetFlavorType((DragReference)m_currentDrag, theItem, flavor , &theType);
|
|
||||||
if ( m_dataObject->IsSupportedFormat( wxDataFormat( theType ) ) )
|
|
||||||
{
|
{
|
||||||
supported = true ;
|
result = GetFlavorType((DragReference)m_currentDrag, theItem, flavor , &theType);
|
||||||
break ;
|
if ( m_dataObject->IsSupportedFormat( wxDataFormat( theType ) ) )
|
||||||
|
{
|
||||||
|
supported = true ;
|
||||||
|
break ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return supported ;
|
return supported ;
|
||||||
}
|
}
|
||||||
@@ -138,102 +138,102 @@ bool wxDropTarget::GetData()
|
|||||||
bool transferred = false ;
|
bool transferred = false ;
|
||||||
if ( gTrackingGlobals.m_currentSource != NULL )
|
if ( gTrackingGlobals.m_currentSource != NULL )
|
||||||
{
|
{
|
||||||
wxDataObject* data = gTrackingGlobals.m_currentSource->GetDataObject() ;
|
wxDataObject* data = gTrackingGlobals.m_currentSource->GetDataObject() ;
|
||||||
|
|
||||||
if ( data )
|
if ( data )
|
||||||
{
|
|
||||||
size_t formatcount = data->GetFormatCount() ;
|
|
||||||
wxDataFormat *array = new wxDataFormat[ formatcount ];
|
|
||||||
data->GetAllFormats( array );
|
|
||||||
for (size_t i = 0; !transferred && i < formatcount ; i++)
|
|
||||||
{
|
{
|
||||||
wxDataFormat format = array[i] ;
|
size_t formatcount = data->GetFormatCount() ;
|
||||||
if ( m_dataObject->IsSupported( format ) )
|
wxDataFormat *array = new wxDataFormat[ formatcount ];
|
||||||
|
data->GetAllFormats( array );
|
||||||
|
for (size_t i = 0; !transferred && i < formatcount ; i++)
|
||||||
{
|
{
|
||||||
int size = data->GetDataSize( format );
|
wxDataFormat format = array[i] ;
|
||||||
transferred = true ;
|
if ( m_dataObject->IsSupported( format ) )
|
||||||
|
{
|
||||||
|
int size = data->GetDataSize( format );
|
||||||
|
transferred = true ;
|
||||||
|
|
||||||
if (size == 0)
|
if (size == 0)
|
||||||
{
|
{
|
||||||
m_dataObject->SetData(format , 0 , 0 ) ;
|
m_dataObject->SetData(format , 0 , 0 ) ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char *d = new char[size];
|
char *d = new char[size];
|
||||||
data->GetDataHere( format , (void*) d );
|
data->GetDataHere( format , (void*) d );
|
||||||
m_dataObject->SetData( format , size , d ) ;
|
m_dataObject->SetData( format , size , d ) ;
|
||||||
delete[] d ;
|
delete[] d ;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
delete[] array ;
|
||||||
delete[] array ;
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if ( !transferred )
|
if ( !transferred )
|
||||||
{
|
{
|
||||||
UInt16 items ;
|
UInt16 items ;
|
||||||
OSErr result;
|
OSErr result;
|
||||||
bool firstFileAdded = false ;
|
bool firstFileAdded = false ;
|
||||||
CountDragItems((DragReference)m_currentDrag, &items);
|
CountDragItems((DragReference)m_currentDrag, &items);
|
||||||
for (UInt16 index = 1; index <= items; ++index)
|
for (UInt16 index = 1; index <= items; ++index)
|
||||||
{
|
{
|
||||||
ItemReference theItem;
|
ItemReference theItem;
|
||||||
FlavorType theType ;
|
FlavorType theType ;
|
||||||
UInt16 flavors = 0 ;
|
UInt16 flavors = 0 ;
|
||||||
GetDragItemReferenceNumber((DragReference)m_currentDrag, index, &theItem);
|
GetDragItemReferenceNumber((DragReference)m_currentDrag, index, &theItem);
|
||||||
CountDragItemFlavors( (DragReference)m_currentDrag, theItem , &flavors ) ;
|
CountDragItemFlavors( (DragReference)m_currentDrag, theItem , &flavors ) ;
|
||||||
for ( UInt16 flavor = 1 ; flavor <= flavors ; ++flavor )
|
for ( UInt16 flavor = 1 ; flavor <= flavors ; ++flavor )
|
||||||
{
|
|
||||||
result = GetFlavorType((DragReference)m_currentDrag, theItem, flavor , &theType);
|
|
||||||
wxDataFormat format(theType) ;
|
|
||||||
if ( m_dataObject->IsSupportedFormat( format ) )
|
|
||||||
{
|
{
|
||||||
FlavorFlags theFlags;
|
result = GetFlavorType((DragReference)m_currentDrag, theItem, flavor , &theType);
|
||||||
result = GetFlavorFlags((DragReference)m_currentDrag, theItem, theType, &theFlags);
|
wxDataFormat format(theType) ;
|
||||||
if (result == noErr)
|
if ( m_dataObject->IsSupportedFormat( format ) )
|
||||||
{
|
{
|
||||||
Size dataSize ;
|
FlavorFlags theFlags;
|
||||||
Ptr theData ;
|
result = GetFlavorFlags((DragReference)m_currentDrag, theItem, theType, &theFlags);
|
||||||
GetFlavorDataSize((DragReference)m_currentDrag, theItem, theType, &dataSize);
|
if (result == noErr)
|
||||||
if ( theType == 'TEXT' )
|
|
||||||
{
|
|
||||||
// this increment is only valid for allocating, on the next GetFlavorData
|
|
||||||
// call it is reset again to the original value
|
|
||||||
dataSize++ ;
|
|
||||||
}
|
|
||||||
theData = new char[dataSize];
|
|
||||||
GetFlavorData((DragReference)m_currentDrag, theItem, theType, (void*) theData, &dataSize, 0L);
|
|
||||||
if( theType == 'TEXT' )
|
|
||||||
{
|
|
||||||
theData[dataSize]=0 ;
|
|
||||||
if ( wxApp::s_macDefaultEncodingIsPC )
|
|
||||||
{
|
{
|
||||||
wxMacConvertToPC((char*)theData,(char*)theData,dataSize) ;
|
Size dataSize ;
|
||||||
|
Ptr theData ;
|
||||||
|
GetFlavorDataSize((DragReference)m_currentDrag, theItem, theType, &dataSize);
|
||||||
|
if ( theType == 'TEXT' )
|
||||||
|
{
|
||||||
|
// this increment is only valid for allocating, on the next GetFlavorData
|
||||||
|
// call it is reset again to the original value
|
||||||
|
dataSize++ ;
|
||||||
|
}
|
||||||
|
theData = new char[dataSize];
|
||||||
|
GetFlavorData((DragReference)m_currentDrag, theItem, theType, (void*) theData, &dataSize, 0L);
|
||||||
|
if( theType == 'TEXT' )
|
||||||
|
{
|
||||||
|
theData[dataSize]=0 ;
|
||||||
|
if ( wxApp::s_macDefaultEncodingIsPC )
|
||||||
|
{
|
||||||
|
wxMacConvertToPC((char*)theData,(char*)theData,dataSize) ;
|
||||||
|
}
|
||||||
|
m_dataObject->SetData( format, dataSize, theData );
|
||||||
|
}
|
||||||
|
else if ( theType == kDragFlavorTypeHFS )
|
||||||
|
{
|
||||||
|
HFSFlavor* theFile = (HFSFlavor*) theData ;
|
||||||
|
wxString name = wxMacFSSpec2MacFilename( &theFile->fileSpec ) ;
|
||||||
|
if ( firstFileAdded )
|
||||||
|
((wxFileDataObject*)m_dataObject)->AddFile( name ) ;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
((wxFileDataObject*)m_dataObject)->SetData( 0 , name.c_str() ) ;
|
||||||
|
firstFileAdded = true ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_dataObject->SetData( format, dataSize, theData );
|
||||||
|
}
|
||||||
|
delete[] theData;
|
||||||
}
|
}
|
||||||
m_dataObject->SetData( format, dataSize, theData );
|
break ;
|
||||||
}
|
}
|
||||||
else if ( theType == kDragFlavorTypeHFS )
|
|
||||||
{
|
|
||||||
HFSFlavor* theFile = (HFSFlavor*) theData ;
|
|
||||||
wxString name = wxMacFSSpec2MacFilename( &theFile->fileSpec ) ;
|
|
||||||
if ( firstFileAdded )
|
|
||||||
((wxFileDataObject*)m_dataObject)->AddFile( name ) ;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
((wxFileDataObject*)m_dataObject)->SetData( 0 , name.c_str() ) ;
|
|
||||||
firstFileAdded = true ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_dataObject->SetData( format, dataSize, theData );
|
|
||||||
}
|
|
||||||
delete[] theData;
|
|
||||||
}
|
|
||||||
break ;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return TRUE ;
|
return TRUE ;
|
||||||
}
|
}
|
||||||
@@ -300,45 +300,45 @@ wxDragResult wxDropSource::DoDragDrop(int WXUNUSED(flags))
|
|||||||
OSType type = formats[i].GetFormatId() ;
|
OSType type = formats[i].GetFormatId() ;
|
||||||
if ( type == 'TEXT' )
|
if ( type == 'TEXT' )
|
||||||
{
|
{
|
||||||
dataSize-- ;
|
dataSize-- ;
|
||||||
if ( wxApp::s_macDefaultEncodingIsPC )
|
if ( wxApp::s_macDefaultEncodingIsPC )
|
||||||
{
|
{
|
||||||
wxMacConvertFromPC((char*)dataPtr,(char*)dataPtr,dataSize) ;
|
wxMacConvertFromPC((char*)dataPtr,(char*)dataPtr,dataSize) ;
|
||||||
}
|
}
|
||||||
AddDragItemFlavor(theDrag, theItem, type , dataPtr, dataSize, 0);
|
AddDragItemFlavor(theDrag, theItem, type , dataPtr, dataSize, 0);
|
||||||
}
|
}
|
||||||
else if (type == kDragFlavorTypeHFS )
|
else if (type == kDragFlavorTypeHFS )
|
||||||
{
|
{
|
||||||
HFSFlavor theFlavor ;
|
HFSFlavor theFlavor ;
|
||||||
OSErr err = noErr;
|
OSErr err = noErr;
|
||||||
CInfoPBRec cat;
|
CInfoPBRec cat;
|
||||||
|
|
||||||
wxMacFilename2FSSpec( dataPtr , &theFlavor.fileSpec ) ;
|
wxMacFilename2FSSpec( dataPtr , &theFlavor.fileSpec ) ;
|
||||||
|
|
||||||
cat.hFileInfo.ioNamePtr = theFlavor.fileSpec.name;
|
cat.hFileInfo.ioNamePtr = theFlavor.fileSpec.name;
|
||||||
cat.hFileInfo.ioVRefNum = theFlavor.fileSpec.vRefNum;
|
cat.hFileInfo.ioVRefNum = theFlavor.fileSpec.vRefNum;
|
||||||
cat.hFileInfo.ioDirID = theFlavor.fileSpec.parID;
|
cat.hFileInfo.ioDirID = theFlavor.fileSpec.parID;
|
||||||
cat.hFileInfo.ioFDirIndex = 0;
|
cat.hFileInfo.ioFDirIndex = 0;
|
||||||
err = PBGetCatInfoSync(&cat);
|
err = PBGetCatInfoSync(&cat);
|
||||||
if (err == noErr )
|
if (err == noErr )
|
||||||
{
|
{
|
||||||
theFlavor.fdFlags = cat.hFileInfo.ioFlFndrInfo.fdFlags;
|
theFlavor.fdFlags = cat.hFileInfo.ioFlFndrInfo.fdFlags;
|
||||||
if (theFlavor.fileSpec.parID == fsRtParID) {
|
if (theFlavor.fileSpec.parID == fsRtParID) {
|
||||||
theFlavor.fileCreator = 'MACS';
|
theFlavor.fileCreator = 'MACS';
|
||||||
theFlavor.fileType = 'disk';
|
theFlavor.fileType = 'disk';
|
||||||
} else if ((cat.hFileInfo.ioFlAttrib & ioDirMask) != 0) {
|
} else if ((cat.hFileInfo.ioFlAttrib & ioDirMask) != 0) {
|
||||||
theFlavor.fileCreator = 'MACS';
|
theFlavor.fileCreator = 'MACS';
|
||||||
theFlavor.fileType = 'fold';
|
theFlavor.fileType = 'fold';
|
||||||
} else {
|
} else {
|
||||||
theFlavor.fileCreator = cat.hFileInfo.ioFlFndrInfo.fdCreator;
|
theFlavor.fileCreator = cat.hFileInfo.ioFlFndrInfo.fdCreator;
|
||||||
theFlavor.fileType = cat.hFileInfo.ioFlFndrInfo.fdType;
|
theFlavor.fileType = cat.hFileInfo.ioFlFndrInfo.fdType;
|
||||||
}
|
}
|
||||||
AddDragItemFlavor(theDrag, theItem, type , &theFlavor, sizeof(theFlavor), 0);
|
AddDragItemFlavor(theDrag, theItem, type , &theFlavor, sizeof(theFlavor), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AddDragItemFlavor(theDrag, theItem, type , dataPtr, dataSize, 0);
|
AddDragItemFlavor(theDrag, theItem, type , dataPtr, dataSize, 0);
|
||||||
}
|
}
|
||||||
delete[] dataPtr ;
|
delete[] dataPtr ;
|
||||||
}
|
}
|
||||||
@@ -349,24 +349,24 @@ wxDragResult wxDropSource::DoDragDrop(int WXUNUSED(flags))
|
|||||||
|
|
||||||
EventRecord* ev = NULL ;
|
EventRecord* ev = NULL ;
|
||||||
#if !TARGET_CARBON // TODO
|
#if !TARGET_CARBON // TODO
|
||||||
ev = (EventRecord*) wxTheApp->MacGetCurrentEvent() ;
|
ev = (EventRecord*) wxTheApp->MacGetCurrentEvent() ;
|
||||||
#else
|
#else
|
||||||
EventRecord rec ;
|
EventRecord rec ;
|
||||||
ev = &rec ;
|
ev = &rec ;
|
||||||
wxMacConvertEventToRecord( (EventRef) wxTheApp->MacGetCurrentEvent() , &rec ) ;
|
wxMacConvertEventToRecord( (EventRef) wxTheApp->MacGetCurrentEvent() , &rec ) ;
|
||||||
#endif
|
#endif
|
||||||
const short dragRegionOuterBoundary = 10 ;
|
const short dragRegionOuterBoundary = 10 ;
|
||||||
const short dragRegionInnerBoundary = 9 ;
|
const short dragRegionInnerBoundary = 9 ;
|
||||||
|
|
||||||
SetRectRgn( dragRegion , ev->where.h - dragRegionOuterBoundary ,
|
SetRectRgn( dragRegion , ev->where.h - dragRegionOuterBoundary ,
|
||||||
ev->where.v - dragRegionOuterBoundary ,
|
ev->where.v - dragRegionOuterBoundary ,
|
||||||
ev->where.h + dragRegionOuterBoundary ,
|
ev->where.h + dragRegionOuterBoundary ,
|
||||||
ev->where.v + dragRegionOuterBoundary ) ;
|
ev->where.v + dragRegionOuterBoundary ) ;
|
||||||
|
|
||||||
SetRectRgn( tempRgn , ev->where.h - dragRegionInnerBoundary ,
|
SetRectRgn( tempRgn , ev->where.h - dragRegionInnerBoundary ,
|
||||||
ev->where.v - dragRegionInnerBoundary ,
|
ev->where.v - dragRegionInnerBoundary ,
|
||||||
ev->where.h + dragRegionInnerBoundary ,
|
ev->where.h + dragRegionInnerBoundary ,
|
||||||
ev->where.v + dragRegionInnerBoundary ) ;
|
ev->where.v + dragRegionInnerBoundary ) ;
|
||||||
|
|
||||||
DiffRgn( dragRegion , tempRgn , dragRegion ) ;
|
DiffRgn( dragRegion , tempRgn , dragRegion ) ;
|
||||||
DisposeRgn( tempRgn ) ;
|
DisposeRgn( tempRgn ) ;
|
||||||
@@ -423,7 +423,7 @@ pascal OSErr wxMacWindowDragTrackingHandler(DragTrackingMessage theMessage, Wind
|
|||||||
case kDragTrackingLeaveHandler:
|
case kDragTrackingLeaveHandler:
|
||||||
break;
|
break;
|
||||||
case kDragTrackingEnterWindow:
|
case kDragTrackingEnterWindow:
|
||||||
trackingGlobals->m_currentTargetWindow = NULL ;
|
trackingGlobals->m_currentTargetWindow = NULL ;
|
||||||
trackingGlobals->m_currentTarget = NULL ;
|
trackingGlobals->m_currentTarget = NULL ;
|
||||||
break;
|
break;
|
||||||
case kDragTrackingInWindow:
|
case kDragTrackingInWindow:
|
||||||
|
|||||||
@@ -52,160 +52,160 @@ extern bool gUseNavServices ;
|
|||||||
|
|
||||||
struct OpenUserDataRec {
|
struct OpenUserDataRec {
|
||||||
int currentfilter ;
|
int currentfilter ;
|
||||||
bool saveMode ;
|
bool saveMode ;
|
||||||
wxArrayString name ;
|
wxArrayString name ;
|
||||||
wxArrayString extensions ;
|
wxArrayString extensions ;
|
||||||
wxArrayLong filtermactypes ;
|
wxArrayLong filtermactypes ;
|
||||||
NavMenuItemSpecArrayHandle menuitems ;
|
NavMenuItemSpecArrayHandle menuitems ;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct OpenUserDataRec
|
typedef struct OpenUserDataRec
|
||||||
OpenUserDataRec, *OpenUserDataRecPtr;
|
OpenUserDataRec, *OpenUserDataRecPtr;
|
||||||
|
|
||||||
static pascal void NavEventProc(
|
static pascal void NavEventProc(
|
||||||
NavEventCallbackMessage inSelector,
|
NavEventCallbackMessage inSelector,
|
||||||
NavCBRecPtr ioParams,
|
NavCBRecPtr ioParams,
|
||||||
NavCallBackUserData ioUserData);
|
NavCallBackUserData ioUserData);
|
||||||
|
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
static NavEventUPP sStandardNavEventFilter = NewNavEventUPP(NavEventProc);
|
static NavEventUPP sStandardNavEventFilter = NewNavEventUPP(NavEventProc);
|
||||||
#else
|
#else
|
||||||
static NavEventUPP sStandardNavEventFilter = NewNavEventProc(NavEventProc);
|
static NavEventUPP sStandardNavEventFilter = NewNavEventProc(NavEventProc);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static pascal void
|
static pascal void
|
||||||
NavEventProc(
|
NavEventProc(
|
||||||
NavEventCallbackMessage inSelector,
|
NavEventCallbackMessage inSelector,
|
||||||
NavCBRecPtr ioParams,
|
NavCBRecPtr ioParams,
|
||||||
NavCallBackUserData ioUserData )
|
NavCallBackUserData ioUserData )
|
||||||
{
|
{
|
||||||
OpenUserDataRec * data = ( OpenUserDataRec *) ioUserData ;
|
OpenUserDataRec * data = ( OpenUserDataRec *) ioUserData ;
|
||||||
if (inSelector == kNavCBEvent) {
|
if (inSelector == kNavCBEvent) {
|
||||||
#if !TARGET_CARBON
|
#if !TARGET_CARBON
|
||||||
wxTheApp->MacHandleOneEvent(ioParams->eventData.eventDataParms.event);
|
wxTheApp->MacHandleOneEvent(ioParams->eventData.eventDataParms.event);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if ( inSelector == kNavCBStart )
|
else if ( inSelector == kNavCBStart )
|
||||||
{
|
{
|
||||||
if ( data->menuitems )
|
if ( data->menuitems )
|
||||||
NavCustomControl(ioParams->context, kNavCtlSelectCustomType, &(*data->menuitems)[data->currentfilter]);
|
NavCustomControl(ioParams->context, kNavCtlSelectCustomType, &(*data->menuitems)[data->currentfilter]);
|
||||||
}
|
}
|
||||||
else if ( inSelector == kNavCBPopupMenuSelect )
|
else if ( inSelector == kNavCBPopupMenuSelect )
|
||||||
{
|
{
|
||||||
NavMenuItemSpec * menu = (NavMenuItemSpec *) ioParams->eventData.eventDataParms.param ;
|
NavMenuItemSpec * menu = (NavMenuItemSpec *) ioParams->eventData.eventDataParms.param ;
|
||||||
if ( menu->menuCreator == 'WXNG' )
|
if ( menu->menuCreator == 'WXNG' )
|
||||||
{
|
{
|
||||||
data->currentfilter = menu->menuType ;
|
data->currentfilter = menu->menuType ;
|
||||||
if ( data->saveMode )
|
if ( data->saveMode )
|
||||||
{
|
{
|
||||||
int i = menu->menuType ;
|
int i = menu->menuType ;
|
||||||
wxString extension = data->extensions[i].AfterLast('.') ;
|
wxString extension = data->extensions[i].AfterLast('.') ;
|
||||||
extension.MakeLower() ;
|
extension.MakeLower() ;
|
||||||
Str255 filename ;
|
Str255 filename ;
|
||||||
// get the current filename
|
// get the current filename
|
||||||
NavCustomControl(ioParams->context, kNavCtlGetEditFileName, &filename);
|
NavCustomControl(ioParams->context, kNavCtlGetEditFileName, &filename);
|
||||||
CopyPascalStringToC( filename , (char*) filename ) ;
|
CopyPascalStringToC( filename , (char*) filename ) ;
|
||||||
wxString sfilename( filename ) ;
|
wxString sfilename( filename ) ;
|
||||||
int pos = sfilename.Find('.',TRUE) ;
|
int pos = sfilename.Find('.',TRUE) ;
|
||||||
if ( pos != wxNOT_FOUND )
|
if ( pos != wxNOT_FOUND )
|
||||||
{
|
{
|
||||||
sfilename = sfilename.Left(pos+1)+extension ;
|
sfilename = sfilename.Left(pos+1)+extension ;
|
||||||
CopyCStringToPascal( sfilename.c_str() , filename ) ;
|
CopyCStringToPascal( sfilename.c_str() , filename ) ;
|
||||||
NavCustomControl(ioParams->context, kNavCtlSetEditFileName, &filename);
|
NavCustomControl(ioParams->context, kNavCtlSetEditFileName, &filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const char * gfilters[] =
|
const char * gfilters[] =
|
||||||
{
|
{
|
||||||
"*.TXT" ,
|
"*.TXT" ,
|
||||||
"*.TIF" ,
|
"*.TIF" ,
|
||||||
"*.JPG" ,
|
"*.JPG" ,
|
||||||
|
|
||||||
NULL
|
NULL
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
OSType gfiltersmac[] =
|
OSType gfiltersmac[] =
|
||||||
{
|
{
|
||||||
'TEXT' ,
|
'TEXT' ,
|
||||||
'TIFF' ,
|
'TIFF' ,
|
||||||
'JPEG' ,
|
'JPEG' ,
|
||||||
|
|
||||||
'****'
|
'****'
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void MakeUserDataRec(OpenUserDataRec *myData , const wxString& filter )
|
void MakeUserDataRec(OpenUserDataRec *myData , const wxString& filter )
|
||||||
{
|
{
|
||||||
myData->menuitems = NULL ;
|
myData->menuitems = NULL ;
|
||||||
myData->currentfilter = 0 ;
|
myData->currentfilter = 0 ;
|
||||||
myData->saveMode = FALSE ;
|
myData->saveMode = FALSE ;
|
||||||
|
|
||||||
if ( filter && filter[0] )
|
if ( filter && filter[0] )
|
||||||
{
|
|
||||||
wxString filter2(filter) ;
|
|
||||||
int filterIndex = 0;
|
|
||||||
bool isName = true ;
|
|
||||||
wxString current ;
|
|
||||||
for( unsigned int i = 0; i < filter2.Len() ; i++ )
|
|
||||||
{
|
{
|
||||||
if( filter2.GetChar(i) == wxT('|') )
|
wxString filter2(filter) ;
|
||||||
{
|
int filterIndex = 0;
|
||||||
if( isName ) {
|
bool isName = true ;
|
||||||
myData->name.Add( current ) ;
|
wxString current ;
|
||||||
|
for( unsigned int i = 0; i < filter2.Len() ; i++ )
|
||||||
|
{
|
||||||
|
if( filter2.GetChar(i) == wxT('|') )
|
||||||
|
{
|
||||||
|
if( isName ) {
|
||||||
|
myData->name.Add( current ) ;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
myData->extensions.Add( current.MakeUpper() ) ;
|
||||||
|
++filterIndex ;
|
||||||
|
}
|
||||||
|
isName = !isName ;
|
||||||
|
current = "" ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
current += filter2.GetChar(i) ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
// we allow for compatibility reason to have a single filter expression (like *.*) without
|
||||||
myData->extensions.Add( current.MakeUpper() ) ;
|
// an explanatory text, in that case the first part is name and extension at the same time
|
||||||
++filterIndex ;
|
|
||||||
}
|
|
||||||
isName = !isName ;
|
|
||||||
current = "" ;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
current += filter2.GetChar(i) ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// we allow for compatibility reason to have a single filter expression (like *.*) without
|
|
||||||
// an explanatory text, in that case the first part is name and extension at the same time
|
|
||||||
|
|
||||||
wxASSERT_MSG( filterIndex == 0 || !isName , "incorrect format of format string" ) ;
|
wxASSERT_MSG( filterIndex == 0 || !isName , "incorrect format of format string" ) ;
|
||||||
if ( current.IsEmpty() )
|
if ( current.IsEmpty() )
|
||||||
myData->extensions.Add( myData->name[filterIndex] ) ;
|
myData->extensions.Add( myData->name[filterIndex] ) ;
|
||||||
else
|
else
|
||||||
myData->extensions.Add( current.MakeUpper() ) ;
|
myData->extensions.Add( current.MakeUpper() ) ;
|
||||||
if ( filterIndex == 0 || isName )
|
if ( filterIndex == 0 || isName )
|
||||||
myData->name.Add( current.MakeUpper() ) ;
|
myData->name.Add( current.MakeUpper() ) ;
|
||||||
|
|
||||||
++filterIndex ;
|
++filterIndex ;
|
||||||
|
|
||||||
|
|
||||||
const size_t extCount = myData->extensions.GetCount();
|
const size_t extCount = myData->extensions.GetCount();
|
||||||
for ( size_t i = 0 ; i < extCount; i++ )
|
for ( size_t i = 0 ; i < extCount; i++ )
|
||||||
{
|
{
|
||||||
int j ;
|
int j ;
|
||||||
for ( j = 0 ; gfilters[j] ; j++ )
|
for ( j = 0 ; gfilters[j] ; j++ )
|
||||||
{
|
{
|
||||||
if ( strcmp( myData->extensions[i] , gfilters[j] ) == 0 )
|
if ( strcmp( myData->extensions[i] , gfilters[j] ) == 0 )
|
||||||
{
|
{
|
||||||
myData->filtermactypes.Add( gfiltersmac[j] ) ;
|
myData->filtermactypes.Add( gfiltersmac[j] ) ;
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( gfilters[j] == NULL )
|
if( gfilters[j] == NULL )
|
||||||
{
|
{
|
||||||
myData->filtermactypes.Add( '****' ) ;
|
myData->filtermactypes.Add( '****' ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static Boolean CheckFile( ConstStr255Param name , OSType type , OpenUserDataRecPtr data)
|
static Boolean CheckFile( ConstStr255Param name , OSType type , OpenUserDataRecPtr data)
|
||||||
{
|
{
|
||||||
Str255 filename ;
|
Str255 filename ;
|
||||||
|
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
p2cstrcpy((char *)filename, name) ;
|
p2cstrcpy((char *)filename, name) ;
|
||||||
@@ -218,27 +218,27 @@ static Boolean CheckFile( ConstStr255Param name , OSType type , OpenUserDataRecP
|
|||||||
|
|
||||||
if ( data->extensions.GetCount() > 0 )
|
if ( data->extensions.GetCount() > 0 )
|
||||||
{
|
{
|
||||||
//for ( int i = 0 ; i < data->numfilters ; ++i )
|
//for ( int i = 0 ; i < data->numfilters ; ++i )
|
||||||
int i = data->currentfilter ;
|
int i = data->currentfilter ;
|
||||||
if ( data->extensions[i].Right(2) == ".*" )
|
if ( data->extensions[i].Right(2) == ".*" )
|
||||||
return true ;
|
return true ;
|
||||||
|
|
||||||
{
|
{
|
||||||
if ( type == (OSType)data->filtermactypes[i] )
|
if ( type == (OSType)data->filtermactypes[i] )
|
||||||
return true ;
|
return true ;
|
||||||
|
|
||||||
wxStringTokenizer tokenizer( data->extensions[i] , ";" ) ;
|
wxStringTokenizer tokenizer( data->extensions[i] , ";" ) ;
|
||||||
while( tokenizer.HasMoreTokens() )
|
while( tokenizer.HasMoreTokens() )
|
||||||
{
|
{
|
||||||
wxString extension = tokenizer.GetNextToken() ;
|
wxString extension = tokenizer.GetNextToken() ;
|
||||||
if ( extension.GetChar(0) == '*' )
|
if ( extension.GetChar(0) == '*' )
|
||||||
extension = extension.Mid(1) ;
|
extension = extension.Mid(1) ;
|
||||||
|
|
||||||
if ( file.Len() >= extension.Len() && extension == file.Right(extension.Len() ) )
|
if ( file.Len() >= extension.Len() && extension == file.Right(extension.Len() ) )
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
@@ -246,27 +246,27 @@ static Boolean CheckFile( ConstStr255Param name , OSType type , OpenUserDataRecP
|
|||||||
#ifndef __DARWIN__
|
#ifndef __DARWIN__
|
||||||
static pascal Boolean CrossPlatformFileFilter(CInfoPBPtr myCInfoPBPtr, void *dataPtr)
|
static pascal Boolean CrossPlatformFileFilter(CInfoPBPtr myCInfoPBPtr, void *dataPtr)
|
||||||
{
|
{
|
||||||
OpenUserDataRecPtr data = (OpenUserDataRecPtr) dataPtr ;
|
OpenUserDataRecPtr data = (OpenUserDataRecPtr) dataPtr ;
|
||||||
// return true if this item is invisible or a file
|
// return true if this item is invisible or a file
|
||||||
|
|
||||||
Boolean visibleFlag;
|
Boolean visibleFlag;
|
||||||
Boolean folderFlag;
|
Boolean folderFlag;
|
||||||
|
|
||||||
visibleFlag = ! (myCInfoPBPtr->hFileInfo.ioFlFndrInfo.fdFlags & kIsInvisible);
|
visibleFlag = ! (myCInfoPBPtr->hFileInfo.ioFlFndrInfo.fdFlags & kIsInvisible);
|
||||||
folderFlag = (myCInfoPBPtr->hFileInfo.ioFlAttrib & 0x10);
|
folderFlag = (myCInfoPBPtr->hFileInfo.ioFlAttrib & 0x10);
|
||||||
|
|
||||||
// because the semantics of the filter proc are "true means don't show
|
// because the semantics of the filter proc are "true means don't show
|
||||||
// it" we need to invert the result that we return
|
// it" we need to invert the result that we return
|
||||||
|
|
||||||
if ( !visibleFlag )
|
if ( !visibleFlag )
|
||||||
return true ;
|
return true ;
|
||||||
|
|
||||||
if ( !folderFlag )
|
if ( !folderFlag )
|
||||||
{
|
{
|
||||||
return !CheckFile( myCInfoPBPtr->hFileInfo.ioNamePtr , myCInfoPBPtr->hFileInfo.ioFlFndrInfo.fdType , data ) ;
|
return !CheckFile( myCInfoPBPtr->hFileInfo.ioNamePtr , myCInfoPBPtr->hFileInfo.ioFlFndrInfo.fdType , data ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false ;
|
return false ;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -335,7 +335,7 @@ wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,
|
|||||||
const wxString& defaultDir, const wxString& defaultFileName, const wxString& wildCard,
|
const wxString& defaultDir, const wxString& defaultFileName, const wxString& wildCard,
|
||||||
long style, const wxPoint& pos)
|
long style, const wxPoint& pos)
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( NavServicesAvailable() , "Navigation Services are not running" ) ;
|
wxASSERT_MSG( NavServicesAvailable() , "Navigation Services are not running" ) ;
|
||||||
m_message = message;
|
m_message = message;
|
||||||
m_dialogStyle = style;
|
m_dialogStyle = style;
|
||||||
m_parent = parent;
|
m_parent = parent;
|
||||||
@@ -362,7 +362,7 @@ pascal Boolean CrossPlatformFilterCallback (
|
|||||||
NavFileOrFolderInfo* theInfo = (NavFileOrFolderInfo*) info ;
|
NavFileOrFolderInfo* theInfo = (NavFileOrFolderInfo*) info ;
|
||||||
if (theItem->descriptorType == typeFSS && !theInfo->isFolder)
|
if (theItem->descriptorType == typeFSS && !theInfo->isFolder)
|
||||||
{
|
{
|
||||||
FSSpec spec;
|
FSSpec spec;
|
||||||
memcpy( &spec , *theItem->dataHandle , sizeof(FSSpec) ) ;
|
memcpy( &spec , *theItem->dataHandle , sizeof(FSSpec) ) ;
|
||||||
display = CheckFile( spec.name , theInfo->fileAndFolder.fileInfo.finderInfo.fdType , data ) ;
|
display = CheckFile( spec.name , theInfo->fileAndFolder.fileInfo.finderInfo.fdType , data ) ;
|
||||||
}
|
}
|
||||||
@@ -373,34 +373,34 @@ pascal Boolean CrossPlatformFilterCallback (
|
|||||||
|
|
||||||
int wxFileDialog::ShowModal()
|
int wxFileDialog::ShowModal()
|
||||||
{
|
{
|
||||||
NavDialogOptions mNavOptions;
|
NavDialogOptions mNavOptions;
|
||||||
NavObjectFilterUPP mNavFilterUPP = NULL;
|
NavObjectFilterUPP mNavFilterUPP = NULL;
|
||||||
NavPreviewUPP mNavPreviewUPP = NULL ;
|
NavPreviewUPP mNavPreviewUPP = NULL ;
|
||||||
NavReplyRecord mNavReply;
|
NavReplyRecord mNavReply;
|
||||||
AEDesc mDefaultLocation ;
|
AEDesc mDefaultLocation ;
|
||||||
bool mSelectDefault = false ;
|
bool mSelectDefault = false ;
|
||||||
|
|
||||||
// zero all data
|
// zero all data
|
||||||
|
|
||||||
m_path = wxEmptyString ;
|
m_path = wxEmptyString ;
|
||||||
m_fileName = wxEmptyString ;
|
m_fileName = wxEmptyString ;
|
||||||
m_paths.Empty();
|
m_paths.Empty();
|
||||||
m_fileNames.Empty();
|
m_fileNames.Empty();
|
||||||
|
|
||||||
// setup dialog
|
// setup dialog
|
||||||
|
|
||||||
::NavGetDefaultDialogOptions(&mNavOptions);
|
::NavGetDefaultDialogOptions(&mNavOptions);
|
||||||
|
|
||||||
mNavFilterUPP = nil;
|
mNavFilterUPP = nil;
|
||||||
mNavPreviewUPP = nil;
|
mNavPreviewUPP = nil;
|
||||||
mSelectDefault = false;
|
mSelectDefault = false;
|
||||||
mNavReply.validRecord = false;
|
mNavReply.validRecord = false;
|
||||||
mNavReply.replacing = false;
|
mNavReply.replacing = false;
|
||||||
mNavReply.isStationery = false;
|
mNavReply.isStationery = false;
|
||||||
mNavReply.translationNeeded = false;
|
mNavReply.translationNeeded = false;
|
||||||
mNavReply.selection.descriptorType = typeNull;
|
mNavReply.selection.descriptorType = typeNull;
|
||||||
mNavReply.selection.dataHandle = nil;
|
mNavReply.selection.dataHandle = nil;
|
||||||
mNavReply.keyScript = smSystemScript;
|
mNavReply.keyScript = smSystemScript;
|
||||||
mNavReply.fileTranslation = nil;
|
mNavReply.fileTranslation = nil;
|
||||||
|
|
||||||
// Set default location, the location
|
// Set default location, the location
|
||||||
@@ -438,7 +438,7 @@ int wxFileDialog::ShowModal()
|
|||||||
c2pstr((char *)mNavOptions.savedFileName ) ;
|
c2pstr((char *)mNavOptions.savedFileName ) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
OpenUserDataRec myData;
|
OpenUserDataRec myData;
|
||||||
MakeUserDataRec( &myData , m_wildCard ) ;
|
MakeUserDataRec( &myData , m_wildCard ) ;
|
||||||
myData.currentfilter = m_filterIndex ;
|
myData.currentfilter = m_filterIndex ;
|
||||||
if ( myData.extensions.GetCount() > 0 )
|
if ( myData.extensions.GetCount() > 0 )
|
||||||
@@ -472,7 +472,7 @@ int wxFileDialog::ShowModal()
|
|||||||
sStandardNavEventFilter ,
|
sStandardNavEventFilter ,
|
||||||
NULL,
|
NULL,
|
||||||
kNavGenericSignature,
|
kNavGenericSignature,
|
||||||
&myData); // User Data
|
&myData); // User Data
|
||||||
m_filterIndex = myData.currentfilter ;
|
m_filterIndex = myData.currentfilter ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -566,7 +566,7 @@ wxDefaultFileSelector(bool load, const char *what, const char *extension, const
|
|||||||
wxString
|
wxString
|
||||||
wxLoadFileSelector(const char *what, const char *extension, const char *default_name, wxWindow *parent)
|
wxLoadFileSelector(const char *what, const char *extension, const char *default_name, wxWindow *parent)
|
||||||
{
|
{
|
||||||
return wxDefaultFileSelector(TRUE, what, extension, default_name, parent);
|
return wxDefaultFileSelector(TRUE, what, extension, default_name, parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -574,7 +574,7 @@ wxLoadFileSelector(const char *what, const char *extension, const char *default_
|
|||||||
wxString
|
wxString
|
||||||
wxSaveFileSelector(const char *what, const char *extension, const char *default_name, wxWindow *parent)
|
wxSaveFileSelector(const char *what, const char *extension, const char *default_name, wxWindow *parent)
|
||||||
{
|
{
|
||||||
return wxDefaultFileSelector(FALSE, what, extension, default_name, parent);
|
return wxDefaultFileSelector(FALSE, what, extension, default_name, parent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -67,66 +67,66 @@ wxFontRefData::~wxFontRefData()
|
|||||||
|
|
||||||
void wxFontRefData::MacFindFont()
|
void wxFontRefData::MacFindFont()
|
||||||
{
|
{
|
||||||
if( m_faceName == "" )
|
if( m_faceName == "" )
|
||||||
{
|
{
|
||||||
switch( m_family )
|
switch( m_family )
|
||||||
{
|
{
|
||||||
case wxDEFAULT :
|
case wxDEFAULT :
|
||||||
m_macFontNum = ::GetAppFont() ;
|
m_macFontNum = ::GetAppFont() ;
|
||||||
break ;
|
break ;
|
||||||
case wxDECORATIVE :
|
case wxDECORATIVE :
|
||||||
::GetFNum( "\pTimes" , &m_macFontNum) ;
|
::GetFNum( "\pTimes" , &m_macFontNum) ;
|
||||||
break ;
|
break ;
|
||||||
case wxROMAN :
|
case wxROMAN :
|
||||||
::GetFNum( "\pTimes" , &m_macFontNum) ;
|
::GetFNum( "\pTimes" , &m_macFontNum) ;
|
||||||
break ;
|
break ;
|
||||||
case wxSCRIPT :
|
case wxSCRIPT :
|
||||||
::GetFNum( "\pTimes" , &m_macFontNum) ;
|
::GetFNum( "\pTimes" , &m_macFontNum) ;
|
||||||
break ;
|
break ;
|
||||||
case wxSWISS :
|
case wxSWISS :
|
||||||
::GetFNum( "\pGeneva" , &m_macFontNum) ;
|
::GetFNum( "\pGeneva" , &m_macFontNum) ;
|
||||||
break ;
|
break ;
|
||||||
case wxMODERN :
|
case wxMODERN :
|
||||||
::GetFNum( "\pMonaco" , &m_macFontNum) ;
|
::GetFNum( "\pMonaco" , &m_macFontNum) ;
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
Str255 name ;
|
Str255 name ;
|
||||||
GetFontName( m_macFontNum , name ) ;
|
GetFontName( m_macFontNum , name ) ;
|
||||||
CopyPascalStringToC( name , (char*) name ) ;
|
CopyPascalStringToC( name , (char*) name ) ;
|
||||||
m_faceName = (char*) name ;
|
m_faceName = (char*) name ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( m_faceName == "systemfont" )
|
if ( m_faceName == "systemfont" )
|
||||||
m_macFontNum = ::GetSysFont() ;
|
m_macFontNum = ::GetSysFont() ;
|
||||||
else if ( m_faceName == "applicationfont" )
|
else if ( m_faceName == "applicationfont" )
|
||||||
m_macFontNum = ::GetAppFont() ;
|
m_macFontNum = ::GetAppFont() ;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Str255 fontname ;
|
Str255 fontname ;
|
||||||
wxMacStringToPascal( m_faceName , fontname ) ;
|
wxMacStringToPascal( m_faceName , fontname ) ;
|
||||||
::GetFNum( fontname, &m_macFontNum);
|
::GetFNum( fontname, &m_macFontNum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_macFontStyle = 0;
|
m_macFontStyle = 0;
|
||||||
if (m_weight == wxBOLD)
|
if (m_weight == wxBOLD)
|
||||||
m_macFontStyle |= bold;
|
m_macFontStyle |= bold;
|
||||||
if (m_style == wxITALIC || m_style == wxSLANT)
|
if (m_style == wxITALIC || m_style == wxSLANT)
|
||||||
m_macFontStyle |= italic;
|
m_macFontStyle |= italic;
|
||||||
if (m_underlined)
|
if (m_underlined)
|
||||||
m_macFontStyle |= underline;
|
m_macFontStyle |= underline;
|
||||||
m_macFontSize = m_pointSize ;
|
m_macFontSize = m_pointSize ;
|
||||||
|
|
||||||
//TODO:if we supply the style as an additional parameter we must make a testing
|
//TODO:if we supply the style as an additional parameter we must make a testing
|
||||||
//sequence in order to degrade gracefully while trying to maintain most of the style
|
//sequence in order to degrade gracefully while trying to maintain most of the style
|
||||||
//information, meanwhile we just take the normal font and apply the features after
|
//information, meanwhile we just take the normal font and apply the features after
|
||||||
OSStatus status = ::ATSUFONDtoFontID(m_macFontNum, normal /*qdStyle*/, (UInt32*)&m_macATSUFontID);
|
OSStatus status = ::ATSUFONDtoFontID(m_macFontNum, normal /*qdStyle*/, (UInt32*)&m_macATSUFontID);
|
||||||
/*
|
/*
|
||||||
status = ATSUFindFontFromName ( (Ptr) m_faceName , strlen( m_faceName ) ,
|
status = ATSUFindFontFromName ( (Ptr) m_faceName , strlen( m_faceName ) ,
|
||||||
kFontFullName, kFontMacintoshPlatform, kFontRomanScript , kFontNoLanguage , (UInt32*)&m_macATSUFontID ) ;
|
kFontFullName, kFontMacintoshPlatform, kFontRomanScript , kFontNoLanguage , (UInt32*)&m_macATSUFontID ) ;
|
||||||
*/
|
*/
|
||||||
wxASSERT_MSG( status == noErr , "couldn't retrieve font identifier" ) ;
|
wxASSERT_MSG( status == noErr , "couldn't retrieve font identifier" ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -173,7 +173,7 @@ wxFont::~wxFont()
|
|||||||
|
|
||||||
bool wxFont::RealizeResource()
|
bool wxFont::RealizeResource()
|
||||||
{
|
{
|
||||||
M_FONTDATA->MacFindFont() ;
|
M_FONTDATA->MacFindFont() ;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,17 +188,17 @@ void wxFont::SetEncoding(wxFontEncoding encoding)
|
|||||||
|
|
||||||
void wxFont::Unshare()
|
void wxFont::Unshare()
|
||||||
{
|
{
|
||||||
// Don't change shared data
|
// Don't change shared data
|
||||||
if (!m_refData)
|
if (!m_refData)
|
||||||
{
|
{
|
||||||
m_refData = new wxFontRefData();
|
m_refData = new wxFontRefData();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxFontRefData* ref = new wxFontRefData(*(wxFontRefData*)m_refData);
|
wxFontRefData* ref = new wxFontRefData(*(wxFontRefData*)m_refData);
|
||||||
UnRef();
|
UnRef();
|
||||||
m_refData = ref;
|
m_refData = ref;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFont::SetPointSize(int pointSize)
|
void wxFont::SetPointSize(int pointSize)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
|
|||||||
@@ -103,46 +103,46 @@ bool wxFontEnumeratorHelper::SetEncoding(wxFontEncoding encoding)
|
|||||||
|
|
||||||
void wxFontEnumeratorHelper::DoEnumerate()
|
void wxFontEnumeratorHelper::DoEnumerate()
|
||||||
{
|
{
|
||||||
MenuHandle menu ;
|
MenuHandle menu ;
|
||||||
Str255 p_name ;
|
Str255 p_name ;
|
||||||
|
|
||||||
short lines ;
|
short lines ;
|
||||||
|
|
||||||
menu = NewMenu( 32000 , "\pFont" ) ;
|
menu = NewMenu( 32000 , "\pFont" ) ;
|
||||||
AppendResMenu( menu , 'FONT' ) ;
|
AppendResMenu( menu , 'FONT' ) ;
|
||||||
lines = CountMenuItems( menu ) ;
|
lines = CountMenuItems( menu ) ;
|
||||||
|
|
||||||
for ( int i = 1 ; i < lines+1 ; i ++ )
|
for ( int i = 1 ; i < lines+1 ; i ++ )
|
||||||
{
|
{
|
||||||
GetMenuItemText( menu , i , p_name ) ;
|
GetMenuItemText( menu , i , p_name ) ;
|
||||||
wxString c_name = wxMacMakeStringFromPascal(p_name) ;
|
wxString c_name = wxMacMakeStringFromPascal(p_name) ;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
if ( m_fixedOnly )
|
if ( m_fixedOnly )
|
||||||
{
|
{
|
||||||
// check that it's a fixed pitch font (there is *no* error here, the
|
// check that it's a fixed pitch font (there is *no* error here, the
|
||||||
// flag name is misleading!)
|
// flag name is misleading!)
|
||||||
if ( tm->tmPitchAndFamily & TMPF_FIXED_PITCH )
|
if ( tm->tmPitchAndFamily & TMPF_FIXED_PITCH )
|
||||||
{
|
{
|
||||||
// not a fixed pitch font
|
// not a fixed pitch font
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( m_charset != -1 )
|
if ( m_charset != -1 )
|
||||||
{
|
{
|
||||||
// check that we have the right encoding
|
// check that we have the right encoding
|
||||||
if ( lf->lfCharSet != m_charset )
|
if ( lf->lfCharSet != m_charset )
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*/
|
*/
|
||||||
m_fontEnum->OnFacename( c_name ) ;
|
m_fontEnum->OnFacename( c_name ) ;
|
||||||
}
|
}
|
||||||
DisposeMenu( menu ) ;
|
DisposeMenu( menu ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -53,13 +53,13 @@ bool wxFrame::m_useNativeStatusBar = FALSE;
|
|||||||
|
|
||||||
void wxFrame::Init()
|
void wxFrame::Init()
|
||||||
{
|
{
|
||||||
m_frameMenuBar = NULL;
|
m_frameMenuBar = NULL;
|
||||||
|
|
||||||
#if wxUSE_TOOLBAR
|
#if wxUSE_TOOLBAR
|
||||||
m_frameToolBar = NULL ;
|
m_frameToolBar = NULL ;
|
||||||
#endif
|
#endif
|
||||||
m_frameStatusBar = NULL;
|
m_frameStatusBar = NULL;
|
||||||
m_winLastFocused = NULL ;
|
m_winLastFocused = NULL ;
|
||||||
|
|
||||||
m_iconized = FALSE;
|
m_iconized = FALSE;
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ void wxFrame::Init()
|
|||||||
|
|
||||||
wxPoint wxFrame::GetClientAreaOrigin() const
|
wxPoint wxFrame::GetClientAreaOrigin() const
|
||||||
{
|
{
|
||||||
// on mac we are at position -1,-1 with the control
|
// on mac we are at position -1,-1 with the control
|
||||||
wxPoint pt(0, 0);
|
wxPoint pt(0, 0);
|
||||||
|
|
||||||
#if wxUSE_TOOLBAR
|
#if wxUSE_TOOLBAR
|
||||||
@@ -101,27 +101,26 @@ bool wxFrame::Create(wxWindow *parent,
|
|||||||
long style,
|
long style,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE));
|
SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE));
|
||||||
|
|
||||||
if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) )
|
if ( !wxTopLevelWindow::Create(parent, id, title, pos, size, style, name) )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
MacCreateRealWindow( title, pos , size , MacRemoveBordersFromStyle(style) , name ) ;
|
MacCreateRealWindow( title, pos , size , MacRemoveBordersFromStyle(style) , name ) ;
|
||||||
|
|
||||||
m_macWindowBackgroundTheme = kThemeBrushDocumentWindowBackground ;
|
m_macWindowBackgroundTheme = kThemeBrushDocumentWindowBackground ;
|
||||||
SetThemeWindowBackground( (WindowRef) m_macWindow , m_macWindowBackgroundTheme , false ) ;
|
SetThemeWindowBackground( (WindowRef) m_macWindow , m_macWindowBackgroundTheme , false ) ;
|
||||||
|
|
||||||
wxModelessWindows.Append(this);
|
wxModelessWindows.Append(this);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxFrame::~wxFrame()
|
wxFrame::~wxFrame()
|
||||||
{
|
{
|
||||||
m_isBeingDeleted = TRUE;
|
m_isBeingDeleted = TRUE;
|
||||||
|
|
||||||
DeleteAllBars();
|
|
||||||
|
|
||||||
|
DeleteAllBars();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -130,14 +129,14 @@ bool wxFrame::Enable(bool enable)
|
|||||||
if ( !wxWindow::Enable(enable) )
|
if ( !wxWindow::Enable(enable) )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if ( m_frameMenuBar && m_frameMenuBar == wxMenuBar::MacGetInstalledMenuBar() )
|
if ( m_frameMenuBar && m_frameMenuBar == wxMenuBar::MacGetInstalledMenuBar() )
|
||||||
{
|
{
|
||||||
int iMaxMenu = m_frameMenuBar->GetMenuCount();
|
int iMaxMenu = m_frameMenuBar->GetMenuCount();
|
||||||
for ( int i = 0 ; i < iMaxMenu ; ++ i )
|
for ( int i = 0 ; i < iMaxMenu ; ++ i )
|
||||||
{
|
{
|
||||||
m_frameMenuBar->EnableTop( i , enable ) ;
|
m_frameMenuBar->EnableTop( i , enable ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -149,24 +148,24 @@ wxStatusBar *wxFrame::OnCreateStatusBar(int number, long style, wxWindowID id,
|
|||||||
|
|
||||||
statusBar = new wxStatusBar(this, id,
|
statusBar = new wxStatusBar(this, id,
|
||||||
style, name);
|
style, name);
|
||||||
statusBar->SetSize( 100 , 15 ) ;
|
statusBar->SetSize( 100 , 15 ) ;
|
||||||
statusBar->SetFieldsCount(number);
|
statusBar->SetFieldsCount(number);
|
||||||
return statusBar;
|
return statusBar;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFrame::PositionStatusBar()
|
void wxFrame::PositionStatusBar()
|
||||||
{
|
{
|
||||||
if (m_frameStatusBar )
|
if (m_frameStatusBar )
|
||||||
{
|
{
|
||||||
int w, h;
|
int w, h;
|
||||||
GetClientSize(&w, &h);
|
GetClientSize(&w, &h);
|
||||||
int sw, sh;
|
int sw, sh;
|
||||||
m_frameStatusBar->GetSize(&sw, &sh);
|
m_frameStatusBar->GetSize(&sw, &sh);
|
||||||
|
|
||||||
// Since we wish the status bar to be directly under the client area,
|
// Since we wish the status bar to be directly under the client area,
|
||||||
// we use the adjusted sizes without using wxSIZE_NO_ADJUSTMENTS.
|
// we use the adjusted sizes without using wxSIZE_NO_ADJUSTMENTS.
|
||||||
m_frameStatusBar->SetSize(0, h, w, sh);
|
m_frameStatusBar->SetSize(0, h, w, sh);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Responds to colour changes, and passes event on to children.
|
// Responds to colour changes, and passes event on to children.
|
||||||
@@ -215,8 +214,8 @@ void wxFrame::OnActivate(wxActivateEvent& event)
|
|||||||
|
|
||||||
event.Skip();
|
event.Skip();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// restore focus to the child which was last focused
|
// restore focus to the child which was last focused
|
||||||
wxWindow *parent = m_winLastFocused ? m_winLastFocused->GetParent()
|
wxWindow *parent = m_winLastFocused ? m_winLastFocused->GetParent()
|
||||||
: NULL;
|
: NULL;
|
||||||
@@ -225,19 +224,19 @@ void wxFrame::OnActivate(wxActivateEvent& event)
|
|||||||
parent = this;
|
parent = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSetFocusToChild(parent, &m_winLastFocused);
|
wxSetFocusToChild(parent, &m_winLastFocused);
|
||||||
|
|
||||||
if ( m_frameMenuBar != NULL )
|
if ( m_frameMenuBar != NULL )
|
||||||
{
|
{
|
||||||
m_frameMenuBar->MacInstallMenuBar() ;
|
m_frameMenuBar->MacInstallMenuBar() ;
|
||||||
}
|
}
|
||||||
else if (wxTheApp->GetTopWindow() && wxTheApp->GetTopWindow()->IsKindOf(CLASSINFO(wxFrame)))
|
else if (wxTheApp->GetTopWindow() && wxTheApp->GetTopWindow()->IsKindOf(CLASSINFO(wxFrame)))
|
||||||
{
|
{
|
||||||
// Trying toplevel frame menbar
|
// Trying toplevel frame menbar
|
||||||
if( ((wxFrame*)wxTheApp->GetTopWindow())->GetMenuBar() )
|
if( ((wxFrame*)wxTheApp->GetTopWindow())->GetMenuBar() )
|
||||||
((wxFrame*)wxTheApp->GetTopWindow())->GetMenuBar()->MacInstallMenuBar();
|
((wxFrame*)wxTheApp->GetTopWindow())->GetMenuBar()->MacInstallMenuBar();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFrame::DetachMenuBar()
|
void wxFrame::DetachMenuBar()
|
||||||
@@ -262,40 +261,40 @@ void wxFrame::AttachMenuBar( wxMenuBar *menuBar )
|
|||||||
|
|
||||||
void wxFrame::DoGetClientSize(int *x, int *y) const
|
void wxFrame::DoGetClientSize(int *x, int *y) const
|
||||||
{
|
{
|
||||||
wxWindow::DoGetClientSize( x , y ) ;
|
wxWindow::DoGetClientSize( x , y ) ;
|
||||||
|
|
||||||
#if wxUSE_STATUSBAR
|
#if wxUSE_STATUSBAR
|
||||||
if ( GetStatusBar() && y )
|
if ( GetStatusBar() && y )
|
||||||
{
|
{
|
||||||
int statusX, statusY;
|
int statusX, statusY;
|
||||||
GetStatusBar()->GetClientSize(&statusX, &statusY);
|
GetStatusBar()->GetClientSize(&statusX, &statusY);
|
||||||
*y -= statusY;
|
*y -= statusY;
|
||||||
}
|
}
|
||||||
#endif // wxUSE_STATUSBAR
|
#endif // wxUSE_STATUSBAR
|
||||||
|
|
||||||
wxPoint pt(GetClientAreaOrigin());
|
wxPoint pt(GetClientAreaOrigin());
|
||||||
if ( y )
|
if ( y )
|
||||||
*y -= pt.y;
|
*y -= pt.y;
|
||||||
if ( x )
|
if ( x )
|
||||||
*x -= pt.x;
|
*x -= pt.x;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxFrame::DoSetClientSize(int clientwidth, int clientheight)
|
void wxFrame::DoSetClientSize(int clientwidth, int clientheight)
|
||||||
{
|
{
|
||||||
int currentclientwidth , currentclientheight ;
|
int currentclientwidth , currentclientheight ;
|
||||||
int currentwidth , currentheight ;
|
int currentwidth , currentheight ;
|
||||||
|
|
||||||
GetClientSize( ¤tclientwidth , ¤tclientheight ) ;
|
GetClientSize( ¤tclientwidth , ¤tclientheight ) ;
|
||||||
GetSize( ¤twidth , ¤theight ) ;
|
GetSize( ¤twidth , ¤theight ) ;
|
||||||
|
|
||||||
// find the current client size
|
// find the current client size
|
||||||
|
|
||||||
// Find the difference between the entire window (title bar and all)
|
// Find the difference between the entire window (title bar and all)
|
||||||
// and the client area; add this to the new client size to move the
|
// and the client area; add this to the new client size to move the
|
||||||
// window
|
// window
|
||||||
|
|
||||||
DoSetSize( -1 , -1 , currentwidth + clientwidth - currentclientwidth ,
|
DoSetSize( -1 , -1 , currentwidth + clientwidth - currentclientwidth ,
|
||||||
currentheight + clientheight - currentclientheight , wxSIZE_USE_EXISTING ) ;
|
currentheight + clientheight - currentclientheight , wxSIZE_USE_EXISTING ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -314,8 +313,8 @@ void wxFrame::PositionToolBar()
|
|||||||
{
|
{
|
||||||
int cw, ch;
|
int cw, ch;
|
||||||
|
|
||||||
cw = m_width ;
|
cw = m_width ;
|
||||||
ch = m_height ;
|
ch = m_height ;
|
||||||
|
|
||||||
if ( GetStatusBar() )
|
if ( GetStatusBar() )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -29,25 +29,25 @@ bool wxGauge::Create(wxWindow *parent, wxWindowID id,
|
|||||||
const wxValidator& validator,
|
const wxValidator& validator,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
wxSize size = s ;
|
wxSize size = s ;
|
||||||
Rect bounds ;
|
Rect bounds ;
|
||||||
Str255 title ;
|
Str255 title ;
|
||||||
m_rangeMax = range ;
|
m_rangeMax = range ;
|
||||||
m_gaugePos = 0 ;
|
m_gaugePos = 0 ;
|
||||||
|
|
||||||
if ( size.x == wxDefaultSize.x && size.y == wxDefaultSize.y)
|
if ( size.x == wxDefaultSize.x && size.y == wxDefaultSize.y)
|
||||||
{
|
{
|
||||||
size = wxSize( 200 , 16 ) ;
|
size = wxSize( 200 , 16 ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
MacPreControlCreate( parent , id , "" , pos , size ,style & 0xE0FFFFFF /* no borders on mac */ , validator , name , &bounds , title ) ;
|
MacPreControlCreate( parent , id , "" , pos , size ,style & 0xE0FFFFFF /* no borders on mac */ , validator , name , &bounds , title ) ;
|
||||||
|
|
||||||
m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , range,
|
m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , range,
|
||||||
kControlProgressBarProc , (long) this ) ;
|
kControlProgressBarProc , (long) this ) ;
|
||||||
|
|
||||||
MacPostControlCreate() ;
|
MacPostControlCreate() ;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGauge::SetShadowWidth(int w)
|
void wxGauge::SetShadowWidth(int w)
|
||||||
@@ -67,7 +67,7 @@ void wxGauge::SetRange(int r)
|
|||||||
void wxGauge::SetValue(int pos)
|
void wxGauge::SetValue(int pos)
|
||||||
{
|
{
|
||||||
m_gaugePos = pos;
|
m_gaugePos = pos;
|
||||||
::SetControl32BitValue( (ControlHandle) m_macControl , m_gaugePos ) ;
|
::SetControl32BitValue( (ControlHandle) m_macControl , m_gaugePos ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxGauge::GetShadowWidth() const
|
int wxGauge::GetShadowWidth() const
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -34,14 +34,14 @@
|
|||||||
#include "wx/mac/uma.h"
|
#include "wx/mac/uma.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GLContext implementation
|
* GLContext implementation
|
||||||
*/
|
*/
|
||||||
|
|
||||||
wxGLContext::wxGLContext(
|
wxGLContext::wxGLContext(
|
||||||
AGLPixelFormat fmt, wxGLCanvas *win,
|
AGLPixelFormat fmt, wxGLCanvas *win,
|
||||||
const wxPalette& palette,
|
const wxPalette& palette,
|
||||||
const wxGLContext *other /* for sharing display lists */
|
const wxGLContext *other /* for sharing display lists */
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
m_window = win;
|
m_window = win;
|
||||||
|
|
||||||
@@ -50,66 +50,66 @@ wxGLContext::wxGLContext(
|
|||||||
m_glContext = aglCreateContext(fmt, other ? other->m_glContext : NULL);
|
m_glContext = aglCreateContext(fmt, other ? other->m_glContext : NULL);
|
||||||
wxCHECK_RET( m_glContext, wxT("Couldn't create OpenGl context") );
|
wxCHECK_RET( m_glContext, wxT("Couldn't create OpenGl context") );
|
||||||
|
|
||||||
GLboolean b;
|
GLboolean b;
|
||||||
b = aglSetDrawable(m_glContext, m_drawable);
|
b = aglSetDrawable(m_glContext, m_drawable);
|
||||||
wxCHECK_RET( b, wxT("Couldn't bind OpenGl context") );
|
wxCHECK_RET( b, wxT("Couldn't bind OpenGl context") );
|
||||||
aglEnable(m_glContext , AGL_BUFFER_RECT ) ;
|
aglEnable(m_glContext , AGL_BUFFER_RECT ) ;
|
||||||
b = aglSetCurrentContext(m_glContext);
|
b = aglSetCurrentContext(m_glContext);
|
||||||
wxCHECK_RET( b, wxT("Couldn't activate OpenGl context") );
|
wxCHECK_RET( b, wxT("Couldn't activate OpenGl context") );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxGLContext::~wxGLContext()
|
wxGLContext::~wxGLContext()
|
||||||
{
|
{
|
||||||
if (m_glContext)
|
if (m_glContext)
|
||||||
{
|
{
|
||||||
aglSetCurrentContext(NULL);
|
aglSetCurrentContext(NULL);
|
||||||
aglDestroyContext(m_glContext);
|
aglDestroyContext(m_glContext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGLContext::SwapBuffers()
|
void wxGLContext::SwapBuffers()
|
||||||
{
|
{
|
||||||
if (m_glContext)
|
if (m_glContext)
|
||||||
{
|
{
|
||||||
aglSwapBuffers(m_glContext);
|
aglSwapBuffers(m_glContext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGLContext::SetCurrent()
|
void wxGLContext::SetCurrent()
|
||||||
{
|
{
|
||||||
if (m_glContext)
|
if (m_glContext)
|
||||||
{
|
{
|
||||||
aglSetCurrentContext(m_glContext);
|
aglSetCurrentContext(m_glContext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGLContext::Update()
|
void wxGLContext::Update()
|
||||||
{
|
{
|
||||||
if (m_glContext)
|
if (m_glContext)
|
||||||
{
|
{
|
||||||
aglUpdateContext(m_glContext);
|
aglUpdateContext(m_glContext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGLContext::SetColour(const char *colour)
|
void wxGLContext::SetColour(const char *colour)
|
||||||
{
|
{
|
||||||
float r = 0.0;
|
float r = 0.0;
|
||||||
float g = 0.0;
|
float g = 0.0;
|
||||||
float b = 0.0;
|
float b = 0.0;
|
||||||
wxColour *col = wxTheColourDatabase->FindColour(colour);
|
wxColour *col = wxTheColourDatabase->FindColour(colour);
|
||||||
if (col)
|
if (col)
|
||||||
{
|
{
|
||||||
r = (float)(col->Red()/256.0);
|
r = (float)(col->Red()/256.0);
|
||||||
g = (float)(col->Green()/256.0);
|
g = (float)(col->Green()/256.0);
|
||||||
b = (float)(col->Blue()/256.0);
|
b = (float)(col->Blue()/256.0);
|
||||||
glColor3f( r, g, b);
|
glColor3f( r, g, b);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* wxGLCanvas implementation
|
* wxGLCanvas implementation
|
||||||
*/
|
*/
|
||||||
|
|
||||||
IMPLEMENT_CLASS(wxGLCanvas, wxWindow)
|
IMPLEMENT_CLASS(wxGLCanvas, wxWindow)
|
||||||
|
|
||||||
@@ -118,23 +118,23 @@ BEGIN_EVENT_TABLE(wxGLCanvas, wxWindow)
|
|||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
wxGLCanvas::wxGLCanvas(wxWindow *parent, wxWindowID id,
|
wxGLCanvas::wxGLCanvas(wxWindow *parent, wxWindowID id,
|
||||||
const wxPoint& pos, const wxSize& size, long style, const wxString& name,
|
const wxPoint& pos, const wxSize& size, long style, const wxString& name,
|
||||||
int *attribList, const wxPalette& palette)
|
int *attribList, const wxPalette& palette)
|
||||||
{
|
{
|
||||||
Create(parent, NULL, id, pos, size, style, name, attribList, palette);
|
Create(parent, NULL, id, pos, size, style, name, attribList, palette);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxGLCanvas::wxGLCanvas( wxWindow *parent,
|
wxGLCanvas::wxGLCanvas( wxWindow *parent,
|
||||||
const wxGLContext *shared, wxWindowID id,
|
const wxGLContext *shared, wxWindowID id,
|
||||||
const wxPoint& pos, const wxSize& size, long style, const wxString& name,
|
const wxPoint& pos, const wxSize& size, long style, const wxString& name,
|
||||||
int *attribList, const wxPalette& palette )
|
int *attribList, const wxPalette& palette )
|
||||||
{
|
{
|
||||||
Create(parent, shared, id, pos, size, style, name, attribList, palette);
|
Create(parent, shared, id, pos, size, style, name, attribList, palette);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxGLCanvas::wxGLCanvas( wxWindow *parent, const wxGLCanvas *shared, wxWindowID id,
|
wxGLCanvas::wxGLCanvas( wxWindow *parent, const wxGLCanvas *shared, wxWindowID id,
|
||||||
const wxPoint& pos, const wxSize& size, long style, const wxString& name,
|
const wxPoint& pos, const wxSize& size, long style, const wxString& name,
|
||||||
int *attribList, const wxPalette& palette )
|
int *attribList, const wxPalette& palette )
|
||||||
{
|
{
|
||||||
Create(parent, shared ? shared->GetContext() : NULL, id, pos, size, style, name, attribList, palette);
|
Create(parent, shared ? shared->GetContext() : NULL, id, pos, size, style, name, attribList, palette);
|
||||||
}
|
}
|
||||||
@@ -151,72 +151,72 @@ static AGLPixelFormat ChoosePixelFormat(const int *attribList)
|
|||||||
{
|
{
|
||||||
GLint data[512];
|
GLint data[512];
|
||||||
GLint defaultAttribs[] = { AGL_RGBA,
|
GLint defaultAttribs[] = { AGL_RGBA,
|
||||||
AGL_DOUBLEBUFFER,
|
AGL_DOUBLEBUFFER,
|
||||||
AGL_MINIMUM_POLICY,
|
AGL_MINIMUM_POLICY,
|
||||||
AGL_DEPTH_SIZE, 1, // use largest available depth buffer
|
AGL_DEPTH_SIZE, 1, // use largest available depth buffer
|
||||||
AGL_RED_SIZE, 1,
|
AGL_RED_SIZE, 1,
|
||||||
AGL_GREEN_SIZE, 1,
|
AGL_GREEN_SIZE, 1,
|
||||||
AGL_BLUE_SIZE, 1,
|
AGL_BLUE_SIZE, 1,
|
||||||
AGL_ALPHA_SIZE, 0,
|
AGL_ALPHA_SIZE, 0,
|
||||||
AGL_NONE };
|
AGL_NONE };
|
||||||
GLint *attribs;
|
GLint *attribs;
|
||||||
if (!attribList)
|
if (!attribList)
|
||||||
{
|
{
|
||||||
attribs = defaultAttribs;
|
attribs = defaultAttribs;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int arg=0, p=0;
|
int arg=0, p=0;
|
||||||
|
|
||||||
data[p++] = AGL_MINIMUM_POLICY; // make _SIZE tags behave more like GLX
|
data[p++] = AGL_MINIMUM_POLICY; // make _SIZE tags behave more like GLX
|
||||||
while( (attribList[arg]!=0) && (p<512) )
|
while( (attribList[arg]!=0) && (p<512) )
|
||||||
{
|
|
||||||
switch( attribList[arg++] )
|
|
||||||
{
|
{
|
||||||
case WX_GL_RGBA: data[p++] = AGL_RGBA; break;
|
switch( attribList[arg++] )
|
||||||
case WX_GL_BUFFER_SIZE:
|
{
|
||||||
data[p++]=AGL_BUFFER_SIZE; data[p++]=attribList[arg++]; break;
|
case WX_GL_RGBA: data[p++] = AGL_RGBA; break;
|
||||||
case WX_GL_LEVEL:
|
case WX_GL_BUFFER_SIZE:
|
||||||
data[p++]=AGL_LEVEL; data[p++]=attribList[arg++]; break;
|
data[p++]=AGL_BUFFER_SIZE; data[p++]=attribList[arg++]; break;
|
||||||
case WX_GL_DOUBLEBUFFER: data[p++] = AGL_DOUBLEBUFFER; break;
|
case WX_GL_LEVEL:
|
||||||
case WX_GL_STEREO: data[p++] = AGL_STEREO; break;
|
data[p++]=AGL_LEVEL; data[p++]=attribList[arg++]; break;
|
||||||
case WX_GL_AUX_BUFFERS:
|
case WX_GL_DOUBLEBUFFER: data[p++] = AGL_DOUBLEBUFFER; break;
|
||||||
data[p++]=AGL_AUX_BUFFERS; data[p++]=attribList[arg++]; break;
|
case WX_GL_STEREO: data[p++] = AGL_STEREO; break;
|
||||||
case WX_GL_MIN_RED:
|
case WX_GL_AUX_BUFFERS:
|
||||||
data[p++]=AGL_RED_SIZE; data[p++]=attribList[arg++]; break;
|
data[p++]=AGL_AUX_BUFFERS; data[p++]=attribList[arg++]; break;
|
||||||
case WX_GL_MIN_GREEN:
|
case WX_GL_MIN_RED:
|
||||||
data[p++]=AGL_GREEN_SIZE; data[p++]=attribList[arg++]; break;
|
data[p++]=AGL_RED_SIZE; data[p++]=attribList[arg++]; break;
|
||||||
case WX_GL_MIN_BLUE:
|
case WX_GL_MIN_GREEN:
|
||||||
data[p++]=AGL_BLUE_SIZE; data[p++]=attribList[arg++]; break;
|
data[p++]=AGL_GREEN_SIZE; data[p++]=attribList[arg++]; break;
|
||||||
case WX_GL_MIN_ALPHA:
|
case WX_GL_MIN_BLUE:
|
||||||
data[p++]=AGL_ALPHA_SIZE; data[p++]=attribList[arg++]; break;
|
data[p++]=AGL_BLUE_SIZE; data[p++]=attribList[arg++]; break;
|
||||||
case WX_GL_DEPTH_SIZE:
|
case WX_GL_MIN_ALPHA:
|
||||||
data[p++]=AGL_DEPTH_SIZE; data[p++]=attribList[arg++]; break;
|
data[p++]=AGL_ALPHA_SIZE; data[p++]=attribList[arg++]; break;
|
||||||
case WX_GL_STENCIL_SIZE:
|
case WX_GL_DEPTH_SIZE:
|
||||||
data[p++]=AGL_STENCIL_SIZE; data[p++]=attribList[arg++]; break;
|
data[p++]=AGL_DEPTH_SIZE; data[p++]=attribList[arg++]; break;
|
||||||
case WX_GL_MIN_ACCUM_RED:
|
case WX_GL_STENCIL_SIZE:
|
||||||
data[p++]=AGL_ACCUM_RED_SIZE; data[p++]=attribList[arg++]; break;
|
data[p++]=AGL_STENCIL_SIZE; data[p++]=attribList[arg++]; break;
|
||||||
case WX_GL_MIN_ACCUM_GREEN:
|
case WX_GL_MIN_ACCUM_RED:
|
||||||
data[p++]=AGL_ACCUM_GREEN_SIZE; data[p++]=attribList[arg++]; break;
|
data[p++]=AGL_ACCUM_RED_SIZE; data[p++]=attribList[arg++]; break;
|
||||||
case WX_GL_MIN_ACCUM_BLUE:
|
case WX_GL_MIN_ACCUM_GREEN:
|
||||||
data[p++]=AGL_ACCUM_BLUE_SIZE; data[p++]=attribList[arg++]; break;
|
data[p++]=AGL_ACCUM_GREEN_SIZE; data[p++]=attribList[arg++]; break;
|
||||||
case WX_GL_MIN_ACCUM_ALPHA:
|
case WX_GL_MIN_ACCUM_BLUE:
|
||||||
data[p++]=AGL_ACCUM_ALPHA_SIZE; data[p++]=attribList[arg++]; break;
|
data[p++]=AGL_ACCUM_BLUE_SIZE; data[p++]=attribList[arg++]; break;
|
||||||
default:
|
case WX_GL_MIN_ACCUM_ALPHA:
|
||||||
break;
|
data[p++]=AGL_ACCUM_ALPHA_SIZE; data[p++]=attribList[arg++]; break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
data[p] = 0;
|
||||||
data[p] = 0;
|
|
||||||
|
|
||||||
attribs = data;
|
attribs = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
return aglChoosePixelFormat(NULL, 0, attribs);
|
return aglChoosePixelFormat(NULL, 0, attribs);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxGLCanvas::Create(wxWindow *parent, const wxGLContext *shared, wxWindowID id,
|
bool wxGLCanvas::Create(wxWindow *parent, const wxGLContext *shared, wxWindowID id,
|
||||||
const wxPoint& pos, const wxSize& size, long style, const wxString& name,
|
const wxPoint& pos, const wxSize& size, long style, const wxString& name,
|
||||||
int *attribList, const wxPalette& palette)
|
int *attribList, const wxPalette& palette)
|
||||||
{
|
{
|
||||||
wxWindow::Create( parent, id, pos, size, style, name );
|
wxWindow::Create( parent, id, pos, size, style, name );
|
||||||
|
|
||||||
@@ -232,20 +232,20 @@ bool wxGLCanvas::Create(wxWindow *parent, const wxGLContext *shared, wxWindowID
|
|||||||
|
|
||||||
void wxGLCanvas::SwapBuffers()
|
void wxGLCanvas::SwapBuffers()
|
||||||
{
|
{
|
||||||
if (m_glContext)
|
if (m_glContext)
|
||||||
m_glContext->SwapBuffers();
|
m_glContext->SwapBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGLCanvas::UpdateContext()
|
void wxGLCanvas::UpdateContext()
|
||||||
{
|
{
|
||||||
if (m_glContext)
|
if (m_glContext)
|
||||||
m_glContext->Update();
|
m_glContext->Update();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGLCanvas::SetViewport()
|
void wxGLCanvas::SetViewport()
|
||||||
{
|
{
|
||||||
// viewport is initially set to entire port
|
// viewport is initially set to entire port
|
||||||
// adjust glViewport to just this window
|
// adjust glViewport to just this window
|
||||||
int x = 0 ;
|
int x = 0 ;
|
||||||
int y = 0 ;
|
int y = 0 ;
|
||||||
|
|
||||||
@@ -260,48 +260,48 @@ void wxGLCanvas::SetViewport()
|
|||||||
parms[2] = width ;
|
parms[2] = width ;
|
||||||
parms[3] = height ;
|
parms[3] = height ;
|
||||||
|
|
||||||
aglSetInteger( m_glContext->m_glContext , AGL_BUFFER_RECT , parms ) ;
|
aglSetInteger( m_glContext->m_glContext , AGL_BUFFER_RECT , parms ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGLCanvas::OnSize(wxSizeEvent& event)
|
void wxGLCanvas::OnSize(wxSizeEvent& event)
|
||||||
{
|
{
|
||||||
MacUpdateView() ;
|
MacUpdateView() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGLCanvas::MacUpdateView()
|
void wxGLCanvas::MacUpdateView()
|
||||||
{
|
{
|
||||||
if (m_glContext)
|
if (m_glContext)
|
||||||
{
|
{
|
||||||
UpdateContext();
|
UpdateContext();
|
||||||
m_glContext->SetCurrent();
|
m_glContext->SetCurrent();
|
||||||
SetViewport();
|
SetViewport();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGLCanvas::MacSuperChangedPosition()
|
void wxGLCanvas::MacSuperChangedPosition()
|
||||||
{
|
{
|
||||||
MacUpdateView() ;
|
MacUpdateView() ;
|
||||||
wxWindow::MacSuperChangedPosition() ;
|
wxWindow::MacSuperChangedPosition() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGLCanvas::MacTopLevelWindowChangedPosition()
|
void wxGLCanvas::MacTopLevelWindowChangedPosition()
|
||||||
{
|
{
|
||||||
MacUpdateView() ;
|
MacUpdateView() ;
|
||||||
wxWindow::MacTopLevelWindowChangedPosition() ;
|
wxWindow::MacTopLevelWindowChangedPosition() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGLCanvas::SetCurrent()
|
void wxGLCanvas::SetCurrent()
|
||||||
{
|
{
|
||||||
if (m_glContext)
|
if (m_glContext)
|
||||||
{
|
{
|
||||||
m_glContext->SetCurrent();
|
m_glContext->SetCurrent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGLCanvas::SetColour(const char *colour)
|
void wxGLCanvas::SetColour(const char *colour)
|
||||||
{
|
{
|
||||||
if (m_glContext)
|
if (m_glContext)
|
||||||
m_glContext->SetColour(colour);
|
m_glContext->SetColour(colour);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -47,7 +47,7 @@ bool wxXXXXHelpController::LoadFile(const wxString& file)
|
|||||||
bool wxXXXXHelpController::DisplayContents()
|
bool wxXXXXHelpController::DisplayContents()
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxXXXXHelpController::DisplaySection(int section)
|
bool wxXXXXHelpController::DisplaySection(int section)
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -59,16 +59,16 @@ wxIcon::~wxIcon()
|
|||||||
bool wxIcon::LoadFile(const wxString& filename, wxBitmapType type,
|
bool wxIcon::LoadFile(const wxString& filename, wxBitmapType type,
|
||||||
int desiredWidth, int desiredHeight)
|
int desiredWidth, int desiredHeight)
|
||||||
{
|
{
|
||||||
UnRef();
|
UnRef();
|
||||||
|
|
||||||
m_refData = new wxBitmapRefData;
|
m_refData = new wxBitmapRefData;
|
||||||
|
|
||||||
wxBitmapHandler *handler = FindHandler((wxBitmapType)type);
|
wxBitmapHandler *handler = FindHandler((wxBitmapType)type);
|
||||||
|
|
||||||
if ( handler )
|
if ( handler )
|
||||||
return handler->LoadFile(this, filename, type, desiredWidth, desiredHeight);
|
return handler->LoadFile(this, filename, type, desiredWidth, desiredHeight);
|
||||||
else
|
else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxIcon::CopyFromBitmap(const wxBitmap& bmp)
|
void wxIcon::CopyFromBitmap(const wxBitmap& bmp)
|
||||||
@@ -80,9 +80,9 @@ void wxIcon::CopyFromBitmap(const wxBitmap& bmp)
|
|||||||
IMPLEMENT_DYNAMIC_CLASS(wxICONResourceHandler, wxBitmapHandler)
|
IMPLEMENT_DYNAMIC_CLASS(wxICONResourceHandler, wxBitmapHandler)
|
||||||
|
|
||||||
bool wxICONResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
|
bool wxICONResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, long flags,
|
||||||
int desiredWidth, int desiredHeight)
|
int desiredWidth, int desiredHeight)
|
||||||
{
|
{
|
||||||
short theId = -1 ;
|
short theId = -1 ;
|
||||||
if ( name == "wxICON_INFORMATION" )
|
if ( name == "wxICON_INFORMATION" )
|
||||||
{
|
{
|
||||||
theId = kNoteIcon ;
|
theId = kNoteIcon ;
|
||||||
@@ -93,46 +93,46 @@ bool wxICONResourceHandler::LoadFile(wxBitmap *bitmap, const wxString& name, lo
|
|||||||
}
|
}
|
||||||
else if ( name == "wxICON_WARNING" )
|
else if ( name == "wxICON_WARNING" )
|
||||||
{
|
{
|
||||||
theId = kCautionIcon ;
|
theId = kCautionIcon ;
|
||||||
}
|
}
|
||||||
else if ( name == "wxICON_ERROR" )
|
else if ( name == "wxICON_ERROR" )
|
||||||
{
|
{
|
||||||
theId = kStopIcon ;
|
theId = kStopIcon ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Str255 theName ;
|
Str255 theName ;
|
||||||
OSType theType ;
|
OSType theType ;
|
||||||
|
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
c2pstrcpy( (StringPtr) theName , name ) ;
|
c2pstrcpy( (StringPtr) theName , name ) ;
|
||||||
#else
|
#else
|
||||||
strcpy( (char *) theName , name ) ;
|
strcpy( (char *) theName , name ) ;
|
||||||
c2pstr( (char *) theName ) ;
|
c2pstr( (char *) theName ) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Handle resHandle = GetNamedResource( 'cicn' , theName ) ;
|
Handle resHandle = GetNamedResource( 'cicn' , theName ) ;
|
||||||
if ( resHandle != 0L )
|
if ( resHandle != 0L )
|
||||||
{
|
{
|
||||||
GetResInfo( resHandle , &theId , &theType , theName ) ;
|
GetResInfo( resHandle , &theId , &theType , theName ) ;
|
||||||
ReleaseResource( resHandle ) ;
|
ReleaseResource( resHandle ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( theId != -1 )
|
if ( theId != -1 )
|
||||||
{
|
{
|
||||||
CIconHandle theIcon = (CIconHandle ) GetCIcon( theId ) ;
|
CIconHandle theIcon = (CIconHandle ) GetCIcon( theId ) ;
|
||||||
if ( theIcon )
|
if ( theIcon )
|
||||||
{
|
{
|
||||||
M_BITMAPHANDLERDATA->m_hIcon = theIcon ;
|
M_BITMAPHANDLERDATA->m_hIcon = theIcon ;
|
||||||
M_BITMAPHANDLERDATA->m_width = 32 ;
|
M_BITMAPHANDLERDATA->m_width = 32 ;
|
||||||
M_BITMAPHANDLERDATA->m_height = 32 ;
|
M_BITMAPHANDLERDATA->m_height = 32 ;
|
||||||
|
|
||||||
M_BITMAPHANDLERDATA->m_depth = 8 ;
|
M_BITMAPHANDLERDATA->m_depth = 8 ;
|
||||||
M_BITMAPHANDLERDATA->m_ok = true ;
|
M_BITMAPHANDLERDATA->m_ok = true ;
|
||||||
M_BITMAPHANDLERDATA->m_numColors = 256 ;
|
M_BITMAPHANDLERDATA->m_numColors = 256 ;
|
||||||
M_BITMAPHANDLERDATA->m_bitmapType = kMacBitmapTypeIcon ;
|
M_BITMAPHANDLERDATA->m_bitmapType = kMacBitmapTypeIcon ;
|
||||||
return TRUE ;
|
return TRUE ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return FALSE ;
|
return FALSE ;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -282,5 +282,5 @@ bool wxJoystick::ReleaseCapture()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// wxUSE_JOYSTICK
|
// wxUSE_JOYSTICK
|
||||||
|
|
||||||
|
|||||||
@@ -24,11 +24,11 @@
|
|||||||
#include "wx/utils.h"
|
#include "wx/utils.h"
|
||||||
|
|
||||||
#if !USE_SHARED_LIBRARY
|
#if !USE_SHARED_LIBRARY
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxListBox, wxControl)
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxListBox, wxControl)
|
BEGIN_EVENT_TABLE(wxListBox, wxControl)
|
||||||
EVT_SIZE( wxListBox::OnSize )
|
EVT_SIZE( wxListBox::OnSize )
|
||||||
EVT_CHAR( wxListBox::OnChar )
|
EVT_CHAR( wxListBox::OnChar )
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -43,8 +43,8 @@ END_EVENT_TABLE()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
unsigned short instruction;
|
unsigned short instruction;
|
||||||
void (*function)();
|
void (*function)();
|
||||||
} ldefRec, *ldefPtr, **ldefHandle;
|
} ldefRec, *ldefPtr, **ldefHandle;
|
||||||
|
|
||||||
#if PRAGMA_STRUCT_ALIGN
|
#if PRAGMA_STRUCT_ALIGN
|
||||||
@@ -77,22 +77,22 @@ static pascal void wxMacListDefinition( short message, Boolean isSelected, Rect
|
|||||||
RgnHandle savedClipRegion;
|
RgnHandle savedClipRegion;
|
||||||
SInt32 savedPenMode;
|
SInt32 savedPenMode;
|
||||||
wxListBox* list;
|
wxListBox* list;
|
||||||
GetPort(&savePort);
|
GetPort(&savePort);
|
||||||
SetPort((**listHandle).port);
|
SetPort((**listHandle).port);
|
||||||
grafPtr = (**listHandle).port ;
|
grafPtr = (**listHandle).port ;
|
||||||
// typecast our refCon
|
// typecast our refCon
|
||||||
list = (wxListBox*) GetControlReference( (ControlHandle) GetListRefCon(listHandle) );
|
list = (wxListBox*) GetControlReference( (ControlHandle) GetListRefCon(listHandle) );
|
||||||
|
|
||||||
// Calculate the cell rect.
|
// Calculate the cell rect.
|
||||||
|
|
||||||
switch( message ) {
|
switch( message ) {
|
||||||
case lInitMsg:
|
case lInitMsg:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case lCloseMsg:
|
case lCloseMsg:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case lDrawMsg:
|
case lDrawMsg:
|
||||||
{
|
{
|
||||||
const wxString text = list->m_stringArray[cell.v] ;
|
const wxString text = list->m_stringArray[cell.v] ;
|
||||||
|
|
||||||
@@ -105,47 +105,47 @@ static pascal void wxMacListDefinition( short message, Boolean isSelected, Rect
|
|||||||
ClipRect( drawRect );
|
ClipRect( drawRect );
|
||||||
EraseRect( drawRect );
|
EraseRect( drawRect );
|
||||||
|
|
||||||
wxFontRefData * font = (wxFontRefData*) list->GetFont().GetRefData() ;
|
wxFontRefData * font = (wxFontRefData*) list->GetFont().GetRefData() ;
|
||||||
|
|
||||||
if ( font )
|
if ( font )
|
||||||
{
|
{
|
||||||
::TextFont( font->m_macFontNum ) ;
|
::TextFont( font->m_macFontNum ) ;
|
||||||
::TextSize( short(font->m_macFontSize) ) ;
|
::TextSize( short(font->m_macFontSize) ) ;
|
||||||
::TextFace( font->m_macFontStyle ) ;
|
::TextFace( font->m_macFontStyle ) ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
::TextFont( kFontIDMonaco ) ;
|
::TextFont( kFontIDMonaco ) ;
|
||||||
::TextSize( 9 );
|
::TextSize( 9 );
|
||||||
::TextFace( 0 ) ;
|
::TextFace( 0 ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
bool useDrawThemeText = ( DrawThemeTextBox != (void*) kUnresolvedCFragSymbolAddress ) ;
|
bool useDrawThemeText = ( DrawThemeTextBox != (void*) kUnresolvedCFragSymbolAddress ) ;
|
||||||
|
|
||||||
if ( useDrawThemeText )
|
if ( useDrawThemeText )
|
||||||
{
|
{
|
||||||
Rect frame = { drawRect->top, drawRect->left + 4,
|
Rect frame = { drawRect->top, drawRect->left + 4,
|
||||||
drawRect->top + kwxMacListItemHeight, drawRect->right + 10000 } ;
|
drawRect->top + kwxMacListItemHeight, drawRect->right + 10000 } ;
|
||||||
CFStringRef sString = CFStringCreateWithBytes( NULL , (UInt8*) text.c_str(), text.Length(), CFStringGetSystemEncoding(), false ) ;
|
CFStringRef sString = CFStringCreateWithBytes( NULL , (UInt8*) text.c_str(), text.Length(), CFStringGetSystemEncoding(), false ) ;
|
||||||
CFMutableStringRef mString = CFStringCreateMutableCopy( NULL , 0 , sString ) ;
|
CFMutableStringRef mString = CFStringCreateMutableCopy( NULL , 0 , sString ) ;
|
||||||
CFRelease( sString ) ;
|
CFRelease( sString ) ;
|
||||||
::TruncateThemeText( mString , kThemeCurrentPortFont, kThemeStateActive, drawRect->right - drawRect->left , truncEnd , NULL ) ;
|
::TruncateThemeText( mString , kThemeCurrentPortFont, kThemeStateActive, drawRect->right - drawRect->left , truncEnd , NULL ) ;
|
||||||
::DrawThemeTextBox( mString,
|
::DrawThemeTextBox( mString,
|
||||||
kThemeCurrentPortFont,
|
kThemeCurrentPortFont,
|
||||||
kThemeStateActive,
|
kThemeStateActive,
|
||||||
false,
|
false,
|
||||||
&frame,
|
&frame,
|
||||||
teJustLeft,
|
teJustLeft,
|
||||||
nil );
|
nil );
|
||||||
CFRelease( mString ) ;
|
CFRelease( mString ) ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
MoveTo(drawRect->left + 4 , drawRect->top + 10 );
|
MoveTo(drawRect->left + 4 , drawRect->top + 10 );
|
||||||
DrawText(text, 0 , text.Length());
|
DrawText(text, 0 , text.Length());
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the cell is hilited, do the hilite now. Paint the cell contents with the
|
// If the cell is hilited, do the hilite now. Paint the cell contents with the
|
||||||
// appropriate QuickDraw transform mode.
|
// appropriate QuickDraw transform mode.
|
||||||
@@ -161,21 +161,21 @@ static pascal void wxMacListDefinition( short message, Boolean isSelected, Rect
|
|||||||
|
|
||||||
SetClip( savedClipRegion );
|
SetClip( savedClipRegion );
|
||||||
DisposeRgn( savedClipRegion );
|
DisposeRgn( savedClipRegion );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case lHiliteMsg:
|
case lHiliteMsg:
|
||||||
|
|
||||||
// Hilite or unhilite the cell. Paint the cell contents with the
|
// Hilite or unhilite the cell. Paint the cell contents with the
|
||||||
// appropriate QuickDraw transform mode.
|
// appropriate QuickDraw transform mode.
|
||||||
|
|
||||||
GetPort( &grafPtr );
|
GetPort( &grafPtr );
|
||||||
savedPenMode = GetPortPenMode( (CGrafPtr)grafPtr );
|
savedPenMode = GetPortPenMode( (CGrafPtr)grafPtr );
|
||||||
SetPortPenMode( (CGrafPtr)grafPtr, hilitetransfermode );
|
SetPortPenMode( (CGrafPtr)grafPtr, hilitetransfermode );
|
||||||
PaintRect( drawRect );
|
PaintRect( drawRect );
|
||||||
SetPortPenMode( (CGrafPtr)grafPtr, savedPenMode );
|
SetPortPenMode( (CGrafPtr)grafPtr, savedPenMode );
|
||||||
break;
|
break;
|
||||||
default :
|
default :
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
SetPort(savePort);
|
SetPort(savePort);
|
||||||
}
|
}
|
||||||
@@ -219,20 +219,20 @@ bool wxListBox::Create(wxWindow *parent, wxWindowID id,
|
|||||||
listDef.defType = kListDefUserProcType;
|
listDef.defType = kListDefUserProcType;
|
||||||
if ( macListDefUPP == NULL )
|
if ( macListDefUPP == NULL )
|
||||||
{
|
{
|
||||||
macListDefUPP = NewListDefUPP( wxMacListDefinition );
|
macListDefUPP = NewListDefUPP( wxMacListDefinition );
|
||||||
}
|
}
|
||||||
listDef.u.userProc = macListDefUPP ;
|
listDef.u.userProc = macListDefUPP ;
|
||||||
|
|
||||||
Str255 fontName ;
|
Str255 fontName ;
|
||||||
SInt16 fontSize ;
|
SInt16 fontSize ;
|
||||||
Style fontStyle ;
|
Style fontStyle ;
|
||||||
SInt16 fontNum ;
|
SInt16 fontNum ;
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
GetThemeFont(kThemeViewsFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ;
|
GetThemeFont(kThemeViewsFont , GetApplicationScript() , fontName , &fontSize , &fontStyle ) ;
|
||||||
#else
|
#else
|
||||||
GetFontName( kFontIDMonaco , fontName ) ;
|
GetFontName( kFontIDMonaco , fontName ) ;
|
||||||
fontSize = 9 ;
|
fontSize = 9 ;
|
||||||
fontStyle = normal ;
|
fontStyle = normal ;
|
||||||
#endif
|
#endif
|
||||||
CopyPascalStringToC( fontName , (char*) fontName ) ;
|
CopyPascalStringToC( fontName , (char*) fontName ) ;
|
||||||
SetFont( wxFont (fontSize, wxSWISS, wxNORMAL, wxNORMAL , false , fontName ) ) ;
|
SetFont( wxFont (fontSize, wxSWISS, wxNORMAL, wxNORMAL , false , fontName ) ) ;
|
||||||
@@ -307,8 +307,8 @@ wxListBox::~wxListBox()
|
|||||||
if ( m_macList )
|
if ( m_macList )
|
||||||
{
|
{
|
||||||
#if !TARGET_CARBON
|
#if !TARGET_CARBON
|
||||||
DisposeHandle( (**(ListHandle)m_macList).listDefProc ) ;
|
DisposeHandle( (**(ListHandle)m_macList).listDefProc ) ;
|
||||||
(**(ListHandle)m_macList).listDefProc = NULL ;
|
(**(ListHandle)m_macList).listDefProc = NULL ;
|
||||||
#endif
|
#endif
|
||||||
m_macList = NULL ;
|
m_macList = NULL ;
|
||||||
}
|
}
|
||||||
@@ -406,24 +406,24 @@ int wxListBox::DoAppend(const wxString& item)
|
|||||||
|
|
||||||
void wxListBox::DoSetItems(const wxArrayString& choices, void** clientData)
|
void wxListBox::DoSetItems(const wxArrayString& choices, void** clientData)
|
||||||
{
|
{
|
||||||
MacSetRedraw( false ) ;
|
MacSetRedraw( false ) ;
|
||||||
Clear() ;
|
Clear() ;
|
||||||
int n = choices.GetCount();
|
int n = choices.GetCount();
|
||||||
|
|
||||||
for( int i = 0 ; i < n ; ++i )
|
for( int i = 0 ; i < n ; ++i )
|
||||||
{
|
|
||||||
if ( clientData )
|
|
||||||
{
|
{
|
||||||
|
if ( clientData )
|
||||||
|
{
|
||||||
#if wxUSE_OWNER_DRAWN
|
#if wxUSE_OWNER_DRAWN
|
||||||
wxASSERT_MSG(clientData[i] == NULL,
|
wxASSERT_MSG(clientData[i] == NULL,
|
||||||
wxT("Can't use client data with owner-drawn listboxes"));
|
wxT("Can't use client data with owner-drawn listboxes"));
|
||||||
#else // !wxUSE_OWNER_DRAWN
|
#else // !wxUSE_OWNER_DRAWN
|
||||||
Append( choices[i] , clientData[i] ) ;
|
Append( choices[i] , clientData[i] ) ;
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Append( choices[i] ) ;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
Append( choices[i] ) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if wxUSE_OWNER_DRAWN
|
#if wxUSE_OWNER_DRAWN
|
||||||
if ( m_windowStyle & wxLB_OWNERDRAW ) {
|
if ( m_windowStyle & wxLB_OWNERDRAW ) {
|
||||||
@@ -443,7 +443,7 @@ void wxListBox::DoSetItems(const wxArrayString& choices, void** clientData)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // wxUSE_OWNER_DRAWN
|
#endif // wxUSE_OWNER_DRAWN
|
||||||
MacSetRedraw( true ) ;
|
MacSetRedraw( true ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxListBox::HasMultipleSelection() const
|
bool wxListBox::HasMultipleSelection() const
|
||||||
@@ -519,39 +519,39 @@ int wxListBox::FindString(const wxString& st) const
|
|||||||
if ( EqualString( s1 , s2 , false , false ) )
|
if ( EqualString( s1 , s2 , false , false ) )
|
||||||
return i ;
|
return i ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxListBox::Clear()
|
void wxListBox::Clear()
|
||||||
{
|
{
|
||||||
FreeData();
|
FreeData();
|
||||||
m_noItems = 0;
|
m_noItems = 0;
|
||||||
m_stringArray.Empty() ;
|
m_stringArray.Empty() ;
|
||||||
m_dataArray.Empty() ;
|
m_dataArray.Empty() ;
|
||||||
MacClear() ;
|
MacClear() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxListBox::SetSelection(int N, bool select)
|
void wxListBox::SetSelection(int N, bool select)
|
||||||
{
|
{
|
||||||
wxCHECK_RET( N >= 0 && N < m_noItems,
|
wxCHECK_RET( N >= 0 && N < m_noItems,
|
||||||
"invalid index in wxListBox::SetSelection" );
|
"invalid index in wxListBox::SetSelection" );
|
||||||
MacSetSelection( N , select ) ;
|
MacSetSelection( N , select ) ;
|
||||||
GetSelections( m_selectionPreImage ) ;
|
GetSelections( m_selectionPreImage ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxListBox::IsSelected(int N) const
|
bool wxListBox::IsSelected(int N) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( N >= 0 && N < m_noItems, FALSE,
|
wxCHECK_MSG( N >= 0 && N < m_noItems, FALSE,
|
||||||
"invalid index in wxListBox::Selected" );
|
"invalid index in wxListBox::Selected" );
|
||||||
|
|
||||||
return MacIsSelected( N ) ;
|
return MacIsSelected( N ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *wxListBox::DoGetItemClientData(int N) const
|
void *wxListBox::DoGetItemClientData(int N) const
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( N >= 0 && N < m_noItems, NULL,
|
wxCHECK_MSG( N >= 0 && N < m_noItems, NULL,
|
||||||
wxT("invalid index in wxListBox::GetClientData"));
|
wxT("invalid index in wxListBox::GetClientData"));
|
||||||
|
|
||||||
return (void *)m_dataArray[N];
|
return (void *)m_dataArray[N];
|
||||||
}
|
}
|
||||||
@@ -564,7 +564,7 @@ wxClientData *wxListBox::DoGetItemClientObject(int N) const
|
|||||||
void wxListBox::DoSetItemClientData(int N, void *Client_data)
|
void wxListBox::DoSetItemClientData(int N, void *Client_data)
|
||||||
{
|
{
|
||||||
wxCHECK_RET( N >= 0 && N < m_noItems,
|
wxCHECK_RET( N >= 0 && N < m_noItems,
|
||||||
"invalid index in wxListBox::SetClientData" );
|
"invalid index in wxListBox::SetClientData" );
|
||||||
|
|
||||||
#if wxUSE_OWNER_DRAWN
|
#if wxUSE_OWNER_DRAWN
|
||||||
if ( m_windowStyle & wxLB_OWNERDRAW )
|
if ( m_windowStyle & wxLB_OWNERDRAW )
|
||||||
@@ -617,7 +617,7 @@ wxString wxListBox::GetString(int N) const
|
|||||||
void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
|
void wxListBox::DoInsertItems(const wxArrayString& items, int pos)
|
||||||
{
|
{
|
||||||
wxCHECK_RET( pos >= 0 && pos <= m_noItems,
|
wxCHECK_RET( pos >= 0 && pos <= m_noItems,
|
||||||
wxT("invalid index in wxListBox::InsertItems") );
|
wxT("invalid index in wxListBox::InsertItems") );
|
||||||
|
|
||||||
int nItems = items.GetCount();
|
int nItems = items.GetCount();
|
||||||
|
|
||||||
@@ -650,43 +650,43 @@ wxSize wxListBox::DoGetBestSize() const
|
|||||||
int lbHeight = 110;
|
int lbHeight = 110;
|
||||||
int wLine;
|
int wLine;
|
||||||
|
|
||||||
{
|
{
|
||||||
wxMacPortStateHelper st( UMAGetWindowPort( (WindowRef) MacGetRootWindow() ) ) ;
|
wxMacPortStateHelper st( UMAGetWindowPort( (WindowRef) MacGetRootWindow() ) ) ;
|
||||||
|
|
||||||
wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ;
|
wxFontRefData * font = (wxFontRefData*) m_font.GetRefData() ;
|
||||||
|
|
||||||
if ( font )
|
if ( font )
|
||||||
{
|
{
|
||||||
::TextFont( font->m_macFontNum ) ;
|
::TextFont( font->m_macFontNum ) ;
|
||||||
::TextSize( short(font->m_macFontSize) ) ;
|
::TextSize( short(font->m_macFontSize) ) ;
|
||||||
::TextFace( font->m_macFontStyle ) ;
|
::TextFace( font->m_macFontStyle ) ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
::TextFont( kFontIDMonaco ) ;
|
::TextFont( kFontIDMonaco ) ;
|
||||||
::TextSize( 9 );
|
::TextSize( 9 );
|
||||||
::TextFace( 0 ) ;
|
::TextFace( 0 ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the widest line
|
// Find the widest line
|
||||||
for(int i = 0; i < GetCount(); i++) {
|
for(int i = 0; i < GetCount(); i++) {
|
||||||
wxString str(GetString(i));
|
wxString str(GetString(i));
|
||||||
wLine = ::TextWidth( str.c_str() , 0 , str.Length() ) ;
|
wLine = ::TextWidth( str.c_str() , 0 , str.Length() ) ;
|
||||||
lbWidth = wxMax(lbWidth, wLine);
|
lbWidth = wxMax(lbWidth, wLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add room for the scrollbar
|
// Add room for the scrollbar
|
||||||
lbWidth += wxSystemSettings::GetMetric(wxSYS_VSCROLL_X);
|
lbWidth += wxSystemSettings::GetMetric(wxSYS_VSCROLL_X);
|
||||||
|
|
||||||
// And just a bit more
|
// And just a bit more
|
||||||
int cy = 12 ;
|
int cy = 12 ;
|
||||||
int cx = ::TextWidth( "X" , 0 , 1 ) ;
|
int cx = ::TextWidth( "X" , 0 , 1 ) ;
|
||||||
lbWidth += cx ;
|
lbWidth += cx ;
|
||||||
|
|
||||||
// don't make the listbox too tall (limit height to around 10 items) but don't
|
// don't make the listbox too tall (limit height to around 10 items) but don't
|
||||||
// make it too small neither
|
// make it too small neither
|
||||||
lbHeight = (cy+4) * wxMin(wxMax(GetCount(), 3), 10);
|
lbHeight = (cy+4) * wxMin(wxMax(GetCount(), 3), 10);
|
||||||
}
|
}
|
||||||
return wxSize(lbWidth, lbHeight);
|
return wxSize(lbWidth, lbHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -704,7 +704,7 @@ void wxListBox::SetupColours()
|
|||||||
void wxListBox::Refresh(bool eraseBack, const wxRect *rect)
|
void wxListBox::Refresh(bool eraseBack, const wxRect *rect)
|
||||||
{
|
{
|
||||||
wxControl::Refresh( eraseBack , rect ) ;
|
wxControl::Refresh( eraseBack , rect ) ;
|
||||||
// MacRedrawControl() ;
|
// MacRedrawControl() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if wxUSE_OWNER_DRAWN
|
#if wxUSE_OWNER_DRAWN
|
||||||
@@ -735,18 +735,18 @@ wxOwnerDrawn *wxListBox::CreateItem(size_t n)
|
|||||||
/*
|
/*
|
||||||
void MacDrawStringCell(Rect *cellRect, Cell lCell, ListHandle theList, long refCon)
|
void MacDrawStringCell(Rect *cellRect, Cell lCell, ListHandle theList, long refCon)
|
||||||
{
|
{
|
||||||
wxListBox* list;
|
wxListBox* list;
|
||||||
// typecast our refCon
|
// typecast our refCon
|
||||||
list = (wxListBox*)refCon;
|
list = (wxListBox*)refCon;
|
||||||
|
|
||||||
MoveTo(cellRect->left + 4 , cellRect->top + 10 );
|
MoveTo(cellRect->left + 4 , cellRect->top + 10 );
|
||||||
const wxString text = list->m_stringArray[lCell.v] ;
|
const wxString text = list->m_stringArray[lCell.v] ;
|
||||||
::TextFont( kFontIDMonaco ) ;
|
::TextFont( kFontIDMonaco ) ;
|
||||||
::TextSize( 9 );
|
::TextSize( 9 );
|
||||||
::TextFace( 0 ) ;
|
::TextFace( 0 ) ;
|
||||||
DrawText(text, 0 , text.Length());
|
DrawText(text, 0 , text.Length());
|
||||||
|
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
void wxListBox::MacDelete( int N )
|
void wxListBox::MacDelete( int N )
|
||||||
{
|
{
|
||||||
@@ -759,7 +759,7 @@ void wxListBox::MacInsert( int n , const char * text)
|
|||||||
Cell cell = { 0 , 0 } ;
|
Cell cell = { 0 , 0 } ;
|
||||||
cell.v = n ;
|
cell.v = n ;
|
||||||
LAddRow( 1 , cell.v , (ListHandle)m_macList ) ;
|
LAddRow( 1 , cell.v , (ListHandle)m_macList ) ;
|
||||||
// LSetCell(text, strlen(text), cell, m_macList);
|
// LSetCell(text, strlen(text), cell, m_macList);
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -768,7 +768,7 @@ void wxListBox::MacAppend( const char * text)
|
|||||||
Cell cell = { 0 , 0 } ;
|
Cell cell = { 0 , 0 } ;
|
||||||
cell.v = (**(ListHandle)m_macList).dataBounds.bottom ;
|
cell.v = (**(ListHandle)m_macList).dataBounds.bottom ;
|
||||||
LAddRow( 1 , cell.v , (ListHandle)m_macList ) ;
|
LAddRow( 1 , cell.v , (ListHandle)m_macList ) ;
|
||||||
// LSetCell(text, strlen(text), cell, m_macList);
|
// LSetCell(text, strlen(text), cell, m_macList);
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -804,7 +804,7 @@ bool wxListBox::MacIsSelected( int n ) const
|
|||||||
|
|
||||||
void wxListBox::MacDestroy()
|
void wxListBox::MacDestroy()
|
||||||
{
|
{
|
||||||
// DisposeExtLDEFInfo( m_macList ) ;
|
// DisposeExtLDEFInfo( m_macList ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxListBox::MacGetSelection() const
|
int wxListBox::MacGetSelection() const
|
||||||
@@ -840,7 +840,7 @@ void wxListBox::MacSet( int n , const char * text )
|
|||||||
// so we just have to redraw
|
// so we just have to redraw
|
||||||
Cell cell = { 0 , 0 } ;
|
Cell cell = { 0 , 0 } ;
|
||||||
cell.v = n ;
|
cell.v = n ;
|
||||||
// LSetCell(text, strlen(text), cell, m_macList);
|
// LSetCell(text, strlen(text), cell, m_macList);
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -923,7 +923,7 @@ void wxListBox::MacDoClick()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
n = -1;
|
n = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
event.m_commandInt = n;
|
event.m_commandInt = n;
|
||||||
@@ -935,35 +935,35 @@ void wxListBox::MacDoDoubleClick()
|
|||||||
{
|
{
|
||||||
wxCommandEvent event(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, m_windowId);
|
wxCommandEvent event(wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, m_windowId);
|
||||||
event.SetEventObject( this );
|
event.SetEventObject( this );
|
||||||
GetEventHandler()->ProcessEvent(event) ;
|
GetEventHandler()->ProcessEvent(event) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxListBox::OnChar(wxKeyEvent& event)
|
void wxListBox::OnChar(wxKeyEvent& event)
|
||||||
{
|
{
|
||||||
if ( event.GetKeyCode() == WXK_RETURN || event.GetKeyCode() == WXK_NUMPAD_ENTER)
|
if ( event.GetKeyCode() == WXK_RETURN || event.GetKeyCode() == WXK_NUMPAD_ENTER)
|
||||||
{
|
{
|
||||||
wxWindow* parent = GetParent() ;
|
wxWindow* parent = GetParent() ;
|
||||||
while( parent && !parent->IsTopLevel() && parent->GetDefaultItem() == NULL )
|
while( parent && !parent->IsTopLevel() && parent->GetDefaultItem() == NULL )
|
||||||
parent = parent->GetParent() ;
|
parent = parent->GetParent() ;
|
||||||
|
|
||||||
if ( parent && parent->GetDefaultItem() )
|
if ( parent && parent->GetDefaultItem() )
|
||||||
{
|
{
|
||||||
wxButton *def = wxDynamicCast(parent->GetDefaultItem(),
|
wxButton *def = wxDynamicCast(parent->GetDefaultItem(),
|
||||||
wxButton);
|
wxButton);
|
||||||
if ( def && def->IsEnabled() )
|
if ( def && def->IsEnabled() )
|
||||||
{
|
{
|
||||||
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, def->GetId() );
|
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, def->GetId() );
|
||||||
event.SetEventObject(def);
|
event.SetEventObject(def);
|
||||||
def->Command(event);
|
def->Command(event);
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
event.Skip() ;
|
event.Skip() ;
|
||||||
}
|
}
|
||||||
/* generate wxID_CANCEL if command-. or <esc> has been pressed (typically in dialogs) */
|
/* generate wxID_CANCEL if command-. or <esc> has been pressed (typically in dialogs) */
|
||||||
else if (event.GetKeyCode() == WXK_ESCAPE || (event.GetKeyCode() == '.' && event.MetaDown() ) )
|
else if (event.GetKeyCode() == WXK_ESCAPE || (event.GetKeyCode() == '.' && event.MetaDown() ) )
|
||||||
{
|
{
|
||||||
wxWindow* win = GetParent()->FindWindow( wxID_CANCEL ) ;
|
wxWindow* win = GetParent()->FindWindow( wxID_CANCEL ) ;
|
||||||
wxCommandEvent new_event(wxEVT_COMMAND_BUTTON_CLICKED,wxID_CANCEL);
|
wxCommandEvent new_event(wxEVT_COMMAND_BUTTON_CLICKED,wxID_CANCEL);
|
||||||
new_event.SetEventObject( win );
|
new_event.SetEventObject( win );
|
||||||
win->GetEventHandler()->ProcessEvent( new_event );
|
win->GetEventHandler()->ProcessEvent( new_event );
|
||||||
@@ -977,12 +977,12 @@ void wxListBox::OnChar(wxKeyEvent& event)
|
|||||||
new_event.SetWindowChange( event.ControlDown() );
|
new_event.SetWindowChange( event.ControlDown() );
|
||||||
new_event.SetCurrentFocus( this );
|
new_event.SetCurrentFocus( this );
|
||||||
if ( !GetEventHandler()->ProcessEvent( new_event ) )
|
if ( !GetEventHandler()->ProcessEvent( new_event ) )
|
||||||
event.Skip() ;
|
event.Skip() ;
|
||||||
}
|
}
|
||||||
else if ( event.GetKeyCode() == WXK_DOWN || event.GetKeyCode() == WXK_UP )
|
else if ( event.GetKeyCode() == WXK_DOWN || event.GetKeyCode() == WXK_UP )
|
||||||
{
|
{
|
||||||
// perform the default key handling first
|
// perform the default key handling first
|
||||||
wxControl::OnKeyDown( event ) ;
|
wxControl::OnKeyDown( event ) ;
|
||||||
|
|
||||||
wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, m_windowId);
|
wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, m_windowId);
|
||||||
event.SetEventObject( this );
|
event.SetEventObject( this );
|
||||||
@@ -991,50 +991,50 @@ void wxListBox::OnChar(wxKeyEvent& event)
|
|||||||
int n, count = GetSelections(aSelections);
|
int n, count = GetSelections(aSelections);
|
||||||
if ( count > 0 )
|
if ( count > 0 )
|
||||||
{
|
{
|
||||||
n = aSelections[0];
|
n = aSelections[0];
|
||||||
if ( HasClientObjectData() )
|
if ( HasClientObjectData() )
|
||||||
event.SetClientObject( GetClientObject(n) );
|
event.SetClientObject( GetClientObject(n) );
|
||||||
else if ( HasClientUntypedData() )
|
else if ( HasClientUntypedData() )
|
||||||
event.SetClientData( GetClientData(n) );
|
event.SetClientData( GetClientData(n) );
|
||||||
event.SetString( GetString(n) );
|
event.SetString( GetString(n) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
n = -1;
|
n = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
event.m_commandInt = n;
|
event.m_commandInt = n;
|
||||||
|
|
||||||
GetEventHandler()->ProcessEvent(event);
|
GetEventHandler()->ProcessEvent(event);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( event.GetTimestamp() > m_lastTypeIn + 60 )
|
if ( event.GetTimestamp() > m_lastTypeIn + 60 )
|
||||||
{
|
{
|
||||||
m_typeIn = "" ;
|
m_typeIn = "" ;
|
||||||
}
|
}
|
||||||
m_lastTypeIn = event.GetTimestamp() ;
|
m_lastTypeIn = event.GetTimestamp() ;
|
||||||
m_typeIn += (char) event.GetKeyCode() ;
|
m_typeIn += (char) event.GetKeyCode() ;
|
||||||
int line = FindString("*"+m_typeIn+"*") ;
|
int line = FindString("*"+m_typeIn+"*") ;
|
||||||
if ( line >= 0 )
|
if ( line >= 0 )
|
||||||
{
|
{
|
||||||
if ( GetSelection() != line )
|
if ( GetSelection() != line )
|
||||||
{
|
{
|
||||||
SetSelection(line) ;
|
SetSelection(line) ;
|
||||||
wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, m_windowId);
|
wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, m_windowId);
|
||||||
event.SetEventObject( this );
|
event.SetEventObject( this );
|
||||||
|
|
||||||
if ( HasClientObjectData() )
|
if ( HasClientObjectData() )
|
||||||
event.SetClientObject( GetClientObject( line ) );
|
event.SetClientObject( GetClientObject( line ) );
|
||||||
else if ( HasClientUntypedData() )
|
else if ( HasClientUntypedData() )
|
||||||
event.SetClientData( GetClientData(line) );
|
event.SetClientData( GetClientData(line) );
|
||||||
event.SetString( GetString(line) );
|
event.SetString( GetString(line) );
|
||||||
|
|
||||||
event.m_commandInt = line ;
|
event.m_commandInt = line ;
|
||||||
|
|
||||||
GetEventHandler()->ProcessEvent(event);
|
GetEventHandler()->ProcessEvent(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,12 +17,12 @@ const short kMaxEvents = 1000 ;
|
|||||||
|
|
||||||
struct wxMacNotificationEvents
|
struct wxMacNotificationEvents
|
||||||
{
|
{
|
||||||
short top ;
|
short top ;
|
||||||
short bottom ;
|
short bottom ;
|
||||||
|
|
||||||
wxMacNotificationProcPtr proc[kMaxEvents] ;
|
wxMacNotificationProcPtr proc[kMaxEvents] ;
|
||||||
unsigned long events[kMaxEvents] ;
|
unsigned long events[kMaxEvents] ;
|
||||||
void* data[kMaxEvents] ;
|
void* data[kMaxEvents] ;
|
||||||
} ;
|
} ;
|
||||||
|
|
||||||
typedef struct wxMacNotificationEvents wxMacNotificationEvents ;
|
typedef struct wxMacNotificationEvents wxMacNotificationEvents ;
|
||||||
@@ -32,43 +32,43 @@ ProcessSerialNumber gAppProcess ;
|
|||||||
|
|
||||||
void wxMacWakeUp()
|
void wxMacWakeUp()
|
||||||
{
|
{
|
||||||
ProcessSerialNumber psn ;
|
ProcessSerialNumber psn ;
|
||||||
Boolean isSame ;
|
Boolean isSame ;
|
||||||
psn.highLongOfPSN = 0 ;
|
psn.highLongOfPSN = 0 ;
|
||||||
psn.lowLongOfPSN = kCurrentProcess ;
|
psn.lowLongOfPSN = kCurrentProcess ;
|
||||||
SameProcess( &gAppProcess , &psn , &isSame ) ;
|
SameProcess( &gAppProcess , &psn , &isSame ) ;
|
||||||
if ( isSame )
|
if ( isSame )
|
||||||
{
|
{
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
EventRef dummyEvent ;
|
EventRef dummyEvent ;
|
||||||
OSStatus err = MacCreateEvent(nil, 'WXMC', 'WXMC', GetCurrentEventTime(),
|
OSStatus err = MacCreateEvent(nil, 'WXMC', 'WXMC', GetCurrentEventTime(),
|
||||||
kEventAttributeNone, &dummyEvent);
|
kEventAttributeNone, &dummyEvent);
|
||||||
if (err == noErr)
|
if (err == noErr)
|
||||||
{
|
{
|
||||||
err = PostEventToQueue(GetMainEventQueue(), dummyEvent,
|
err = PostEventToQueue(GetMainEventQueue(), dummyEvent,
|
||||||
kEventPriorityHigh);
|
kEventPriorityHigh);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
PostEvent( nullEvent , 0 ) ;
|
PostEvent( nullEvent , 0 ) ;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WakeUpProcess( &gAppProcess ) ;
|
WakeUpProcess( &gAppProcess ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMacCreateNotifierTable()
|
void wxMacCreateNotifierTable()
|
||||||
{
|
{
|
||||||
GetCurrentProcess(&gAppProcess);
|
GetCurrentProcess(&gAppProcess);
|
||||||
gMacNotificationEvents.top = 0 ;
|
gMacNotificationEvents.top = 0 ;
|
||||||
gMacNotificationEvents.bottom = 0 ;
|
gMacNotificationEvents.bottom = 0 ;
|
||||||
for ( int i = 0 ; i < kMaxEvents ; ++i )
|
for ( int i = 0 ; i < kMaxEvents ; ++i )
|
||||||
{
|
{
|
||||||
gMacNotificationEvents.proc[i] = NULL ;
|
gMacNotificationEvents.proc[i] = NULL ;
|
||||||
gMacNotificationEvents.events[i] = NULL ;
|
gMacNotificationEvents.events[i] = NULL ;
|
||||||
gMacNotificationEvents.data[i] = NULL ;
|
gMacNotificationEvents.data[i] = NULL ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMacDestroyNotifierTable()
|
void wxMacDestroyNotifierTable()
|
||||||
@@ -77,86 +77,86 @@ void wxMacDestroyNotifierTable()
|
|||||||
|
|
||||||
wxMacNotifierTableRef wxMacGetNotifierTable()
|
wxMacNotifierTableRef wxMacGetNotifierTable()
|
||||||
{
|
{
|
||||||
return (wxMacNotifierTableRef) &gMacNotificationEvents ;
|
return (wxMacNotifierTableRef) &gMacNotificationEvents ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMacAddEvent(
|
void wxMacAddEvent(
|
||||||
wxMacNotifierTableRef table ,
|
wxMacNotifierTableRef table ,
|
||||||
wxMacNotificationProcPtr handler ,
|
wxMacNotificationProcPtr handler ,
|
||||||
unsigned long event ,
|
unsigned long event ,
|
||||||
void* data ,
|
void* data ,
|
||||||
short wakeUp )
|
short wakeUp )
|
||||||
{
|
{
|
||||||
wxMacNotificationEvents *e = (wxMacNotificationEvents *) table ;
|
wxMacNotificationEvents *e = (wxMacNotificationEvents *) table ;
|
||||||
wxASSERT_MSG( handler != NULL , "illegal notification proc ptr" ) ;
|
wxASSERT_MSG( handler != NULL , "illegal notification proc ptr" ) ;
|
||||||
/* this should be protected eventually */
|
/* this should be protected eventually */
|
||||||
short index = e->top++ ;
|
short index = e->top++ ;
|
||||||
|
|
||||||
if ( e->top == kMaxEvents )
|
if ( e->top == kMaxEvents )
|
||||||
e->top = 0 ;
|
e->top = 0 ;
|
||||||
|
|
||||||
e->proc[index] = handler ;
|
e->proc[index] = handler ;
|
||||||
e->events[index] = event ;
|
e->events[index] = event ;
|
||||||
e->data[index] = data ;
|
e->data[index] = data ;
|
||||||
if ( wakeUp )
|
if ( wakeUp )
|
||||||
wxMacWakeUp() ;
|
wxMacWakeUp() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool gInProcessing = false ;
|
bool gInProcessing = false ;
|
||||||
|
|
||||||
void wxMacRemoveAllNotifiersForData( wxMacNotifierTableRef table , void* data )
|
void wxMacRemoveAllNotifiersForData( wxMacNotifierTableRef table , void* data )
|
||||||
{
|
{
|
||||||
wxMacNotificationEvents *e = (wxMacNotificationEvents *) table ;
|
wxMacNotificationEvents *e = (wxMacNotificationEvents *) table ;
|
||||||
/* this should be protected eventually */
|
/* this should be protected eventually */
|
||||||
short index = e->bottom ;
|
short index = e->bottom ;
|
||||||
|
|
||||||
while ( e->top != index )
|
while ( e->top != index )
|
||||||
{
|
{
|
||||||
if ( index == kMaxEvents )
|
if ( index == kMaxEvents )
|
||||||
index = 0 ;
|
index = 0 ;
|
||||||
if ( e->data[index] == data )
|
if ( e->data[index] == data )
|
||||||
e->data[index] = NULL ;
|
e->data[index] = NULL ;
|
||||||
index++ ;
|
index++ ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMacProcessNotifierEvents()
|
void wxMacProcessNotifierEvents()
|
||||||
{
|
{
|
||||||
// if ( gInProcessing )
|
// if ( gInProcessing )
|
||||||
// return ;
|
// return ;
|
||||||
|
|
||||||
gInProcessing = true ;
|
gInProcessing = true ;
|
||||||
if ( gMacNotificationEvents.top != gMacNotificationEvents.bottom )
|
if ( gMacNotificationEvents.top != gMacNotificationEvents.bottom )
|
||||||
{
|
|
||||||
// we only should process the notifiers that were here when we entered it
|
|
||||||
// otherwise we might never get out...
|
|
||||||
short count = gMacNotificationEvents.top - gMacNotificationEvents.bottom ;
|
|
||||||
if ( count < 0 )
|
|
||||||
count += kMaxEvents ;
|
|
||||||
|
|
||||||
while ( count-- )
|
|
||||||
{
|
{
|
||||||
// consume event at bottom
|
// we only should process the notifiers that were here when we entered it
|
||||||
short index = gMacNotificationEvents.bottom++ ;
|
// otherwise we might never get out...
|
||||||
if ( gMacNotificationEvents.bottom == kMaxEvents )
|
short count = gMacNotificationEvents.top - gMacNotificationEvents.bottom ;
|
||||||
gMacNotificationEvents.bottom = 0 ;
|
if ( count < 0 )
|
||||||
void* data = gMacNotificationEvents.data[index] ;
|
count += kMaxEvents ;
|
||||||
unsigned long event = gMacNotificationEvents.events[index] ;
|
|
||||||
wxMacNotificationProcPtr handler = gMacNotificationEvents.proc[index] ;
|
|
||||||
|
|
||||||
gMacNotificationEvents.data[index] = NULL ;
|
while ( count-- )
|
||||||
gMacNotificationEvents.events[index] = NULL ;
|
{
|
||||||
gMacNotificationEvents.proc[index] = NULL ;
|
// consume event at bottom
|
||||||
|
short index = gMacNotificationEvents.bottom++ ;
|
||||||
|
if ( gMacNotificationEvents.bottom == kMaxEvents )
|
||||||
|
gMacNotificationEvents.bottom = 0 ;
|
||||||
|
void* data = gMacNotificationEvents.data[index] ;
|
||||||
|
unsigned long event = gMacNotificationEvents.events[index] ;
|
||||||
|
wxMacNotificationProcPtr handler = gMacNotificationEvents.proc[index] ;
|
||||||
|
|
||||||
if ( handler )
|
gMacNotificationEvents.data[index] = NULL ;
|
||||||
handler( event , data ) ;
|
gMacNotificationEvents.events[index] = NULL ;
|
||||||
}
|
gMacNotificationEvents.proc[index] = NULL ;
|
||||||
}
|
|
||||||
gInProcessing = false ;
|
if ( handler )
|
||||||
|
handler( event , data ) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
gInProcessing = false ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMacProcessNotifierAndPendingEvents()
|
void wxMacProcessNotifierAndPendingEvents()
|
||||||
{
|
{
|
||||||
wxMacProcessNotifierEvents() ;
|
wxMacProcessNotifierEvents() ;
|
||||||
wxTheApp->ProcessPendingEvents() ;
|
wxTheApp->ProcessPendingEvents() ;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,13 +6,13 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "wx/app.h"
|
#include "wx/app.h"
|
||||||
|
|
||||||
WXDLLEXPORT int main(int argc, char* argv[])
|
WXDLLEXPORT int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
return wxEntry(argc, argv);
|
return wxEntry(argc, argv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -71,32 +71,32 @@ bool wxMDIParentFrame::Create(wxWindow *parent,
|
|||||||
long style,
|
long style,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
m_clientWindow = NULL;
|
m_clientWindow = NULL;
|
||||||
m_currentChild = NULL;
|
m_currentChild = NULL;
|
||||||
|
|
||||||
// this style can be used to prevent a window from having the standard MDI
|
// this style can be used to prevent a window from having the standard MDI
|
||||||
// "Window" menu
|
// "Window" menu
|
||||||
if ( style & wxFRAME_NO_WINDOW_MENU )
|
if ( style & wxFRAME_NO_WINDOW_MENU )
|
||||||
{
|
{
|
||||||
m_windowMenu = (wxMenu *)NULL;
|
m_windowMenu = (wxMenu *)NULL;
|
||||||
style -= wxFRAME_NO_WINDOW_MENU ;
|
style -= wxFRAME_NO_WINDOW_MENU ;
|
||||||
}
|
}
|
||||||
else // normal case: we have the window menu, so construct it
|
else // normal case: we have the window menu, so construct it
|
||||||
{
|
{
|
||||||
m_windowMenu = new wxMenu;
|
m_windowMenu = new wxMenu;
|
||||||
|
|
||||||
m_windowMenu->Append(IDM_WINDOWCASCADE, wxT("&Cascade"));
|
m_windowMenu->Append(IDM_WINDOWCASCADE, wxT("&Cascade"));
|
||||||
m_windowMenu->Append(IDM_WINDOWTILEHOR, wxT("Tile &Horizontally"));
|
m_windowMenu->Append(IDM_WINDOWTILEHOR, wxT("Tile &Horizontally"));
|
||||||
m_windowMenu->Append(IDM_WINDOWTILEVERT, wxT("Tile &Vertically"));
|
m_windowMenu->Append(IDM_WINDOWTILEVERT, wxT("Tile &Vertically"));
|
||||||
m_windowMenu->AppendSeparator();
|
m_windowMenu->AppendSeparator();
|
||||||
m_windowMenu->Append(IDM_WINDOWICONS, wxT("&Arrange Icons"));
|
m_windowMenu->Append(IDM_WINDOWICONS, wxT("&Arrange Icons"));
|
||||||
m_windowMenu->Append(IDM_WINDOWNEXT, wxT("&Next"));
|
m_windowMenu->Append(IDM_WINDOWNEXT, wxT("&Next"));
|
||||||
}
|
}
|
||||||
|
|
||||||
wxFrame::Create( parent , id , title , wxPoint( 2000 , 2000 ) , size , style , name ) ;
|
wxFrame::Create( parent , id , title , wxPoint( 2000 , 2000 ) , size , style , name ) ;
|
||||||
m_parentFrameActive = TRUE;
|
m_parentFrameActive = TRUE;
|
||||||
|
|
||||||
OnCreateClient();
|
OnCreateClient();
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -126,19 +126,19 @@ wxMDIParentFrame::~wxMDIParentFrame()
|
|||||||
// Get size *available for subwindows* i.e. excluding menu bar.
|
// Get size *available for subwindows* i.e. excluding menu bar.
|
||||||
void wxMDIParentFrame::DoGetClientSize(int *x, int *y) const
|
void wxMDIParentFrame::DoGetClientSize(int *x, int *y) const
|
||||||
{
|
{
|
||||||
wxDisplaySize( x , y ) ;
|
wxDisplaySize( x , y ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMDIParentFrame::SetMenuBar(wxMenuBar *menu_bar)
|
void wxMDIParentFrame::SetMenuBar(wxMenuBar *menu_bar)
|
||||||
{
|
{
|
||||||
wxFrame::SetMenuBar( menu_bar ) ;
|
wxFrame::SetMenuBar( menu_bar ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMDIParentFrame::OnSize(wxSizeEvent& event)
|
void wxMDIParentFrame::OnSize(wxSizeEvent& event)
|
||||||
{
|
{
|
||||||
#if wxUSE_CONSTRAINTS
|
#if wxUSE_CONSTRAINTS
|
||||||
if (GetAutoLayout())
|
if (GetAutoLayout())
|
||||||
Layout();
|
Layout();
|
||||||
#endif
|
#endif
|
||||||
int x = 0;
|
int x = 0;
|
||||||
int y = 0;
|
int y = 0;
|
||||||
@@ -151,26 +151,26 @@ void wxMDIParentFrame::OnSize(wxSizeEvent& event)
|
|||||||
|
|
||||||
void wxMDIParentFrame::OnActivate(wxActivateEvent& event)
|
void wxMDIParentFrame::OnActivate(wxActivateEvent& event)
|
||||||
{
|
{
|
||||||
if ( m_currentChild && event.GetActive() )
|
if ( m_currentChild && event.GetActive() )
|
||||||
{
|
{
|
||||||
wxActivateEvent event(wxEVT_ACTIVATE, TRUE, m_currentChild->GetId());
|
wxActivateEvent event(wxEVT_ACTIVATE, TRUE, m_currentChild->GetId());
|
||||||
event.SetEventObject( m_currentChild );
|
event.SetEventObject( m_currentChild );
|
||||||
m_currentChild->GetEventHandler()->ProcessEvent(event) ;
|
m_currentChild->GetEventHandler()->ProcessEvent(event) ;
|
||||||
}
|
}
|
||||||
else if ( event.GetActive() )
|
else if ( event.GetActive() )
|
||||||
{
|
{
|
||||||
if ( m_frameMenuBar != NULL )
|
if ( m_frameMenuBar != NULL )
|
||||||
{
|
{
|
||||||
m_frameMenuBar->MacInstallMenuBar() ;
|
m_frameMenuBar->MacInstallMenuBar() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the active MDI child window
|
// Returns the active MDI child window
|
||||||
wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const
|
wxMDIChildFrame *wxMDIParentFrame::GetActiveChild() const
|
||||||
{
|
{
|
||||||
return m_currentChild ;
|
return m_currentChild ;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the client window class (don't Create the window,
|
// Create the client window class (don't Create the window,
|
||||||
@@ -227,12 +227,12 @@ void wxMDIChildFrame::Init()
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
|
bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
const wxString& title,
|
const wxString& title,
|
||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
const wxSize& size,
|
const wxSize& size,
|
||||||
long style,
|
long style,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
SetName(name);
|
SetName(name);
|
||||||
|
|
||||||
@@ -243,10 +243,10 @@ bool wxMDIChildFrame::Create(wxMDIParentFrame *parent,
|
|||||||
|
|
||||||
if (parent) parent->AddChild(this);
|
if (parent) parent->AddChild(this);
|
||||||
|
|
||||||
MacCreateRealWindow( title, pos , size , MacRemoveBordersFromStyle(style) , name ) ;
|
MacCreateRealWindow( title, pos , size , MacRemoveBordersFromStyle(style) , name ) ;
|
||||||
|
|
||||||
m_macWindowBackgroundTheme = kThemeBrushDocumentWindowBackground ;
|
m_macWindowBackgroundTheme = kThemeBrushDocumentWindowBackground ;
|
||||||
SetThemeWindowBackground( (WindowRef) m_macWindow , m_macWindowBackgroundTheme , false ) ;
|
SetThemeWindowBackground( (WindowRef) m_macWindow , m_macWindowBackgroundTheme , false ) ;
|
||||||
|
|
||||||
wxModelessWindows.Append(this);
|
wxModelessWindows.Append(this);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -262,7 +262,7 @@ wxMDIChildFrame::~wxMDIChildFrame()
|
|||||||
|
|
||||||
void wxMDIChildFrame::SetMenuBar(wxMenuBar *menu_bar)
|
void wxMDIChildFrame::SetMenuBar(wxMenuBar *menu_bar)
|
||||||
{
|
{
|
||||||
return wxFrame::SetMenuBar( menu_bar ) ;
|
return wxFrame::SetMenuBar( menu_bar ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
// MDI operations
|
// MDI operations
|
||||||
@@ -300,7 +300,7 @@ bool wxMDIClientWindow::CreateClient(wxMDIParentFrame *parent, long style)
|
|||||||
|
|
||||||
if ( parent )
|
if ( parent )
|
||||||
{
|
{
|
||||||
parent->AddChild(this);
|
parent->AddChild(this);
|
||||||
}
|
}
|
||||||
m_backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE);
|
m_backgroundColour = wxSystemSettings::GetColour(wxSYS_COLOUR_APPWORKSPACE);
|
||||||
|
|
||||||
|
|||||||
@@ -6,10 +6,9 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma implementation "menu.h"
|
#pragma implementation "menu.h"
|
||||||
#pragma implementation "menuitem.h"
|
#pragma implementation "menuitem.h"
|
||||||
@@ -70,8 +69,8 @@ void wxMenu::Init()
|
|||||||
m_startRadioGroup = -1;
|
m_startRadioGroup = -1;
|
||||||
|
|
||||||
// create the menu
|
// create the menu
|
||||||
m_macMenuId = s_macNextMenuId++;
|
m_macMenuId = s_macNextMenuId++;
|
||||||
m_hMenu = UMANewMenu(m_macMenuId, m_title);
|
m_hMenu = UMANewMenu(m_macMenuId, m_title);
|
||||||
|
|
||||||
if ( !m_hMenu )
|
if ( !m_hMenu )
|
||||||
{
|
{
|
||||||
@@ -88,13 +87,13 @@ void wxMenu::Init()
|
|||||||
|
|
||||||
wxMenu::~wxMenu()
|
wxMenu::~wxMenu()
|
||||||
{
|
{
|
||||||
if (MAC_WXHMENU(m_hMenu))
|
if (MAC_WXHMENU(m_hMenu))
|
||||||
::DisposeMenu(MAC_WXHMENU(m_hMenu));
|
::DisposeMenu(MAC_WXHMENU(m_hMenu));
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMenu::Break()
|
void wxMenu::Break()
|
||||||
{
|
{
|
||||||
// not available on the mac platform
|
// not available on the mac platform
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMenu::Attach(wxMenuBarBase *menubar)
|
void wxMenu::Attach(wxMenuBarBase *menubar)
|
||||||
@@ -110,60 +109,60 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
|
|||||||
{
|
{
|
||||||
wxASSERT_MSG( pItem != NULL, "can't append NULL item to the menu" );
|
wxASSERT_MSG( pItem != NULL, "can't append NULL item to the menu" );
|
||||||
|
|
||||||
if ( pItem->IsSeparator() )
|
if ( pItem->IsSeparator() )
|
||||||
{
|
{
|
||||||
if ( pos == (size_t)-1 )
|
if ( pos == (size_t)-1 )
|
||||||
MacAppendMenu(MAC_WXHMENU(m_hMenu), "\p-");
|
MacAppendMenu(MAC_WXHMENU(m_hMenu), "\p-");
|
||||||
else
|
else
|
||||||
MacInsertMenuItem(MAC_WXHMENU(m_hMenu), "\p-" , pos);
|
MacInsertMenuItem(MAC_WXHMENU(m_hMenu), "\p-" , pos);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxMenu *pSubMenu = pItem->GetSubMenu() ;
|
wxMenu *pSubMenu = pItem->GetSubMenu() ;
|
||||||
if ( pSubMenu != NULL )
|
if ( pSubMenu != NULL )
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( pSubMenu->m_hMenu != NULL , "invalid submenu added");
|
wxASSERT_MSG( pSubMenu->m_hMenu != NULL , "invalid submenu added");
|
||||||
pSubMenu->m_menuParent = this ;
|
pSubMenu->m_menuParent = this ;
|
||||||
|
|
||||||
if (wxMenuBar::MacGetInstalledMenuBar() == m_menuBar)
|
if (wxMenuBar::MacGetInstalledMenuBar() == m_menuBar)
|
||||||
::InsertMenu( MAC_WXHMENU( pSubMenu->m_hMenu ) , -1 ) ;
|
::InsertMenu( MAC_WXHMENU( pSubMenu->m_hMenu ) , -1 ) ;
|
||||||
|
|
||||||
if ( pos == (size_t)-1 )
|
if ( pos == (size_t)-1 )
|
||||||
UMAAppendSubMenuItem(MAC_WXHMENU(m_hMenu), pItem->GetText(), pSubMenu->m_macMenuId);
|
UMAAppendSubMenuItem(MAC_WXHMENU(m_hMenu), pItem->GetText(), pSubMenu->m_macMenuId);
|
||||||
else
|
else
|
||||||
UMAInsertSubMenuItem(MAC_WXHMENU(m_hMenu), pItem->GetText() , pos, pSubMenu->m_macMenuId);
|
UMAInsertSubMenuItem(MAC_WXHMENU(m_hMenu), pItem->GetText() , pos, pSubMenu->m_macMenuId);
|
||||||
pItem->UpdateItemBitmap() ;
|
pItem->UpdateItemBitmap() ;
|
||||||
pItem->UpdateItemStatus() ;
|
pItem->UpdateItemStatus() ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( pos == (size_t)-1 )
|
if ( pos == (size_t)-1 )
|
||||||
{
|
{
|
||||||
UMAAppendMenuItem(MAC_WXHMENU(m_hMenu), "a" );
|
UMAAppendMenuItem(MAC_WXHMENU(m_hMenu), "a" );
|
||||||
pos = CountMenuItems(MAC_WXHMENU(m_hMenu)) ;
|
pos = CountMenuItems(MAC_WXHMENU(m_hMenu)) ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UMAInsertMenuItem(MAC_WXHMENU(m_hMenu), "a" , pos);
|
UMAInsertMenuItem(MAC_WXHMENU(m_hMenu), "a" , pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
SetMenuItemCommandID( MAC_WXHMENU(m_hMenu) , pos , pItem->GetId() ) ;
|
SetMenuItemCommandID( MAC_WXHMENU(m_hMenu) , pos , pItem->GetId() ) ;
|
||||||
pItem->UpdateItemText() ;
|
pItem->UpdateItemText() ;
|
||||||
pItem->UpdateItemBitmap() ;
|
pItem->UpdateItemBitmap() ;
|
||||||
pItem->UpdateItemStatus() ;
|
pItem->UpdateItemStatus() ;
|
||||||
|
|
||||||
if ( pItem->GetId() == idMenuTitle )
|
if ( pItem->GetId() == idMenuTitle )
|
||||||
{
|
{
|
||||||
UMAEnableMenuItem(MAC_WXHMENU(m_hMenu) , pos , false ) ;
|
UMAEnableMenuItem(MAC_WXHMENU(m_hMenu) , pos , false ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if we're already attached to the menubar, we must update it
|
// if we're already attached to the menubar, we must update it
|
||||||
if ( IsAttached() )
|
if ( IsAttached() )
|
||||||
{
|
{
|
||||||
m_menuBar->Refresh();
|
m_menuBar->Refresh();
|
||||||
}
|
}
|
||||||
return TRUE ;
|
return TRUE ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMenu::EndRadioGroup()
|
void wxMenu::EndRadioGroup()
|
||||||
@@ -250,7 +249,7 @@ wxMenuItem *wxMenu::DoRemove(wxMenuItem *item)
|
|||||||
// DoRemove() (unlike Remove) can only be called for existing item!
|
// DoRemove() (unlike Remove) can only be called for existing item!
|
||||||
wxCHECK_MSG( node, NULL, wxT("bug in wxMenu::Remove logic") );
|
wxCHECK_MSG( node, NULL, wxT("bug in wxMenu::Remove logic") );
|
||||||
|
|
||||||
::DeleteMenuItem(MAC_WXHMENU(m_hMenu) , pos + 1);
|
::DeleteMenuItem(MAC_WXHMENU(m_hMenu) , pos + 1);
|
||||||
|
|
||||||
if ( IsAttached() )
|
if ( IsAttached() )
|
||||||
{
|
{
|
||||||
@@ -264,8 +263,8 @@ wxMenuItem *wxMenu::DoRemove(wxMenuItem *item)
|
|||||||
|
|
||||||
void wxMenu::SetTitle(const wxString& label)
|
void wxMenu::SetTitle(const wxString& label)
|
||||||
{
|
{
|
||||||
m_title = label ;
|
m_title = label ;
|
||||||
UMASetMenuTitle(MAC_WXHMENU(m_hMenu) , label ) ;
|
UMASetMenuTitle(MAC_WXHMENU(m_hMenu) , label ) ;
|
||||||
}
|
}
|
||||||
bool wxMenu::ProcessCommand(wxCommandEvent & event)
|
bool wxMenu::ProcessCommand(wxCommandEvent & event)
|
||||||
{
|
{
|
||||||
@@ -326,9 +325,9 @@ int wxMenu::MacGetIndexFromId( int id )
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!node)
|
if (!node)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return pos + 1 ;
|
return pos + 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxMenu::MacGetIndexFromItem( wxMenuItem *pItem )
|
int wxMenu::MacGetIndexFromItem( wxMenuItem *pItem )
|
||||||
@@ -344,16 +343,16 @@ int wxMenu::MacGetIndexFromItem( wxMenuItem *pItem )
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!node)
|
if (!node)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return pos + 1 ;
|
return pos + 1 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMenu::MacEnableMenu( bool bDoEnable )
|
void wxMenu::MacEnableMenu( bool bDoEnable )
|
||||||
{
|
{
|
||||||
UMAEnableMenuItem(MAC_WXHMENU(m_hMenu) , 0 , bDoEnable ) ;
|
UMAEnableMenuItem(MAC_WXHMENU(m_hMenu) , 0 , bDoEnable ) ;
|
||||||
|
|
||||||
::DrawMenuBar() ;
|
::DrawMenuBar() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Menu Bar
|
// Menu Bar
|
||||||
@@ -412,11 +411,11 @@ wxMenuBar::wxMenuBar(int count, wxMenu *menus[], const wxString titles[])
|
|||||||
|
|
||||||
wxMenuBar::~wxMenuBar()
|
wxMenuBar::~wxMenuBar()
|
||||||
{
|
{
|
||||||
if (s_macInstalledMenuBar == this)
|
if (s_macInstalledMenuBar == this)
|
||||||
{
|
{
|
||||||
::ClearMenuBar();
|
::ClearMenuBar();
|
||||||
s_macInstalledMenuBar = NULL;
|
s_macInstalledMenuBar = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -453,142 +452,142 @@ void wxMenuBar::MacInstallMenuBar()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// clean-up the help menu before adding new items
|
// clean-up the help menu before adding new items
|
||||||
MenuHandle mh = NULL ;
|
MenuHandle mh = NULL ;
|
||||||
if ( UMAGetHelpMenu( &mh , &firstUserHelpMenuItem) == noErr )
|
if ( UMAGetHelpMenu( &mh , &firstUserHelpMenuItem) == noErr )
|
||||||
{
|
{
|
||||||
for ( int i = CountMenuItems( mh ) ; i >= firstUserHelpMenuItem ; --i )
|
for ( int i = CountMenuItems( mh ) ; i >= firstUserHelpMenuItem ; --i )
|
||||||
{
|
{
|
||||||
DeleteMenuItem( mh , i ) ;
|
DeleteMenuItem( mh , i ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mh = NULL ;
|
mh = NULL ;
|
||||||
}
|
}
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
if ( UMAGetSystemVersion() >= 0x1000 && wxApp::s_macPreferencesMenuItemId)
|
if ( UMAGetSystemVersion() >= 0x1000 && wxApp::s_macPreferencesMenuItemId)
|
||||||
{
|
{
|
||||||
wxMenuItem *item = FindItem( wxApp::s_macPreferencesMenuItemId , NULL ) ;
|
wxMenuItem *item = FindItem( wxApp::s_macPreferencesMenuItemId , NULL ) ;
|
||||||
if ( item == NULL || !(item->IsEnabled()) )
|
if ( item == NULL || !(item->IsEnabled()) )
|
||||||
DisableMenuCommand( NULL , kHICommandPreferences ) ;
|
DisableMenuCommand( NULL , kHICommandPreferences ) ;
|
||||||
else
|
else
|
||||||
EnableMenuCommand( NULL , kHICommandPreferences ) ;
|
EnableMenuCommand( NULL , kHICommandPreferences ) ;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
for (size_t i = 0; i < m_menus.GetCount(); i++)
|
for (size_t i = 0; i < m_menus.GetCount(); i++)
|
||||||
{
|
{
|
||||||
Str255 label;
|
Str255 label;
|
||||||
wxMenuItemList::Node *node;
|
wxMenuItemList::Node *node;
|
||||||
wxMenuItem *item;
|
wxMenuItem *item;
|
||||||
int pos ;
|
int pos ;
|
||||||
wxMenu* menu = m_menus[i] , *subMenu = NULL ;
|
wxMenu* menu = m_menus[i] , *subMenu = NULL ;
|
||||||
|
|
||||||
if( m_titles[i] == "?" || m_titles[i] == "&?" || m_titles[i] == wxApp::s_macHelpMenuTitleName )
|
if( m_titles[i] == "?" || m_titles[i] == "&?" || m_titles[i] == wxApp::s_macHelpMenuTitleName )
|
||||||
{
|
{
|
||||||
if ( mh == NULL )
|
if ( mh == NULL )
|
||||||
{
|
{
|
||||||
continue ;
|
continue ;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (pos = 0 , node = menu->GetMenuItems().GetFirst(); node; node = node->GetNext(), pos++)
|
for (pos = 0 , node = menu->GetMenuItems().GetFirst(); node; node = node->GetNext(), pos++)
|
||||||
{
|
{
|
||||||
item = (wxMenuItem *)node->GetData();
|
item = (wxMenuItem *)node->GetData();
|
||||||
subMenu = item->GetSubMenu() ;
|
subMenu = item->GetSubMenu() ;
|
||||||
if (subMenu)
|
if (subMenu)
|
||||||
{
|
{
|
||||||
// we don't support hierarchical menus in the help menu yet
|
// we don't support hierarchical menus in the help menu yet
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( item->IsSeparator() )
|
if ( item->IsSeparator() )
|
||||||
{
|
{
|
||||||
if ( mh )
|
if ( mh )
|
||||||
MacAppendMenu(mh, "\p-" );
|
MacAppendMenu(mh, "\p-" );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxAcceleratorEntry* entry = wxGetAccelFromString( item->GetText() ) ;
|
wxAcceleratorEntry* entry = wxGetAccelFromString( item->GetText() ) ;
|
||||||
|
|
||||||
if ( item->GetId() == wxApp::s_macAboutMenuItemId )
|
if ( item->GetId() == wxApp::s_macAboutMenuItemId )
|
||||||
{
|
{
|
||||||
UMASetMenuItemText( GetMenuHandle( kwxMacAppleMenuId ) , 1 , item->GetText() );
|
UMASetMenuItemText( GetMenuHandle( kwxMacAppleMenuId ) , 1 , item->GetText() );
|
||||||
UMAEnableMenuItem( GetMenuHandle( kwxMacAppleMenuId ) , 1 , true );
|
UMAEnableMenuItem( GetMenuHandle( kwxMacAppleMenuId ) , 1 , true );
|
||||||
SetMenuItemCommandID( GetMenuHandle( kwxMacAppleMenuId ) , 1 , item->GetId() ) ;
|
SetMenuItemCommandID( GetMenuHandle( kwxMacAppleMenuId ) , 1 , item->GetId() ) ;
|
||||||
UMASetMenuItemShortcut( GetMenuHandle( kwxMacAppleMenuId ) , 1 , entry ) ;
|
UMASetMenuItemShortcut( GetMenuHandle( kwxMacAppleMenuId ) , 1 , entry ) ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( mh )
|
if ( mh )
|
||||||
{
|
{
|
||||||
UMAAppendMenuItem(mh, item->GetText() , entry );
|
UMAAppendMenuItem(mh, item->GetText() , entry );
|
||||||
SetMenuItemCommandID( mh , CountMenuItems(mh) , item->GetId() ) ;
|
SetMenuItemCommandID( mh , CountMenuItems(mh) , item->GetId() ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete entry ;
|
delete entry ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , m_titles[i] ) ;
|
UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , m_titles[i] ) ;
|
||||||
wxArrayPtrVoid submenus ;
|
wxArrayPtrVoid submenus ;
|
||||||
wxMenuItem* previousItem = NULL ;
|
wxMenuItem* previousItem = NULL ;
|
||||||
for (pos = 0, node = menu->GetMenuItems().GetFirst(); node; node = node->GetNext(), pos++)
|
for (pos = 0, node = menu->GetMenuItems().GetFirst(); node; node = node->GetNext(), pos++)
|
||||||
{
|
{
|
||||||
item = (wxMenuItem *)node->GetData();
|
item = (wxMenuItem *)node->GetData();
|
||||||
subMenu = item->GetSubMenu() ;
|
subMenu = item->GetSubMenu() ;
|
||||||
if (subMenu)
|
if (subMenu)
|
||||||
{
|
{
|
||||||
submenus.Add(subMenu) ;
|
submenus.Add(subMenu) ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
if ( UMAGetSystemVersion() >= 0x1000 )
|
if ( UMAGetSystemVersion() >= 0x1000 )
|
||||||
{
|
{
|
||||||
if ( item->GetId() == wxApp::s_macPreferencesMenuItemId || item->GetId() == wxApp::s_macExitMenuItemId)
|
if ( item->GetId() == wxApp::s_macPreferencesMenuItemId || item->GetId() == wxApp::s_macExitMenuItemId)
|
||||||
{
|
{
|
||||||
ChangeMenuItemAttributes( MAC_WXHMENU( menu->GetHMenu() ) , pos + 1, kMenuItemAttrHidden, 0 );
|
ChangeMenuItemAttributes( MAC_WXHMENU( menu->GetHMenu() ) , pos + 1, kMenuItemAttrHidden, 0 );
|
||||||
if ( menu->GetMenuItems().GetCount() == pos + 1 && previousItem != NULL && previousItem->IsSeparator() )
|
if ( menu->GetMenuItems().GetCount() == pos + 1 && previousItem != NULL && previousItem->IsSeparator() )
|
||||||
{
|
{
|
||||||
ChangeMenuItemAttributes( MAC_WXHMENU( menu->GetHMenu() ) , pos , kMenuItemAttrHidden, 0 );
|
ChangeMenuItemAttributes( MAC_WXHMENU( menu->GetHMenu() ) , pos , kMenuItemAttrHidden, 0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
previousItem = item ;
|
previousItem = item ;
|
||||||
}
|
}
|
||||||
::InsertMenu(MAC_WXHMENU(m_menus[i]->GetHMenu()), 0);
|
::InsertMenu(MAC_WXHMENU(m_menus[i]->GetHMenu()), 0);
|
||||||
for ( size_t i = 0 ; i < submenus.GetCount() ; ++i )
|
for ( size_t i = 0 ; i < submenus.GetCount() ; ++i )
|
||||||
{
|
{
|
||||||
wxMenu* submenu = (wxMenu*) submenus[i] ;
|
wxMenu* submenu = (wxMenu*) submenus[i] ;
|
||||||
wxMenuItemList::Node *subnode;
|
wxMenuItemList::Node *subnode;
|
||||||
wxMenuItem *subitem;
|
wxMenuItem *subitem;
|
||||||
int subpos ;
|
int subpos ;
|
||||||
for ( subpos = 0 , subnode = submenu->GetMenuItems().GetFirst(); subnode; subnode = subnode->GetNext(), subpos++)
|
for ( subpos = 0 , subnode = submenu->GetMenuItems().GetFirst(); subnode; subnode = subnode->GetNext(), subpos++)
|
||||||
{
|
{
|
||||||
subitem = (wxMenuItem *)subnode->GetData();
|
subitem = (wxMenuItem *)subnode->GetData();
|
||||||
wxMenu* itsSubMenu = subitem->GetSubMenu() ;
|
wxMenu* itsSubMenu = subitem->GetSubMenu() ;
|
||||||
if (itsSubMenu)
|
if (itsSubMenu)
|
||||||
{
|
{
|
||||||
submenus.Add(itsSubMenu) ;
|
submenus.Add(itsSubMenu) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
::InsertMenu( MAC_WXHMENU(submenu->GetHMenu()) , -1 ) ;
|
::InsertMenu( MAC_WXHMENU(submenu->GetHMenu()) , -1 ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
::DrawMenuBar() ;
|
::DrawMenuBar() ;
|
||||||
s_macInstalledMenuBar = this;
|
s_macInstalledMenuBar = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMenuBar::EnableTop(size_t pos, bool enable)
|
void wxMenuBar::EnableTop(size_t pos, bool enable)
|
||||||
{
|
{
|
||||||
wxCHECK_RET( IsAttached(), wxT("doesn't work with unattached menubars") );
|
wxCHECK_RET( IsAttached(), wxT("doesn't work with unattached menubars") );
|
||||||
m_menus[pos]->MacEnableMenu( enable ) ;
|
m_menus[pos]->MacEnableMenu( enable ) ;
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -604,11 +603,11 @@ void wxMenuBar::SetLabelTop(size_t pos, const wxString& label)
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_menus[pos]->SetTitle( label ) ;
|
m_menus[pos]->SetTitle( label ) ;
|
||||||
if (wxMenuBar::s_macInstalledMenuBar == this) // are we currently installed ?
|
if (wxMenuBar::s_macInstalledMenuBar == this) // are we currently installed ?
|
||||||
{
|
{
|
||||||
::SetMenuBar( GetMenuBar() ) ;
|
::SetMenuBar( GetMenuBar() ) ;
|
||||||
::InvalMenuBar() ;
|
::InvalMenuBar() ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxMenuBar::GetLabelTop(size_t pos) const
|
wxString wxMenuBar::GetLabelTop(size_t pos) const
|
||||||
@@ -653,21 +652,21 @@ wxMenu *wxMenuBar::Replace(size_t pos, wxMenu *menu, const wxString& title)
|
|||||||
|
|
||||||
if ( IsAttached() )
|
if ( IsAttached() )
|
||||||
{
|
{
|
||||||
if (s_macInstalledMenuBar == this)
|
if (s_macInstalledMenuBar == this)
|
||||||
{
|
{
|
||||||
::DeleteMenu( menuOld->MacGetMenuId() /* m_menus[pos]->MacGetMenuId() */ ) ;
|
::DeleteMenu( menuOld->MacGetMenuId() /* m_menus[pos]->MacGetMenuId() */ ) ;
|
||||||
{
|
{
|
||||||
UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title ) ;
|
UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title ) ;
|
||||||
if ( pos == m_menus.GetCount() - 1)
|
if ( pos == m_menus.GetCount() - 1)
|
||||||
{
|
{
|
||||||
::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , 0 ) ;
|
::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , 0 ) ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , m_menus[pos+1]->MacGetMenuId() ) ;
|
::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , m_menus[pos+1]->MacGetMenuId() ) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
@@ -682,18 +681,18 @@ bool wxMenuBar::Insert(size_t pos, wxMenu *menu, const wxString& title)
|
|||||||
|
|
||||||
m_titles.Insert(title, pos);
|
m_titles.Insert(title, pos);
|
||||||
|
|
||||||
UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title ) ;
|
UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title ) ;
|
||||||
|
|
||||||
if ( IsAttached() )
|
if ( IsAttached() )
|
||||||
{
|
{
|
||||||
if ( pos == (size_t) -1 || pos + 1 == m_menus.GetCount() )
|
if ( pos == (size_t) -1 || pos + 1 == m_menus.GetCount() )
|
||||||
{
|
{
|
||||||
::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , 0 ) ;
|
::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , 0 ) ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , m_menus[pos+1]->MacGetMenuId() ) ;
|
::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , m_menus[pos+1]->MacGetMenuId() ) ;
|
||||||
}
|
}
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -708,10 +707,10 @@ wxMenu *wxMenuBar::Remove(size_t pos)
|
|||||||
|
|
||||||
if ( IsAttached() )
|
if ( IsAttached() )
|
||||||
{
|
{
|
||||||
if (s_macInstalledMenuBar == this)
|
if (s_macInstalledMenuBar == this)
|
||||||
{
|
{
|
||||||
::DeleteMenu( menu->MacGetMenuId() /* m_menus[pos]->MacGetMenuId() */ ) ;
|
::DeleteMenu( menu->MacGetMenuId() /* m_menus[pos]->MacGetMenuId() */ ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
menu->Detach();
|
menu->Detach();
|
||||||
|
|
||||||
@@ -733,14 +732,14 @@ bool wxMenuBar::Append(wxMenu *menu, const wxString& title)
|
|||||||
|
|
||||||
m_titles.Add(title);
|
m_titles.Add(title);
|
||||||
|
|
||||||
UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title ) ;
|
UMASetMenuTitle( MAC_WXHMENU(menu->GetHMenu()) , title ) ;
|
||||||
|
|
||||||
if ( IsAttached() )
|
if ( IsAttached() )
|
||||||
{
|
{
|
||||||
if (s_macInstalledMenuBar == this)
|
if (s_macInstalledMenuBar == this)
|
||||||
{
|
{
|
||||||
::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , 0 ) ;
|
::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , 0 ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,144 +66,144 @@ wxMenuItem::~wxMenuItem()
|
|||||||
|
|
||||||
void wxMenuItem::SetBitmap(const wxBitmap& bitmap)
|
void wxMenuItem::SetBitmap(const wxBitmap& bitmap)
|
||||||
{
|
{
|
||||||
m_bitmap = bitmap;
|
m_bitmap = bitmap;
|
||||||
UpdateItemBitmap() ;
|
UpdateItemBitmap() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMenuItem::UpdateItemBitmap()
|
void wxMenuItem::UpdateItemBitmap()
|
||||||
{
|
{
|
||||||
if ( !m_parentMenu )
|
if ( !m_parentMenu )
|
||||||
return ;
|
return ;
|
||||||
|
|
||||||
MenuHandle mhandle = MAC_WXHMENU(m_parentMenu->GetHMenu()) ;
|
MenuHandle mhandle = MAC_WXHMENU(m_parentMenu->GetHMenu()) ;
|
||||||
MenuItemIndex index = m_parentMenu->MacGetIndexFromItem( this ) ;
|
MenuItemIndex index = m_parentMenu->MacGetIndexFromItem( this ) ;
|
||||||
if( mhandle == NULL || index == 0)
|
if( mhandle == NULL || index == 0)
|
||||||
return ;
|
return ;
|
||||||
|
|
||||||
if ( m_bitmap.Ok() )
|
if ( m_bitmap.Ok() )
|
||||||
{
|
{
|
||||||
ControlButtonContentInfo info ;
|
ControlButtonContentInfo info ;
|
||||||
wxMacCreateBitmapButton( &info , m_bitmap , kControlContentCIconHandle ) ;
|
wxMacCreateBitmapButton( &info , m_bitmap , kControlContentCIconHandle ) ;
|
||||||
if ( info.contentType != kControlNoContent )
|
if ( info.contentType != kControlNoContent )
|
||||||
{
|
{
|
||||||
if ( info.contentType == kControlContentCIconHandle )
|
if ( info.contentType == kControlContentCIconHandle )
|
||||||
SetMenuItemIconHandle( mhandle , index ,
|
SetMenuItemIconHandle( mhandle , index ,
|
||||||
kMenuColorIconType , (Handle) info.u.cIconHandle ) ;
|
kMenuColorIconType , (Handle) info.u.cIconHandle ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMenuItem::UpdateItemStatus()
|
void wxMenuItem::UpdateItemStatus()
|
||||||
{
|
{
|
||||||
if ( !m_parentMenu )
|
if ( !m_parentMenu )
|
||||||
return ;
|
return ;
|
||||||
|
|
||||||
MenuHandle mhandle = MAC_WXHMENU(m_parentMenu->GetHMenu()) ;
|
MenuHandle mhandle = MAC_WXHMENU(m_parentMenu->GetHMenu()) ;
|
||||||
MenuItemIndex index = m_parentMenu->MacGetIndexFromItem( this ) ;
|
MenuItemIndex index = m_parentMenu->MacGetIndexFromItem( this ) ;
|
||||||
if( mhandle == NULL || index == 0)
|
if( mhandle == NULL || index == 0)
|
||||||
return ;
|
return ;
|
||||||
|
|
||||||
UMAEnableMenuItem( mhandle , index , m_isEnabled ) ;
|
UMAEnableMenuItem( mhandle , index , m_isEnabled ) ;
|
||||||
if ( IsCheckable() && IsChecked() )
|
if ( IsCheckable() && IsChecked() )
|
||||||
::SetItemMark( mhandle , index , 0x12 ) ; // checkmark
|
::SetItemMark( mhandle , index , 0x12 ) ; // checkmark
|
||||||
else
|
else
|
||||||
::SetItemMark( mhandle , index , 0 ) ; // no mark
|
::SetItemMark( mhandle , index , 0 ) ; // no mark
|
||||||
|
|
||||||
UMASetMenuItemText( mhandle , index , m_text ) ;
|
UMASetMenuItemText( mhandle , index , m_text ) ;
|
||||||
wxAcceleratorEntry *entry = wxGetAccelFromString( m_text ) ;
|
wxAcceleratorEntry *entry = wxGetAccelFromString( m_text ) ;
|
||||||
UMASetMenuItemShortcut( mhandle , index , entry ) ;
|
UMASetMenuItemShortcut( mhandle , index , entry ) ;
|
||||||
delete entry ;
|
delete entry ;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMenuItem::UpdateItemText()
|
void wxMenuItem::UpdateItemText()
|
||||||
{
|
{
|
||||||
if ( !m_parentMenu )
|
if ( !m_parentMenu )
|
||||||
return ;
|
return ;
|
||||||
|
|
||||||
MenuHandle mhandle = MAC_WXHMENU(m_parentMenu->GetHMenu()) ;
|
MenuHandle mhandle = MAC_WXHMENU(m_parentMenu->GetHMenu()) ;
|
||||||
MenuItemIndex index = m_parentMenu->MacGetIndexFromItem( this ) ;
|
MenuItemIndex index = m_parentMenu->MacGetIndexFromItem( this ) ;
|
||||||
if( mhandle == NULL || index == 0)
|
if( mhandle == NULL || index == 0)
|
||||||
return ;
|
return ;
|
||||||
|
|
||||||
UMASetMenuItemText( mhandle , index , m_text ) ;
|
UMASetMenuItemText( mhandle , index , m_text ) ;
|
||||||
wxAcceleratorEntry *entry = wxGetAccelFromString( m_text ) ;
|
wxAcceleratorEntry *entry = wxGetAccelFromString( m_text ) ;
|
||||||
UMASetMenuItemShortcut( mhandle , index , entry ) ;
|
UMASetMenuItemShortcut( mhandle , index , entry ) ;
|
||||||
delete entry ;
|
delete entry ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void wxMenuItem::Enable(bool bDoEnable)
|
void wxMenuItem::Enable(bool bDoEnable)
|
||||||
{
|
{
|
||||||
if ( m_isEnabled != bDoEnable )
|
if ( m_isEnabled != bDoEnable )
|
||||||
{
|
{
|
||||||
wxMenuItemBase::Enable( bDoEnable ) ;
|
wxMenuItemBase::Enable( bDoEnable ) ;
|
||||||
UpdateItemStatus() ;
|
UpdateItemStatus() ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void wxMenuItem::UncheckRadio()
|
void wxMenuItem::UncheckRadio()
|
||||||
{
|
{
|
||||||
if ( m_isChecked )
|
if ( m_isChecked )
|
||||||
{
|
{
|
||||||
wxMenuItemBase::Check( false ) ;
|
wxMenuItemBase::Check( false ) ;
|
||||||
UpdateItemStatus() ;
|
UpdateItemStatus() ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMenuItem::Check(bool bDoCheck)
|
void wxMenuItem::Check(bool bDoCheck)
|
||||||
{
|
{
|
||||||
wxCHECK_RET( IsCheckable(), "only checkable items may be checked" );
|
wxCHECK_RET( IsCheckable(), "only checkable items may be checked" );
|
||||||
|
|
||||||
if ( m_isChecked != bDoCheck )
|
if ( m_isChecked != bDoCheck )
|
||||||
{
|
{
|
||||||
if ( GetKind() == wxITEM_RADIO )
|
if ( GetKind() == wxITEM_RADIO )
|
||||||
{
|
{
|
||||||
if ( bDoCheck )
|
if ( bDoCheck )
|
||||||
{
|
{
|
||||||
wxMenuItemBase::Check( bDoCheck ) ;
|
wxMenuItemBase::Check( bDoCheck ) ;
|
||||||
UpdateItemStatus() ;
|
UpdateItemStatus() ;
|
||||||
|
|
||||||
// get the index of this item in the menu
|
// get the index of this item in the menu
|
||||||
const wxMenuItemList& items = m_parentMenu->GetMenuItems();
|
const wxMenuItemList& items = m_parentMenu->GetMenuItems();
|
||||||
int pos = items.IndexOf(this);
|
int pos = items.IndexOf(this);
|
||||||
wxCHECK_RET( pos != wxNOT_FOUND,
|
wxCHECK_RET( pos != wxNOT_FOUND,
|
||||||
_T("menuitem not found in the menu items list?") );
|
_T("menuitem not found in the menu items list?") );
|
||||||
|
|
||||||
// get the radio group range
|
// get the radio group range
|
||||||
int start,
|
int start,
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if ( m_isRadioGroupStart )
|
if ( m_isRadioGroupStart )
|
||||||
{
|
{
|
||||||
// we already have all information we need
|
// we already have all information we need
|
||||||
start = pos;
|
start = pos;
|
||||||
end = m_radioGroup.end;
|
end = m_radioGroup.end;
|
||||||
}
|
}
|
||||||
else // next radio group item
|
else // next radio group item
|
||||||
{
|
{
|
||||||
// get the radio group end from the start item
|
// get the radio group end from the start item
|
||||||
start = m_radioGroup.start;
|
start = m_radioGroup.start;
|
||||||
end = items.Item(start)->GetData()->m_radioGroup.end;
|
end = items.Item(start)->GetData()->m_radioGroup.end;
|
||||||
}
|
}
|
||||||
|
|
||||||
// also uncheck all the other items in this radio group
|
// also uncheck all the other items in this radio group
|
||||||
wxMenuItemList::Node *node = items.Item(start);
|
wxMenuItemList::Node *node = items.Item(start);
|
||||||
for ( int n = start; n <= end && node; n++ )
|
for ( int n = start; n <= end && node; n++ )
|
||||||
{
|
{
|
||||||
if ( n != pos )
|
if ( n != pos )
|
||||||
{
|
{
|
||||||
((wxMenuItem*)node->GetData())->UncheckRadio();
|
((wxMenuItem*)node->GetData())->UncheckRadio();
|
||||||
}
|
}
|
||||||
node = node->GetNext();
|
node = node->GetNext();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxMenuItemBase::Check( bDoCheck ) ;
|
wxMenuItemBase::Check( bDoCheck ) ;
|
||||||
UpdateItemStatus() ;
|
UpdateItemStatus() ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMenuItem::SetText(const wxString& text)
|
void wxMenuItem::SetText(const wxString& text)
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -61,7 +61,7 @@ wxMetafileRefData::~wxMetafileRefData(void)
|
|||||||
{
|
{
|
||||||
if (m_metafile)
|
if (m_metafile)
|
||||||
{
|
{
|
||||||
KillPicture( (PicHandle) m_metafile ) ;
|
KillPicture( (PicHandle) m_metafile ) ;
|
||||||
m_metafile = 0;
|
m_metafile = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -86,7 +86,7 @@ wxMetaFile::~wxMetaFile()
|
|||||||
bool wxMetaFile::SetClipboard(int width, int height)
|
bool wxMetaFile::SetClipboard(int width, int height)
|
||||||
{
|
{
|
||||||
#if wxUSE_DRAG_AND_DROP
|
#if wxUSE_DRAG_AND_DROP
|
||||||
//TODO finishi this port , we need the data obj first
|
//TODO finishi this port , we need the data obj first
|
||||||
if (!m_refData)
|
if (!m_refData)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
@@ -97,11 +97,11 @@ bool wxMetaFile::SetClipboard(int width, int height)
|
|||||||
wxTheClipboard->Clear();
|
wxTheClipboard->Clear();
|
||||||
}
|
}
|
||||||
wxDataObject *data =
|
wxDataObject *data =
|
||||||
new wxMetafileDataObject( *this) ;
|
new wxMetafileDataObject( *this) ;
|
||||||
bool success = wxTheClipboard->SetData(data);
|
bool success = wxTheClipboard->SetData(data);
|
||||||
if (!alreadyOpen)
|
if (!alreadyOpen)
|
||||||
wxTheClipboard->Close();
|
wxTheClipboard->Close();
|
||||||
return (bool) success;
|
return (bool) success;
|
||||||
#endif
|
#endif
|
||||||
return TRUE ;
|
return TRUE ;
|
||||||
}
|
}
|
||||||
@@ -116,17 +116,17 @@ void wxMetafile::SetHMETAFILE(WXHMETAFILE mf)
|
|||||||
|
|
||||||
bool wxMetaFile::Play(wxDC *dc)
|
bool wxMetaFile::Play(wxDC *dc)
|
||||||
{
|
{
|
||||||
if (!m_refData)
|
if (!m_refData)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (!dc->Ok() )
|
if (!dc->Ok() )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
{
|
{
|
||||||
wxMacPortSetter helper( dc ) ;
|
wxMacPortSetter helper( dc ) ;
|
||||||
PicHandle pict = (PicHandle) GetHMETAFILE() ;
|
PicHandle pict = (PicHandle) GetHMETAFILE() ;
|
||||||
DrawPicture( pict , &(**pict).picFrame ) ;
|
DrawPicture( pict , &(**pict).picFrame ) ;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,22 +139,22 @@ bool wxMetaFile::Play(wxDC *dc)
|
|||||||
// *DO* give origin/extent arguments to wxMakeMetaFilePlaceable.
|
// *DO* give origin/extent arguments to wxMakeMetaFilePlaceable.
|
||||||
wxMetaFileDC::wxMetaFileDC(const wxString& file)
|
wxMetaFileDC::wxMetaFileDC(const wxString& file)
|
||||||
{
|
{
|
||||||
m_metaFile = NULL;
|
m_metaFile = NULL;
|
||||||
m_minX = 10000;
|
m_minX = 10000;
|
||||||
m_minY = 10000;
|
m_minY = 10000;
|
||||||
m_maxX = -10000;
|
m_maxX = -10000;
|
||||||
m_maxY = -10000;
|
m_maxY = -10000;
|
||||||
|
|
||||||
wxASSERT_MSG( file.IsEmpty() , "no file based metafile support yet") ;
|
wxASSERT_MSG( file.IsEmpty() , "no file based metafile support yet") ;
|
||||||
|
|
||||||
m_metaFile = new wxMetaFile("") ;
|
m_metaFile = new wxMetaFile("") ;
|
||||||
Rect r={0,0,1000,1000} ;
|
Rect r={0,0,1000,1000} ;
|
||||||
|
|
||||||
m_metaFile->SetHMETAFILE( OpenPicture( &r ) ) ;
|
m_metaFile->SetHMETAFILE( OpenPicture( &r ) ) ;
|
||||||
::GetPort( (GrafPtr*) &m_macPort ) ;
|
::GetPort( (GrafPtr*) &m_macPort ) ;
|
||||||
m_ok = TRUE ;
|
m_ok = TRUE ;
|
||||||
|
|
||||||
SetMapMode(wxMM_TEXT);
|
SetMapMode(wxMM_TEXT);
|
||||||
}
|
}
|
||||||
|
|
||||||
// New constructor that takes origin and extent. If you use this, don't
|
// New constructor that takes origin and extent. If you use this, don't
|
||||||
@@ -162,21 +162,21 @@ wxMetaFileDC::wxMetaFileDC(const wxString& file)
|
|||||||
|
|
||||||
wxMetaFileDC::wxMetaFileDC(const wxString& file, int xext, int yext, int xorg, int yorg)
|
wxMetaFileDC::wxMetaFileDC(const wxString& file, int xext, int yext, int xorg, int yorg)
|
||||||
{
|
{
|
||||||
m_minX = 10000;
|
m_minX = 10000;
|
||||||
m_minY = 10000;
|
m_minY = 10000;
|
||||||
m_maxX = -10000;
|
m_maxX = -10000;
|
||||||
m_maxY = -10000;
|
m_maxY = -10000;
|
||||||
|
|
||||||
wxASSERT_MSG( file.IsEmpty() , "no file based metafile support yet") ;
|
wxASSERT_MSG( file.IsEmpty() , "no file based metafile support yet") ;
|
||||||
|
|
||||||
m_metaFile = new wxMetaFile("") ;
|
m_metaFile = new wxMetaFile("") ;
|
||||||
Rect r={yorg,xorg,yorg+yext,xorg+xext} ;
|
Rect r={yorg,xorg,yorg+yext,xorg+xext} ;
|
||||||
|
|
||||||
m_metaFile->SetHMETAFILE( OpenPicture( &r ) ) ;
|
m_metaFile->SetHMETAFILE( OpenPicture( &r ) ) ;
|
||||||
::GetPort( (GrafPtr*) &m_macPort ) ;
|
::GetPort( (GrafPtr*) &m_macPort ) ;
|
||||||
m_ok = TRUE ;
|
m_ok = TRUE ;
|
||||||
|
|
||||||
SetMapMode(wxMM_TEXT);
|
SetMapMode(wxMM_TEXT);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMetaFileDC::~wxMetaFileDC()
|
wxMetaFileDC::~wxMetaFileDC()
|
||||||
@@ -185,29 +185,29 @@ wxMetaFileDC::~wxMetaFileDC()
|
|||||||
|
|
||||||
wxMetaFile *wxMetaFileDC::Close()
|
wxMetaFile *wxMetaFileDC::Close()
|
||||||
{
|
{
|
||||||
ClosePicture() ;
|
ClosePicture() ;
|
||||||
return m_metaFile;
|
return m_metaFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if wxUSE_DATAOBJ
|
#if wxUSE_DATAOBJ
|
||||||
size_t wxMetafileDataObject::GetDataSize() const
|
size_t wxMetafileDataObject::GetDataSize() const
|
||||||
{
|
{
|
||||||
return GetHandleSize( (Handle) (*((wxMetafile*)&m_metafile)).GetHMETAFILE() ) ;
|
return GetHandleSize( (Handle) (*((wxMetafile*)&m_metafile)).GetHMETAFILE() ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxMetafileDataObject::GetDataHere(void *buf) const
|
bool wxMetafileDataObject::GetDataHere(void *buf) const
|
||||||
{
|
{
|
||||||
memcpy( buf , (*(PicHandle)(*((wxMetafile*)&m_metafile)).GetHMETAFILE()) ,
|
memcpy( buf , (*(PicHandle)(*((wxMetafile*)&m_metafile)).GetHMETAFILE()) ,
|
||||||
GetHandleSize( (Handle) (*((wxMetafile*)&m_metafile)).GetHMETAFILE() ) ) ;
|
GetHandleSize( (Handle) (*((wxMetafile*)&m_metafile)).GetHMETAFILE() ) ) ;
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxMetafileDataObject::SetData(size_t len, const void *buf)
|
bool wxMetafileDataObject::SetData(size_t len, const void *buf)
|
||||||
{
|
{
|
||||||
Handle handle = (Handle) m_metafile.GetHMETAFILE() ;
|
Handle handle = (Handle) m_metafile.GetHMETAFILE() ;
|
||||||
SetHandleSize( handle , len ) ;
|
SetHandleSize( handle , len ) ;
|
||||||
memcpy( *handle , buf , len ) ;
|
memcpy( *handle , buf , len ) ;
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ bool wxFileTypeImpl::GetDescription(wxString *desc) const
|
|||||||
|
|
||||||
size_t
|
size_t
|
||||||
wxFileTypeImpl::GetAllCommands(wxArrayString * verbs, wxArrayString * commands,
|
wxFileTypeImpl::GetAllCommands(wxArrayString * verbs, wxArrayString * commands,
|
||||||
const wxFileType::MessageParameters& params) const
|
const wxFileType::MessageParameters& params) const
|
||||||
{
|
{
|
||||||
wxFAIL_MSG( _T("wxFileTypeImpl::GetAllCommands() not yet implemented") );
|
wxFAIL_MSG( _T("wxFileTypeImpl::GetAllCommands() not yet implemented") );
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
// RCS-ID: $$
|
// RCS-ID: $$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -27,33 +27,33 @@ short language = 0 ;
|
|||||||
void wxMacConvertNewlines( const char *source , char * destination ) ;
|
void wxMacConvertNewlines( const char *source , char * destination ) ;
|
||||||
void wxMacConvertNewlines( const char *source , char * destination )
|
void wxMacConvertNewlines( const char *source , char * destination )
|
||||||
{
|
{
|
||||||
const char *s = source ;
|
const char *s = source ;
|
||||||
char *d = destination ;
|
char *d = destination ;
|
||||||
|
|
||||||
while( *s )
|
while( *s )
|
||||||
{
|
{
|
||||||
switch( *s )
|
switch( *s )
|
||||||
{
|
{
|
||||||
case 0x0a :
|
case 0x0a :
|
||||||
*d++ = 0x0d ;
|
*d++ = 0x0d ;
|
||||||
++s ;
|
++s ;
|
||||||
break ;
|
break ;
|
||||||
case 0x0d :
|
case 0x0d :
|
||||||
*d++ = 0x0d ;
|
*d++ = 0x0d ;
|
||||||
++s ;
|
++s ;
|
||||||
if ( *s == 0x0a )
|
if ( *s == 0x0a )
|
||||||
++s ;
|
++s ;
|
||||||
break ;
|
break ;
|
||||||
default :
|
default :
|
||||||
*d++ = *s++ ;
|
*d++ = *s++ ;
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*d = 0 ;
|
*d = 0 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxMessageDialog::wxMessageDialog(wxWindow *parent, const wxString& message, const wxString& caption,
|
wxMessageDialog::wxMessageDialog(wxWindow *parent, const wxString& message, const wxString& caption,
|
||||||
long style, const wxPoint& pos)
|
long style, const wxPoint& pos)
|
||||||
{
|
{
|
||||||
m_caption = caption;
|
m_caption = caption;
|
||||||
m_message = message;
|
m_message = message;
|
||||||
@@ -63,252 +63,252 @@ wxMessageDialog::wxMessageDialog(wxWindow *parent, const wxString& message, cons
|
|||||||
|
|
||||||
int wxMessageDialog::ShowModal()
|
int wxMessageDialog::ShowModal()
|
||||||
{
|
{
|
||||||
int resultbutton = wxID_CANCEL ;
|
int resultbutton = wxID_CANCEL ;
|
||||||
|
|
||||||
short result ;
|
short result ;
|
||||||
|
|
||||||
wxASSERT_MSG( ( m_dialogStyle & 0x3F ) != wxYES , "this style is not supported on mac" ) ;
|
wxASSERT_MSG( ( m_dialogStyle & 0x3F ) != wxYES , "this style is not supported on mac" ) ;
|
||||||
|
|
||||||
AlertType alertType = kAlertPlainAlert ;
|
AlertType alertType = kAlertPlainAlert ;
|
||||||
if (m_dialogStyle & wxICON_EXCLAMATION)
|
if (m_dialogStyle & wxICON_EXCLAMATION)
|
||||||
alertType = kAlertNoteAlert ;
|
alertType = kAlertNoteAlert ;
|
||||||
else if (m_dialogStyle & wxICON_HAND)
|
else if (m_dialogStyle & wxICON_HAND)
|
||||||
alertType = kAlertStopAlert ;
|
alertType = kAlertStopAlert ;
|
||||||
else if (m_dialogStyle & wxICON_INFORMATION)
|
else if (m_dialogStyle & wxICON_INFORMATION)
|
||||||
alertType = kAlertNoteAlert ;
|
alertType = kAlertNoteAlert ;
|
||||||
else if (m_dialogStyle & wxICON_QUESTION)
|
else if (m_dialogStyle & wxICON_QUESTION)
|
||||||
alertType = kAlertCautionAlert ;
|
alertType = kAlertCautionAlert ;
|
||||||
|
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
if ( UMAGetSystemVersion() >= 0x1000 )
|
if ( UMAGetSystemVersion() >= 0x1000 )
|
||||||
{
|
{
|
||||||
AlertStdCFStringAlertParamRec param ;
|
AlertStdCFStringAlertParamRec param ;
|
||||||
CFStringRef cfNoString = NULL ;
|
CFStringRef cfNoString = NULL ;
|
||||||
CFStringRef cfYesString = NULL ;
|
CFStringRef cfYesString = NULL ;
|
||||||
|
|
||||||
CFStringRef cfTitle = NULL;
|
CFStringRef cfTitle = NULL;
|
||||||
CFStringRef cfText = NULL;
|
CFStringRef cfText = NULL;
|
||||||
|
|
||||||
cfTitle = wxMacCreateCFString( m_caption ) ;
|
cfTitle = wxMacCreateCFString( m_caption ) ;
|
||||||
cfText = wxMacCreateCFString( m_message ) ;
|
cfText = wxMacCreateCFString( m_message ) ;
|
||||||
cfNoString = wxMacCreateCFString( _("No") ) ;
|
cfNoString = wxMacCreateCFString( _("No") ) ;
|
||||||
cfYesString = wxMacCreateCFString( _("Yes") ) ;
|
cfYesString = wxMacCreateCFString( _("Yes") ) ;
|
||||||
|
|
||||||
param.movable = true;
|
param.movable = true;
|
||||||
param.flags = 0 ;
|
param.flags = 0 ;
|
||||||
|
|
||||||
bool skipDialog = false ;
|
bool skipDialog = false ;
|
||||||
|
|
||||||
if (m_dialogStyle & wxYES_NO)
|
if (m_dialogStyle & wxYES_NO)
|
||||||
{
|
{
|
||||||
if (m_dialogStyle & wxCANCEL)
|
if (m_dialogStyle & wxCANCEL)
|
||||||
{
|
{
|
||||||
param.defaultText = cfYesString ;
|
param.defaultText = cfYesString ;
|
||||||
param.cancelText = (CFStringRef) kAlertDefaultCancelText;
|
param.cancelText = (CFStringRef) kAlertDefaultCancelText;
|
||||||
param.otherText = cfNoString ;
|
param.otherText = cfNoString ;
|
||||||
param.helpButton = false ;
|
param.helpButton = false ;
|
||||||
param.defaultButton = kAlertStdAlertOKButton;
|
param.defaultButton = kAlertStdAlertOKButton;
|
||||||
param.cancelButton = kAlertStdAlertCancelButton;
|
param.cancelButton = kAlertStdAlertCancelButton;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
param.defaultText = cfYesString ;
|
param.defaultText = cfYesString ;
|
||||||
param.cancelText = NULL;
|
param.cancelText = NULL;
|
||||||
param.otherText = cfNoString ;
|
param.otherText = cfNoString ;
|
||||||
param.helpButton = false ;
|
param.helpButton = false ;
|
||||||
param.defaultButton = kAlertStdAlertOKButton;
|
param.defaultButton = kAlertStdAlertOKButton;
|
||||||
param.cancelButton = 0;
|
param.cancelButton = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (m_dialogStyle & wxOK)
|
else if (m_dialogStyle & wxOK)
|
||||||
{
|
{
|
||||||
if (m_dialogStyle & wxCANCEL)
|
if (m_dialogStyle & wxCANCEL)
|
||||||
{
|
{
|
||||||
// thats a cancel missing
|
// thats a cancel missing
|
||||||
param.defaultText = (CFStringRef) kAlertDefaultOKText ;
|
param.defaultText = (CFStringRef) kAlertDefaultOKText ;
|
||||||
param.cancelText = NULL;
|
param.cancelText = NULL;
|
||||||
param.otherText = NULL;
|
param.otherText = NULL;
|
||||||
param.helpButton = false ;
|
param.helpButton = false ;
|
||||||
param.defaultButton = kAlertStdAlertOKButton;
|
param.defaultButton = kAlertStdAlertOKButton;
|
||||||
param.cancelButton = 0;
|
param.cancelButton = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
param.defaultText = (CFStringRef) kAlertDefaultOKText ;
|
param.defaultText = (CFStringRef) kAlertDefaultOKText ;
|
||||||
param.cancelText = NULL;
|
param.cancelText = NULL;
|
||||||
param.otherText = NULL;
|
param.otherText = NULL;
|
||||||
param.helpButton = false ;
|
param.helpButton = false ;
|
||||||
param.defaultButton = kAlertStdAlertOKButton;
|
param.defaultButton = kAlertStdAlertOKButton;
|
||||||
param.cancelButton = 0;
|
param.cancelButton = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
skipDialog = true ;
|
skipDialog = true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
param.position = kWindowDefaultPosition;
|
param.position = kWindowDefaultPosition;
|
||||||
if ( !skipDialog )
|
if ( !skipDialog )
|
||||||
{
|
{
|
||||||
DialogRef alertRef ;
|
DialogRef alertRef ;
|
||||||
CreateStandardAlert( alertType , cfTitle , cfText , ¶m , &alertRef ) ;
|
CreateStandardAlert( alertType , cfTitle , cfText , ¶m , &alertRef ) ;
|
||||||
RunStandardAlert( alertRef , NULL , &result ) ;
|
RunStandardAlert( alertRef , NULL , &result ) ;
|
||||||
}
|
}
|
||||||
if(cfTitle != NULL)
|
if(cfTitle != NULL)
|
||||||
CFRelease(cfTitle);
|
CFRelease(cfTitle);
|
||||||
if(cfText != NULL)
|
if(cfText != NULL)
|
||||||
CFRelease(cfText);
|
CFRelease(cfText);
|
||||||
if(cfNoString != NULL)
|
if(cfNoString != NULL)
|
||||||
CFRelease(cfNoString);
|
CFRelease(cfNoString);
|
||||||
if(cfYesString != NULL)
|
if(cfYesString != NULL)
|
||||||
CFRelease(cfYesString);
|
CFRelease(cfYesString);
|
||||||
if ( skipDialog )
|
if ( skipDialog )
|
||||||
return wxID_CANCEL ;
|
return wxID_CANCEL ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
AlertStdAlertParamRec param;
|
AlertStdAlertParamRec param;
|
||||||
char cText[2048] ;
|
char cText[2048] ;
|
||||||
|
|
||||||
if (wxApp::s_macDefaultEncodingIsPC)
|
if (wxApp::s_macDefaultEncodingIsPC)
|
||||||
{
|
{
|
||||||
strcpy(cText , wxMacMakeMacStringFromPC( m_message) ) ;
|
strcpy(cText , wxMacMakeMacStringFromPC( m_message) ) ;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
strcpy( cText , m_message ) ;
|
strcpy( cText , m_message ) ;
|
||||||
}
|
}
|
||||||
wxMacConvertNewlines( cText , cText ) ;
|
wxMacConvertNewlines( cText , cText ) ;
|
||||||
|
|
||||||
Str255 yesPString ;
|
Str255 yesPString ;
|
||||||
Str255 noPString ;
|
Str255 noPString ;
|
||||||
|
|
||||||
Str255 pascalTitle ;
|
Str255 pascalTitle ;
|
||||||
Str255 pascalText ;
|
Str255 pascalText ;
|
||||||
wxMacStringToPascal( m_caption , pascalTitle ) ;
|
wxMacStringToPascal( m_caption , pascalTitle ) ;
|
||||||
wxMacStringToPascal( _("Yes") , yesPString ) ;
|
wxMacStringToPascal( _("Yes") , yesPString ) ;
|
||||||
wxMacStringToPascal( _("No") , noPString ) ;
|
wxMacStringToPascal( _("No") , noPString ) ;
|
||||||
CopyCStringToPascal( cText , pascalText ) ;
|
CopyCStringToPascal( cText , pascalText ) ;
|
||||||
|
|
||||||
param.movable = true;
|
param.movable = true;
|
||||||
param.filterProc = NULL ;
|
param.filterProc = NULL ;
|
||||||
if (m_dialogStyle & wxYES_NO)
|
if (m_dialogStyle & wxYES_NO)
|
||||||
{
|
{
|
||||||
if (m_dialogStyle & wxCANCEL)
|
if (m_dialogStyle & wxCANCEL)
|
||||||
{
|
{
|
||||||
param.defaultText = yesPString ;
|
param.defaultText = yesPString ;
|
||||||
param.cancelText = (StringPtr) kAlertDefaultCancelText;
|
param.cancelText = (StringPtr) kAlertDefaultCancelText;
|
||||||
param.otherText = noPString ;
|
param.otherText = noPString ;
|
||||||
param.helpButton = false ;
|
param.helpButton = false ;
|
||||||
param.defaultButton = kAlertStdAlertOKButton;
|
param.defaultButton = kAlertStdAlertOKButton;
|
||||||
param.cancelButton = kAlertStdAlertCancelButton;
|
param.cancelButton = kAlertStdAlertCancelButton;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
param.defaultText = yesPString ;
|
param.defaultText = yesPString ;
|
||||||
param.cancelText = NULL;
|
param.cancelText = NULL;
|
||||||
param.otherText = noPString ;
|
param.otherText = noPString ;
|
||||||
param.helpButton = false ;
|
param.helpButton = false ;
|
||||||
param.defaultButton = kAlertStdAlertOKButton;
|
param.defaultButton = kAlertStdAlertOKButton;
|
||||||
param.cancelButton = 0;
|
param.cancelButton = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (m_dialogStyle & wxOK)
|
else if (m_dialogStyle & wxOK)
|
||||||
{
|
{
|
||||||
if (m_dialogStyle & wxCANCEL)
|
if (m_dialogStyle & wxCANCEL)
|
||||||
{
|
{
|
||||||
// thats a cancel missing
|
// thats a cancel missing
|
||||||
param.defaultText = (StringPtr) kAlertDefaultOKText ;
|
param.defaultText = (StringPtr) kAlertDefaultOKText ;
|
||||||
param.cancelText = NULL;
|
param.cancelText = NULL;
|
||||||
param.otherText = NULL;
|
param.otherText = NULL;
|
||||||
param.helpButton = false ;
|
param.helpButton = false ;
|
||||||
param.defaultButton = kAlertStdAlertOKButton;
|
param.defaultButton = kAlertStdAlertOKButton;
|
||||||
param.cancelButton = 0;
|
param.cancelButton = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
param.defaultText = (StringPtr) kAlertDefaultOKText ;
|
param.defaultText = (StringPtr) kAlertDefaultOKText ;
|
||||||
param.cancelText = NULL;
|
param.cancelText = NULL;
|
||||||
param.otherText = NULL;
|
param.otherText = NULL;
|
||||||
param.helpButton = false ;
|
param.helpButton = false ;
|
||||||
param.defaultButton = kAlertStdAlertOKButton;
|
param.defaultButton = kAlertStdAlertOKButton;
|
||||||
param.cancelButton = 0;
|
param.cancelButton = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return resultbutton ;
|
return resultbutton ;
|
||||||
}
|
}
|
||||||
|
|
||||||
param.position = 0;
|
param.position = 0;
|
||||||
|
|
||||||
StandardAlert( alertType, pascalTitle, pascalText, ¶m, &result );
|
StandardAlert( alertType, pascalTitle, pascalText, ¶m, &result );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_dialogStyle & wxOK)
|
if (m_dialogStyle & wxOK)
|
||||||
{
|
{
|
||||||
if (m_dialogStyle & wxCANCEL)
|
if (m_dialogStyle & wxCANCEL)
|
||||||
{
|
{
|
||||||
//TODO add Cancelbutton
|
//TODO add Cancelbutton
|
||||||
switch( result )
|
switch( result )
|
||||||
{
|
{
|
||||||
case 1 :
|
case 1 :
|
||||||
resultbutton = wxID_OK ;
|
resultbutton = wxID_OK ;
|
||||||
break ;
|
break ;
|
||||||
case 2 :
|
case 2 :
|
||||||
break ;
|
break ;
|
||||||
case 3 :
|
case 3 :
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch( result )
|
switch( result )
|
||||||
{
|
{
|
||||||
case 1 :
|
case 1 :
|
||||||
resultbutton = wxID_OK ;
|
resultbutton = wxID_OK ;
|
||||||
break ;
|
break ;
|
||||||
case 2 :
|
case 2 :
|
||||||
break ;
|
break ;
|
||||||
case 3 :
|
case 3 :
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (m_dialogStyle & wxYES_NO)
|
else if (m_dialogStyle & wxYES_NO)
|
||||||
{
|
{
|
||||||
if (m_dialogStyle & wxCANCEL)
|
if (m_dialogStyle & wxCANCEL)
|
||||||
{
|
{
|
||||||
switch( result )
|
switch( result )
|
||||||
{
|
{
|
||||||
case 1 :
|
case 1 :
|
||||||
resultbutton = wxID_YES ;
|
resultbutton = wxID_YES ;
|
||||||
break ;
|
break ;
|
||||||
case 2 :
|
case 2 :
|
||||||
resultbutton = wxID_CANCEL ;
|
resultbutton = wxID_CANCEL ;
|
||||||
break ;
|
break ;
|
||||||
case 3 :
|
case 3 :
|
||||||
resultbutton = wxID_NO ;
|
resultbutton = wxID_NO ;
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch( result )
|
switch( result )
|
||||||
{
|
{
|
||||||
case 1 :
|
case 1 :
|
||||||
resultbutton = wxID_YES ;
|
resultbutton = wxID_YES ;
|
||||||
break ;
|
break ;
|
||||||
case 2 :
|
case 2 :
|
||||||
break ;
|
break ;
|
||||||
case 3 :
|
case 3 :
|
||||||
resultbutton = wxID_NO ;
|
resultbutton = wxID_NO ;
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return resultbutton ;
|
return resultbutton ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma implementation "notebook.h"
|
#pragma implementation "notebook.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
@@ -35,10 +35,10 @@
|
|||||||
|
|
||||||
static bool constantsSet = false ;
|
static bool constantsSet = false ;
|
||||||
|
|
||||||
short kwxMacTabLeftMargin = 0 ;
|
short kwxMacTabLeftMargin = 0 ;
|
||||||
short kwxMacTabTopMargin = 0 ;
|
short kwxMacTabTopMargin = 0 ;
|
||||||
short kwxMacTabRightMargin = 0 ;
|
short kwxMacTabRightMargin = 0 ;
|
||||||
short kwxMacTabBottomMargin = 0 ;
|
short kwxMacTabBottomMargin = 0 ;
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// event table
|
// event table
|
||||||
@@ -49,12 +49,12 @@ DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED)
|
|||||||
DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING)
|
DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING)
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxNotebook, wxControl)
|
BEGIN_EVENT_TABLE(wxNotebook, wxControl)
|
||||||
EVT_NOTEBOOK_PAGE_CHANGED(-1, wxNotebook::OnSelChange)
|
EVT_NOTEBOOK_PAGE_CHANGED(-1, wxNotebook::OnSelChange)
|
||||||
EVT_MOUSE_EVENTS(wxNotebook::OnMouse)
|
EVT_MOUSE_EVENTS(wxNotebook::OnMouse)
|
||||||
|
|
||||||
EVT_SIZE(wxNotebook::OnSize)
|
EVT_SIZE(wxNotebook::OnSize)
|
||||||
EVT_SET_FOCUS(wxNotebook::OnSetFocus)
|
EVT_SET_FOCUS(wxNotebook::OnSetFocus)
|
||||||
EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey)
|
EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxControl)
|
||||||
@@ -76,7 +76,7 @@ void wxNotebook::Init()
|
|||||||
{
|
{
|
||||||
if ( UMAHasAquaLayout() )
|
if ( UMAHasAquaLayout() )
|
||||||
{
|
{
|
||||||
// I got these values for Mac OS X from the Appearance mgr docs. (Mark Newsam)
|
// I got these values for Mac OS X from the Appearance mgr docs. (Mark Newsam)
|
||||||
kwxMacTabLeftMargin = 20 ;
|
kwxMacTabLeftMargin = 20 ;
|
||||||
kwxMacTabTopMargin = 38 ;
|
kwxMacTabTopMargin = 38 ;
|
||||||
kwxMacTabRightMargin = 20 ;
|
kwxMacTabRightMargin = 20 ;
|
||||||
@@ -127,31 +127,31 @@ bool wxNotebook::Create(wxWindow *parent,
|
|||||||
long style,
|
long style,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
Rect bounds ;
|
Rect bounds ;
|
||||||
Str255 title ;
|
Str255 title ;
|
||||||
|
|
||||||
MacPreControlCreate( parent , id , "" , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
|
MacPreControlCreate( parent , id , "" , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
|
||||||
|
|
||||||
int tabstyle = kControlTabSmallNorthProc ;
|
int tabstyle = kControlTabSmallNorthProc ;
|
||||||
if ( HasFlag(wxNB_LEFT) )
|
if ( HasFlag(wxNB_LEFT) )
|
||||||
tabstyle = kControlTabSmallWestProc ;
|
tabstyle = kControlTabSmallWestProc ;
|
||||||
else if ( HasFlag( wxNB_RIGHT ) )
|
else if ( HasFlag( wxNB_RIGHT ) )
|
||||||
tabstyle = kControlTabSmallEastProc ;
|
tabstyle = kControlTabSmallEastProc ;
|
||||||
else if ( HasFlag( wxNB_BOTTOM ) )
|
else if ( HasFlag( wxNB_BOTTOM ) )
|
||||||
tabstyle = kControlTabSmallSouthProc ;
|
tabstyle = kControlTabSmallSouthProc ;
|
||||||
|
|
||||||
|
|
||||||
m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1,
|
m_macControl = ::NewControl( MAC_WXHWND(parent->MacGetRootWindow()) , &bounds , title , false , 0 , 0 , 1,
|
||||||
tabstyle , (long) this ) ;
|
tabstyle , (long) this ) ;
|
||||||
|
|
||||||
MacPostControlCreate() ;
|
MacPostControlCreate() ;
|
||||||
return TRUE ;
|
return TRUE ;
|
||||||
}
|
}
|
||||||
|
|
||||||
// dtor
|
// dtor
|
||||||
wxNotebook::~wxNotebook()
|
wxNotebook::~wxNotebook()
|
||||||
{
|
{
|
||||||
m_macControl = NULL ;
|
m_macControl = NULL ;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSize wxNotebook::CalcSizeFromPage(const wxSize& sizePage)
|
wxSize wxNotebook::CalcSizeFromPage(const wxSize& sizePage)
|
||||||
@@ -195,7 +195,7 @@ wxSize wxNotebook::CalcSizeFromPage(const wxSize& sizePage)
|
|||||||
|
|
||||||
void wxNotebook::SetPadding(const wxSize& padding)
|
void wxNotebook::SetPadding(const wxSize& padding)
|
||||||
{
|
{
|
||||||
wxFAIL_MSG( wxT("wxNotebook::SetPadding not implemented") );
|
wxFAIL_MSG( wxT("wxNotebook::SetPadding not implemented") );
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxNotebook::SetTabSize(const wxSize& sz)
|
void wxNotebook::SetTabSize(const wxSize& sz)
|
||||||
@@ -210,11 +210,11 @@ void wxNotebook::SetPageSize(const wxSize& size)
|
|||||||
|
|
||||||
int wxNotebook::SetSelection(int nPage)
|
int wxNotebook::SetSelection(int nPage)
|
||||||
{
|
{
|
||||||
if( !IS_VALID_PAGE(nPage) )
|
if( !IS_VALID_PAGE(nPage) )
|
||||||
return m_nSelection ;
|
return m_nSelection ;
|
||||||
|
|
||||||
ChangePage(m_nSelection, nPage);
|
ChangePage(m_nSelection, nPage);
|
||||||
SetControl32BitValue( (ControlHandle) m_macControl , m_nSelection + 1 ) ;
|
SetControl32BitValue( (ControlHandle) m_macControl , m_nSelection + 1 ) ;
|
||||||
|
|
||||||
Refresh();
|
Refresh();
|
||||||
return m_nSelection;
|
return m_nSelection;
|
||||||
@@ -251,7 +251,7 @@ bool wxNotebook::SetPageImage(int nPage, int nImage)
|
|||||||
wxCHECK_MSG( IS_VALID_PAGE(nPage), FALSE, _T("invalid notebook page") );
|
wxCHECK_MSG( IS_VALID_PAGE(nPage), FALSE, _T("invalid notebook page") );
|
||||||
|
|
||||||
wxCHECK_MSG( m_imageList && nImage < m_imageList->GetImageCount(), FALSE,
|
wxCHECK_MSG( m_imageList && nImage < m_imageList->GetImageCount(), FALSE,
|
||||||
_T("invalid image index in SetPageImage()") );
|
_T("invalid image index in SetPageImage()") );
|
||||||
|
|
||||||
if ( nImage != m_images[nPage] )
|
if ( nImage != m_images[nPage] )
|
||||||
{
|
{
|
||||||
@@ -260,7 +260,7 @@ bool wxNotebook::SetPageImage(int nPage, int nImage)
|
|||||||
// changes, it won't
|
// changes, it won't
|
||||||
m_images[nPage] = nImage;
|
m_images[nPage] = nImage;
|
||||||
|
|
||||||
MacSetupTabs() ;
|
MacSetupTabs() ;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -334,8 +334,8 @@ bool wxNotebook::InsertPage(int nPage,
|
|||||||
int h, w;
|
int h, w;
|
||||||
GetSize(&w, &h);
|
GetSize(&w, &h);
|
||||||
pPage->SetSize(kwxMacTabLeftMargin, kwxMacTabTopMargin,
|
pPage->SetSize(kwxMacTabLeftMargin, kwxMacTabTopMargin,
|
||||||
w - kwxMacTabLeftMargin - kwxMacTabRightMargin,
|
w - kwxMacTabLeftMargin - kwxMacTabRightMargin,
|
||||||
h - kwxMacTabTopMargin - kwxMacTabBottomMargin );
|
h - kwxMacTabTopMargin - kwxMacTabBottomMargin );
|
||||||
if ( pPage->GetAutoLayout() ) {
|
if ( pPage->GetAutoLayout() ) {
|
||||||
pPage->Layout();
|
pPage->Layout();
|
||||||
}
|
}
|
||||||
@@ -344,10 +344,10 @@ bool wxNotebook::InsertPage(int nPage,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Added by Mark Newsam
|
/* Added by Mark Newsam
|
||||||
* When a page is added or deleted to the notebook this function updates
|
* When a page is added or deleted to the notebook this function updates
|
||||||
* information held in the m_macControl so that it matches the order
|
* information held in the m_macControl so that it matches the order
|
||||||
* the user would expect.
|
* the user would expect.
|
||||||
*/
|
*/
|
||||||
void wxNotebook::MacSetupTabs()
|
void wxNotebook::MacSetupTabs()
|
||||||
{
|
{
|
||||||
SetControl32BitMaximum( (ControlHandle) m_macControl , GetPageCount() ) ;
|
SetControl32BitMaximum( (ControlHandle) m_macControl , GetPageCount() ) ;
|
||||||
@@ -361,38 +361,38 @@ void wxNotebook::MacSetupTabs()
|
|||||||
info.version = 0;
|
info.version = 0;
|
||||||
info.iconSuiteID = 0;
|
info.iconSuiteID = 0;
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
c2pstrcpy( (StringPtr) info.name , page->GetLabel() ) ;
|
c2pstrcpy( (StringPtr) info.name , page->GetLabel() ) ;
|
||||||
#else
|
#else
|
||||||
strcpy( (char *) info.name , page->GetLabel() ) ;
|
strcpy( (char *) info.name , page->GetLabel() ) ;
|
||||||
c2pstr( (char *) info.name ) ;
|
c2pstr( (char *) info.name ) ;
|
||||||
#endif
|
#endif
|
||||||
SetControlData( (ControlHandle) m_macControl, ii+1, kControlTabInfoTag,
|
SetControlData( (ControlHandle) m_macControl, ii+1, kControlTabInfoTag,
|
||||||
sizeof( ControlTabInfoRec) , (char*) &info ) ;
|
sizeof( ControlTabInfoRec) , (char*) &info ) ;
|
||||||
SetTabEnabled( (ControlHandle) m_macControl , ii+1 , true ) ;
|
SetTabEnabled( (ControlHandle) m_macControl , ii+1 , true ) ;
|
||||||
|
|
||||||
#if TARGET_CARBON
|
#if TARGET_CARBON
|
||||||
if ( GetImageList() && GetPageImage(ii) >= 0 && UMAGetSystemVersion() >= 0x1020 )
|
if ( GetImageList() && GetPageImage(ii) >= 0 && UMAGetSystemVersion() >= 0x1020 )
|
||||||
{
|
{
|
||||||
// tab controls only support very specific types of images, therefore we are doing an odyssee
|
// tab controls only support very specific types of images, therefore we are doing an odyssee
|
||||||
// accross the icon worlds (even Apple DTS did not find a shorter path)
|
// accross the icon worlds (even Apple DTS did not find a shorter path)
|
||||||
// in order not to pollute the icon registry we put every icon into (OSType) 1 and immediately
|
// in order not to pollute the icon registry we put every icon into (OSType) 1 and immediately
|
||||||
// afterwards Unregister it (IconRef is ref counted, so it will stay on the tab even if we
|
// afterwards Unregister it (IconRef is ref counted, so it will stay on the tab even if we
|
||||||
// unregister it) in case this will ever lead to having the same icon everywhere add some kind
|
// unregister it) in case this will ever lead to having the same icon everywhere add some kind
|
||||||
// of static counter
|
// of static counter
|
||||||
ControlButtonContentInfo info ;
|
ControlButtonContentInfo info ;
|
||||||
wxMacCreateBitmapButton( &info , *GetImageList()->GetBitmap( GetPageImage(ii ) ) , kControlContentPictHandle) ;
|
wxMacCreateBitmapButton( &info , *GetImageList()->GetBitmap( GetPageImage(ii ) ) , kControlContentPictHandle) ;
|
||||||
IconFamilyHandle iconFamily = (IconFamilyHandle) NewHandle(0) ;
|
IconFamilyHandle iconFamily = (IconFamilyHandle) NewHandle(0) ;
|
||||||
OSErr err = SetIconFamilyData( iconFamily, 'PICT' , (Handle) info.u.picture ) ;
|
OSErr err = SetIconFamilyData( iconFamily, 'PICT' , (Handle) info.u.picture ) ;
|
||||||
wxASSERT_MSG( err == noErr , "Error when adding bitmap" ) ;
|
wxASSERT_MSG( err == noErr , "Error when adding bitmap" ) ;
|
||||||
IconRef iconRef ;
|
IconRef iconRef ;
|
||||||
err = RegisterIconRefFromIconFamily( 'WXNG' , (OSType) 1 , iconFamily, &iconRef ) ;
|
err = RegisterIconRefFromIconFamily( 'WXNG' , (OSType) 1 , iconFamily, &iconRef ) ;
|
||||||
wxASSERT_MSG( err == noErr , "Error when adding bitmap" ) ;
|
wxASSERT_MSG( err == noErr , "Error when adding bitmap" ) ;
|
||||||
info.contentType = kControlContentIconRef ;
|
info.contentType = kControlContentIconRef ;
|
||||||
info.u.iconRef = iconRef ;
|
info.u.iconRef = iconRef ;
|
||||||
SetControlData( (ControlHandle) m_macControl, ii+1,kControlTabImageContentTag,
|
SetControlData( (ControlHandle) m_macControl, ii+1,kControlTabImageContentTag,
|
||||||
sizeof( info ), (Ptr)&info );
|
sizeof( info ), (Ptr)&info );
|
||||||
wxASSERT_MSG( err == noErr , "Error when setting icon on tab" ) ;
|
wxASSERT_MSG( err == noErr , "Error when setting icon on tab" ) ;
|
||||||
UnregisterIconRef( 'WXNG' , (OSType) 1 ) ;
|
UnregisterIconRef( 'WXNG' , (OSType) 1 ) ;
|
||||||
ReleaseIconRef( iconRef ) ;
|
ReleaseIconRef( iconRef ) ;
|
||||||
DisposeHandle( (Handle) iconFamily ) ;
|
DisposeHandle( (Handle) iconFamily ) ;
|
||||||
}
|
}
|
||||||
@@ -425,8 +425,8 @@ void wxNotebook::OnSize(wxSizeEvent& event)
|
|||||||
for ( unsigned int nPage = 0; nPage < nCount; nPage++ ) {
|
for ( unsigned int nPage = 0; nPage < nCount; nPage++ ) {
|
||||||
wxNotebookPage *pPage = m_pages[nPage];
|
wxNotebookPage *pPage = m_pages[nPage];
|
||||||
pPage->SetSize(kwxMacTabLeftMargin, kwxMacTabTopMargin,
|
pPage->SetSize(kwxMacTabLeftMargin, kwxMacTabTopMargin,
|
||||||
w - kwxMacTabLeftMargin - kwxMacTabRightMargin,
|
w - kwxMacTabLeftMargin - kwxMacTabRightMargin,
|
||||||
h - kwxMacTabTopMargin - kwxMacTabBottomMargin );
|
h - kwxMacTabTopMargin - kwxMacTabBottomMargin );
|
||||||
if ( pPage->GetAutoLayout() ) {
|
if ( pPage->GetAutoLayout() ) {
|
||||||
pPage->Layout();
|
pPage->Layout();
|
||||||
}
|
}
|
||||||
@@ -525,77 +525,77 @@ void wxNotebook::ChangePage(int nOldSel, int nSel)
|
|||||||
|
|
||||||
void wxNotebook::OnMouse( wxMouseEvent &event )
|
void wxNotebook::OnMouse( wxMouseEvent &event )
|
||||||
{
|
{
|
||||||
if ( (ControlHandle) m_macControl == NULL )
|
if ( (ControlHandle) m_macControl == NULL )
|
||||||
{
|
{
|
||||||
event.Skip() ;
|
event.Skip() ;
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.GetEventType() == wxEVT_LEFT_DOWN || event.GetEventType() == wxEVT_LEFT_DCLICK )
|
if (event.GetEventType() == wxEVT_LEFT_DOWN || event.GetEventType() == wxEVT_LEFT_DCLICK )
|
||||||
{
|
{
|
||||||
int x = event.m_x ;
|
int x = event.m_x ;
|
||||||
int y = event.m_y ;
|
int y = event.m_y ;
|
||||||
|
|
||||||
MacClientToRootWindow( &x , &y ) ;
|
MacClientToRootWindow( &x , &y ) ;
|
||||||
|
|
||||||
ControlHandle control ;
|
ControlHandle control ;
|
||||||
Point localwhere ;
|
Point localwhere ;
|
||||||
SInt16 controlpart ;
|
SInt16 controlpart ;
|
||||||
|
|
||||||
localwhere.h = x ;
|
localwhere.h = x ;
|
||||||
localwhere.v = y ;
|
localwhere.v = y ;
|
||||||
|
|
||||||
short modifiers = 0;
|
short modifiers = 0;
|
||||||
|
|
||||||
if ( !event.m_leftDown && !event.m_rightDown )
|
if ( !event.m_leftDown && !event.m_rightDown )
|
||||||
modifiers |= btnState ;
|
modifiers |= btnState ;
|
||||||
|
|
||||||
if ( event.m_shiftDown )
|
if ( event.m_shiftDown )
|
||||||
modifiers |= shiftKey ;
|
modifiers |= shiftKey ;
|
||||||
|
|
||||||
if ( event.m_controlDown )
|
if ( event.m_controlDown )
|
||||||
modifiers |= controlKey ;
|
modifiers |= controlKey ;
|
||||||
|
|
||||||
if ( event.m_altDown )
|
if ( event.m_altDown )
|
||||||
modifiers |= optionKey ;
|
modifiers |= optionKey ;
|
||||||
|
|
||||||
if ( event.m_metaDown )
|
if ( event.m_metaDown )
|
||||||
modifiers |= cmdKey ;
|
modifiers |= cmdKey ;
|
||||||
|
|
||||||
control = (ControlHandle) m_macControl ;
|
control = (ControlHandle) m_macControl ;
|
||||||
if ( control && ::IsControlActive( control ) )
|
if ( control && ::IsControlActive( control ) )
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
wxNotebookEvent changing(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, m_windowId,
|
wxNotebookEvent changing(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, m_windowId,
|
||||||
::GetControl32BitValue(control) - 1, m_nSelection);
|
::GetControl32BitValue(control) - 1, m_nSelection);
|
||||||
changing.SetEventObject(this);
|
changing.SetEventObject(this);
|
||||||
ProcessEvent(changing);
|
ProcessEvent(changing);
|
||||||
|
|
||||||
if(changing.IsAllowed())
|
if(changing.IsAllowed())
|
||||||
{
|
{
|
||||||
controlpart = ::HandleControlClick(control, localwhere, modifiers,
|
controlpart = ::HandleControlClick(control, localwhere, modifiers,
|
||||||
(ControlActionUPP) -1);
|
(ControlActionUPP) -1);
|
||||||
wxTheApp->s_lastMouseDown = 0 ;
|
wxTheApp->s_lastMouseDown = 0 ;
|
||||||
|
|
||||||
wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, m_windowId,
|
wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, m_windowId,
|
||||||
::GetControl32BitValue(control) - 1, m_nSelection);
|
::GetControl32BitValue(control) - 1, m_nSelection);
|
||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
|
|
||||||
ProcessEvent(event);
|
ProcessEvent(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void wxNotebook::MacHandleControlClick( WXWidget control , wxInt16 controlpart )
|
void wxNotebook::MacHandleControlClick( WXWidget control , wxInt16 controlpart )
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, m_windowId , ::GetControl32BitValue((ControlHandle)m_macControl) - 1, m_nSelection);
|
wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, m_windowId , ::GetControl32BitValue((ControlHandle)m_macControl) - 1, m_nSelection);
|
||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
|
|
||||||
ProcessEvent(event);
|
ProcessEvent(event);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
// Created: 1998-01-01
|
// Created: 1998-01-01
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Stefan Csomor
|
// Copyright: (c) Stefan Csomor
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
@@ -30,8 +30,8 @@ IMPLEMENT_DYNAMIC_CLASS(wxPalette, wxGDIObject)
|
|||||||
|
|
||||||
wxPaletteRefData::wxPaletteRefData()
|
wxPaletteRefData::wxPaletteRefData()
|
||||||
{
|
{
|
||||||
m_palette = NULL ;
|
m_palette = NULL ;
|
||||||
m_count = 0 ;
|
m_count = 0 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPaletteRefData::~wxPaletteRefData()
|
wxPaletteRefData::~wxPaletteRefData()
|
||||||
@@ -57,25 +57,25 @@ wxPalette::~wxPalette()
|
|||||||
|
|
||||||
bool wxPalette::Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue)
|
bool wxPalette::Create(int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue)
|
||||||
{
|
{
|
||||||
UnRef();
|
UnRef();
|
||||||
|
|
||||||
m_refData = new wxPaletteRefData;
|
m_refData = new wxPaletteRefData;
|
||||||
|
|
||||||
M_PALETTEDATA->m_count = n ;
|
M_PALETTEDATA->m_count = n ;
|
||||||
M_PALETTEDATA->m_palette = new wxColour[n] ;
|
M_PALETTEDATA->m_palette = new wxColour[n] ;
|
||||||
|
|
||||||
for ( int i = 0 ; i < n ; ++i)
|
for ( int i = 0 ; i < n ; ++i)
|
||||||
{
|
{
|
||||||
M_PALETTEDATA->m_palette[i].Set( red[i] , green[i] , blue[i] ) ;
|
M_PALETTEDATA->m_palette[i].Set( red[i] , green[i] , blue[i] ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxPalette::GetPixel(const unsigned char red, const unsigned char green, const unsigned char blue) const
|
int wxPalette::GetPixel(const unsigned char red, const unsigned char green, const unsigned char blue) const
|
||||||
{
|
{
|
||||||
if ( !m_refData )
|
if ( !m_refData )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
long bestdiff = 3 * 256 ;
|
long bestdiff = 3 * 256 ;
|
||||||
long bestpos = 0 ;
|
long bestpos = 0 ;
|
||||||
@@ -83,15 +83,15 @@ int wxPalette::GetPixel(const unsigned char red, const unsigned char green, cons
|
|||||||
|
|
||||||
for ( int i = 0 ; i < M_PALETTEDATA->m_count ; ++i )
|
for ( int i = 0 ; i < M_PALETTEDATA->m_count ; ++i )
|
||||||
{
|
{
|
||||||
const wxColour& col = &M_PALETTEDATA->m_palette[i] ;
|
const wxColour& col = &M_PALETTEDATA->m_palette[i] ;
|
||||||
currentdiff = abs ( col.Red() - red ) + abs( col.Green() - green ) + abs ( col.Blue() - blue ) ;
|
currentdiff = abs ( col.Red() - red ) + abs( col.Green() - green ) + abs ( col.Blue() - blue ) ;
|
||||||
if ( currentdiff < bestdiff )
|
if ( currentdiff < bestdiff )
|
||||||
{
|
{
|
||||||
bestdiff = currentdiff ;
|
bestdiff = currentdiff ;
|
||||||
bestpos = i ;
|
bestpos = i ;
|
||||||
if ( bestdiff == 0 )
|
if ( bestdiff == 0 )
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return bestpos;
|
return bestpos;
|
||||||
@@ -100,7 +100,7 @@ int wxPalette::GetPixel(const unsigned char red, const unsigned char green, cons
|
|||||||
bool wxPalette::GetRGB(int index, unsigned char *red, unsigned char *green, unsigned char *blue) const
|
bool wxPalette::GetRGB(int index, unsigned char *red, unsigned char *green, unsigned char *blue) const
|
||||||
{
|
{
|
||||||
if ( !m_refData )
|
if ( !m_refData )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (index < 0 || index >= M_PALETTEDATA->m_count)
|
if (index < 0 || index >= M_PALETTEDATA->m_count)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@@ -114,5 +114,5 @@ bool wxPalette::GetRGB(int index, unsigned char *red, unsigned char *green, unsi
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// wxUSE_PALETTE
|
// wxUSE_PALETTE
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user