wxMac merge
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@7999 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
6342bd1ab3
commit
ee6b1d97e7
93
include/wx/mac/gsockmac.h
Normal file
93
include/wx/mac/gsockmac.h
Normal file
@ -0,0 +1,93 @@
|
||||
/* -------------------------------------------------------------------------
|
||||
* Project: GSocket (Generic Socket) for WX
|
||||
* Name: gsockunx.h
|
||||
* Purpose: GSocket Macintosh header
|
||||
* CVSID: $Id$
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef __GSOCK_UNX_H
|
||||
#define __GSOCK_UNX_H
|
||||
|
||||
#ifndef __GSOCKET_STANDALONE__
|
||||
#include "wx/setup.h"
|
||||
#endif
|
||||
|
||||
#if wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__)
|
||||
|
||||
#ifndef __GSOCKET_STANDALONE__
|
||||
#include "wx/gsocket.h"
|
||||
#else
|
||||
#include "gsocket.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
typedef GSocket* GSocketPtr ;
|
||||
|
||||
/* Definition of GSocket */
|
||||
struct _GSocket
|
||||
{
|
||||
wxMacNotifierTableRef m_mac_events ;
|
||||
EndpointRef m_endpoint;
|
||||
GAddress *m_local;
|
||||
GAddress *m_peer;
|
||||
GSocketError m_error;
|
||||
|
||||
int m_non_blocking;
|
||||
int m_server;
|
||||
int m_stream;
|
||||
int m_oriented;
|
||||
unsigned long m_timeout;
|
||||
|
||||
/* Callbacks */
|
||||
GSocketEventFlags m_detected;
|
||||
GSocketCallback m_cbacks[GSOCK_MAX_EVENT];
|
||||
char *m_data[GSOCK_MAX_EVENT];
|
||||
int m_takesEvents ;
|
||||
};
|
||||
|
||||
/* Definition of GAddress */
|
||||
|
||||
struct _GAddress
|
||||
{
|
||||
UInt32 m_host ;
|
||||
UInt16 m_port ;
|
||||
GAddressType m_family;
|
||||
GSocketError m_error;
|
||||
};
|
||||
|
||||
/* Input / Output */
|
||||
|
||||
GSocketError _GSocket_Input_Timeout(GSocket *socket);
|
||||
GSocketError _GSocket_Output_Timeout(GSocket *socket);
|
||||
int _GSocket_Recv_Stream(GSocket *socket, char *buffer, int size);
|
||||
int _GSocket_Recv_Dgram(GSocket *socket, char *buffer, int size);
|
||||
int _GSocket_Send_Stream(GSocket *socket, const char *buffer, int size);
|
||||
int _GSocket_Send_Dgram(GSocket *socket, const char *buffer, int size);
|
||||
|
||||
/* Callbacks */
|
||||
|
||||
void _GSocket_Enable_Events(GSocket *socket);
|
||||
void _GSocket_Disable_Events(GSocket *socket);
|
||||
void _GSocket_Internal_Proc(unsigned long e , void* data ) ;
|
||||
|
||||
/* GAddress */
|
||||
|
||||
GSocketError _GAddress_translate_from(GAddress *address,
|
||||
InetAddress *addr );
|
||||
GSocketError _GAddress_translate_to(GAddress *address,
|
||||
InetAddress *addr);
|
||||
|
||||
GSocketError _GAddress_Init_INET(GAddress *address);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* wxUSE_SOCKETS || defined(__GSOCKET_STANDALONE__) */
|
||||
|
||||
#endif /* __GSOCK_UNX_H */
|
33
include/wx/mac/macnotfy.h
Normal file
33
include/wx/mac/macnotfy.h
Normal file
@ -0,0 +1,33 @@
|
||||
/* -------------------------------------------------------------------------
|
||||
* Project: Mac Notifier Support
|
||||
* Name: macnotfy.h
|
||||
* Author: Stefan CSomor
|
||||
* Purpose: Mac Notifier include file
|
||||
* CVSID: $Id$
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef MAC_NOTIFYERS
|
||||
#define MAC_NOTIFYERS
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
typedef void (*wxMacNotificationProcPtr)(unsigned long event , void* data ) ;
|
||||
|
||||
typedef void *wxMacNotifierTableRef ;
|
||||
void wxMacCreateNotifierTable() ;
|
||||
void wxMacDestroyNotifierTable() ;
|
||||
wxMacNotifierTableRef wxMacGetNotifierTable() ;
|
||||
void wxMacAddEvent( wxMacNotifierTableRef table , wxMacNotificationProcPtr handler , unsigned long event , void* data , short wakeUp ) ;
|
||||
void wxMacWakeUp() ;
|
||||
void wxMacProcessNotifierEvents() ;
|
||||
void wxMacProcessNotifierAndPendingEvents() ;
|
||||
void wxMacRemoveAllNotifiersForData( wxMacNotifierTableRef table , void* data ) ;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* MAC_NOTIFYERS */
|
166
src/mac/carbon/fontenum.cpp
Normal file
166
src/mac/carbon/fontenum.cpp
Normal file
@ -0,0 +1,166 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: mac/fontenum.cpp
|
||||
// Purpose: wxFontEnumerator class for MacOS
|
||||
// Author: Stefan Csomor
|
||||
// Modified by:
|
||||
// Created: 04/01/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Stefan Csomor
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "fontenum.h"
|
||||
#endif
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/font.h"
|
||||
#endif
|
||||
|
||||
#include "wx/fontenum.h"
|
||||
#include "wx/fontmap.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// private classes
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class wxFontEnumeratorHelper
|
||||
{
|
||||
public:
|
||||
wxFontEnumeratorHelper(wxFontEnumerator *fontEnum);
|
||||
|
||||
// control what exactly are we enumerating
|
||||
bool SetEncoding(wxFontEncoding encoding);
|
||||
void SetFixedOnly(bool fixedOnly)
|
||||
{ m_fixedOnly = fixedOnly; }
|
||||
|
||||
// call to start enumeration
|
||||
void DoEnumerate();
|
||||
|
||||
private:
|
||||
// the object we forward calls to OnFont() to
|
||||
wxFontEnumerator *m_fontEnum;
|
||||
|
||||
// if != -1, enum only fonts which have this encoding
|
||||
int m_charset;
|
||||
|
||||
// if not empty, enum only the fonts with this facename
|
||||
wxString m_facename;
|
||||
|
||||
// if TRUE, enum only fixed fonts
|
||||
bool m_fixedOnly;
|
||||
};
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxFontEnumeratorHelper
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxFontEnumeratorHelper::wxFontEnumeratorHelper(wxFontEnumerator *fontEnum)
|
||||
{
|
||||
m_fontEnum = fontEnum;
|
||||
m_charset = -1;
|
||||
m_fixedOnly = FALSE;
|
||||
}
|
||||
|
||||
bool wxFontEnumeratorHelper::SetEncoding(wxFontEncoding encoding)
|
||||
{
|
||||
wxNativeEncodingInfo info;
|
||||
if ( !wxGetNativeFontEncoding(encoding, &info) )
|
||||
{
|
||||
if ( !wxTheFontMapper->GetAltForEncoding(encoding, &info) )
|
||||
{
|
||||
// no such encodings at all
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
m_charset = info.charset;
|
||||
m_facename = info.facename;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void wxFontEnumeratorHelper::DoEnumerate()
|
||||
{
|
||||
MenuHandle menu ;
|
||||
Str255 name ;
|
||||
short lines ;
|
||||
|
||||
menu = NewMenu( 32000 , "\pFont" ) ;
|
||||
AppendResMenu( menu , 'FONT' ) ;
|
||||
lines = CountMenuItems( menu ) ;
|
||||
|
||||
for ( int i = 1 ; i < lines+1 ; i ++ )
|
||||
{
|
||||
GetMenuItemText( menu , i , name ) ;
|
||||
p2cstr( name ) ;
|
||||
/*
|
||||
|
||||
if ( m_fixedOnly )
|
||||
{
|
||||
// check that it's a fixed pitch font (there is *no* error here, the
|
||||
// flag name is misleading!)
|
||||
if ( tm->tmPitchAndFamily & TMPF_FIXED_PITCH )
|
||||
{
|
||||
// not a fixed pitch font
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_charset != -1 )
|
||||
{
|
||||
// check that we have the right encoding
|
||||
if ( lf->lfCharSet != m_charset )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
m_fontEnum->OnFacename( name ) ;
|
||||
}
|
||||
DisposeMenu( menu ) ;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxFontEnumerator
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding,
|
||||
bool fixedWidthOnly)
|
||||
{
|
||||
wxFontEnumeratorHelper fe(this);
|
||||
if ( fe.SetEncoding(encoding) )
|
||||
{
|
||||
fe.SetFixedOnly(fixedWidthOnly);
|
||||
|
||||
fe.DoEnumerate();
|
||||
}
|
||||
// else: no such fonts, unknown encoding
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxFontEnumerator::EnumerateEncodings(const wxString& family)
|
||||
{
|
||||
wxFAIL_MSG(wxT("TODO"));
|
||||
|
||||
return TRUE;
|
||||
}
|
1593
src/mac/carbon/gsocket.c
Normal file
1593
src/mac/carbon/gsocket.c
Normal file
File diff suppressed because it is too large
Load Diff
137
src/mac/carbon/macnotfy.cpp
Normal file
137
src/mac/carbon/macnotfy.cpp
Normal file
@ -0,0 +1,137 @@
|
||||
/* -------------------------------------------------------------------------
|
||||
* Project: Mac Notifier Support
|
||||
* Name: macnotfy.c
|
||||
* Author: Stefan CSomor
|
||||
* Purpose: Mac Notifier main file
|
||||
* CVSID: $Id$
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "wx/mac/macnotfy.h"
|
||||
|
||||
const short kMaxEvents = 1000 ;
|
||||
|
||||
struct wxMacNotificationEvents
|
||||
{
|
||||
short top ;
|
||||
short bottom ;
|
||||
|
||||
wxMacNotificationProcPtr proc[kMaxEvents] ;
|
||||
unsigned long events[kMaxEvents] ;
|
||||
void* data[kMaxEvents] ;
|
||||
} ;
|
||||
|
||||
typedef struct wxMacNotificationEvents wxMacNotificationEvents ;
|
||||
wxMacNotificationEvents gMacNotificationEvents ;
|
||||
|
||||
ProcessSerialNumber gSocketProcess ;
|
||||
|
||||
void wxMacWakeUp()
|
||||
{
|
||||
ProcessSerialNumber psn ;
|
||||
Boolean isSame ;
|
||||
psn.highLongOfPSN = 0 ;
|
||||
psn.lowLongOfPSN = kCurrentProcess ;
|
||||
SameProcess( &gSocketProcess , &psn , &isSame ) ;
|
||||
if ( isSame )
|
||||
{
|
||||
PostEvent( nullEvent , 0 ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
WakeUpProcess( &gSocketProcess ) ;
|
||||
}
|
||||
}
|
||||
|
||||
void wxMacCreateNotifierTable()
|
||||
{
|
||||
GetCurrentProcess(&gSocketProcess);
|
||||
gMacNotificationEvents.top = 0 ;
|
||||
gMacNotificationEvents.bottom = 0 ;
|
||||
for ( int i = 0 ; i < kMaxEvents ; ++i )
|
||||
{
|
||||
gMacNotificationEvents.proc[i] = NULL ;
|
||||
gMacNotificationEvents.events[i] = NULL ;
|
||||
gMacNotificationEvents.data[i] = NULL ;
|
||||
}
|
||||
}
|
||||
|
||||
void wxMacDestroyNotifierTable()
|
||||
{
|
||||
wxASSERT( gMacNotificationEvents.top == gMacNotificationEvents.bottom ) ;
|
||||
}
|
||||
|
||||
wxMacNotifierTableRef wxMacGetNotifierTable()
|
||||
{
|
||||
return (wxMacNotifierTableRef) &gMacNotificationEvents ;
|
||||
}
|
||||
|
||||
void wxMacAddEvent(
|
||||
wxMacNotifierTableRef table ,
|
||||
wxMacNotificationProcPtr handler ,
|
||||
unsigned long event ,
|
||||
void* data ,
|
||||
short wakeUp )
|
||||
{
|
||||
wxMacNotificationEvents *e = (wxMacNotificationEvents *) table ;
|
||||
/* this should be protected eventually */
|
||||
short index = e->top++ ;
|
||||
|
||||
if ( e->top == kMaxEvents )
|
||||
e->top = 0 ;
|
||||
|
||||
e->proc[index] = handler ;
|
||||
e->events[index] = event ;
|
||||
e->data[index] = data ;
|
||||
if ( wakeUp )
|
||||
wxMacWakeUp() ;
|
||||
}
|
||||
|
||||
bool gInProcessing = false ;
|
||||
|
||||
void wxMacRemoveAllNotifiersForData( wxMacNotifierTableRef table , void* data )
|
||||
{
|
||||
wxMacNotificationEvents *e = (wxMacNotificationEvents *) table ;
|
||||
/* this should be protected eventually */
|
||||
short index = e->bottom ;
|
||||
|
||||
while ( e->top != index )
|
||||
{
|
||||
if ( index == kMaxEvents )
|
||||
index = 0 ;
|
||||
if ( e->data[index] == data )
|
||||
e->data[index] = NULL ;
|
||||
index++ ;
|
||||
}
|
||||
}
|
||||
|
||||
void wxMacProcessNotifierEvents()
|
||||
{
|
||||
// if ( gInProcessing )
|
||||
// return ;
|
||||
|
||||
gInProcessing = true ;
|
||||
while ( gMacNotificationEvents.top != gMacNotificationEvents.bottom )
|
||||
{
|
||||
// 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] ;
|
||||
|
||||
gMacNotificationEvents.data[index] = NULL ;
|
||||
gMacNotificationEvents.events[index] = NULL ;
|
||||
gMacNotificationEvents.proc[index] = NULL ;
|
||||
|
||||
handler( event , data ) ;
|
||||
}
|
||||
gInProcessing = false ;
|
||||
}
|
||||
|
||||
void wxMacProcessNotifierAndPendingEvents()
|
||||
{
|
||||
wxMacProcessNotifierEvents() ;
|
||||
wxTheApp->ProcessPendingEvents() ;
|
||||
}
|
413
src/mac/carbon/notebmac.cpp
Normal file
413
src/mac/carbon/notebmac.cpp
Normal file
@ -0,0 +1,413 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: notebook.cpp
|
||||
// Purpose: implementation of wxNotebook
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "notebook.h"
|
||||
#endif
|
||||
|
||||
#include <wx/string.h>
|
||||
#include <wx/log.h>
|
||||
#include <wx/imaglist.h>
|
||||
#include <wx/notebook.h>
|
||||
#include <wx/mac/uma.h>
|
||||
// ----------------------------------------------------------------------------
|
||||
// macros
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// check that the page index is valid
|
||||
#define IS_VALID_PAGE(nPage) (((nPage) >= 0) && ((nPage) < GetPageCount()))
|
||||
|
||||
const short kwxMacTabLeftMargin = 16 ;
|
||||
const short kwxMacTabTopMargin = 30 ;
|
||||
const short kwxMacTabRightMargin = 16 ;
|
||||
const short kwxMacTabBottomMargin = 16 ;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event table
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if !USE_SHARED_LIBRARIES
|
||||
BEGIN_EVENT_TABLE(wxNotebook, wxControl)
|
||||
EVT_NOTEBOOK_PAGE_CHANGED(-1, wxNotebook::OnSelChange)
|
||||
|
||||
EVT_SIZE(wxNotebook::OnSize)
|
||||
EVT_SET_FOCUS(wxNotebook::OnSetFocus)
|
||||
EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxControl)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxCommandEvent)
|
||||
#endif
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxNotebook construction
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// common part of all ctors
|
||||
void wxNotebook::Init()
|
||||
{
|
||||
m_pImageList = NULL;
|
||||
m_nSelection = -1;
|
||||
}
|
||||
|
||||
// default for dynamic class
|
||||
wxNotebook::wxNotebook()
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
// the same arguments as for wxControl
|
||||
wxNotebook::wxNotebook(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long style,
|
||||
const wxString& name)
|
||||
{
|
||||
Init();
|
||||
|
||||
Create(parent, id, pos, size, style, name);
|
||||
}
|
||||
|
||||
// Create() function
|
||||
bool wxNotebook::Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long style,
|
||||
const wxString& name)
|
||||
{
|
||||
Rect bounds ;
|
||||
Str255 title ;
|
||||
|
||||
MacPreControlCreate( parent , id , "" , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
|
||||
|
||||
m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , 1,
|
||||
kControlTabSmallProc , (long) this ) ;
|
||||
|
||||
MacPostControlCreate() ;
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
// dtor
|
||||
wxNotebook::~wxNotebook()
|
||||
{
|
||||
m_macControl = NULL ;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxNotebook accessors
|
||||
// ----------------------------------------------------------------------------
|
||||
int wxNotebook::GetPageCount() const
|
||||
{
|
||||
return m_aPages.Count();
|
||||
}
|
||||
|
||||
int wxNotebook::GetRowCount() const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int wxNotebook::SetSelection(int nPage)
|
||||
{
|
||||
wxASSERT( IS_VALID_PAGE(nPage) );
|
||||
|
||||
ChangePage(m_nSelection, nPage);
|
||||
SetControlValue( m_macControl , m_nSelection + 1 ) ;
|
||||
// Boolean enabled = true ;
|
||||
|
||||
// SetControlData( m_macControl, m_nSelection + 1, kControlTabEnabledFlagTag, sizeof( Boolean ), (Ptr)&enabled );
|
||||
return m_nSelection;
|
||||
}
|
||||
|
||||
void wxNotebook::AdvanceSelection(bool bForward)
|
||||
{
|
||||
int nSel = GetSelection();
|
||||
int nMax = GetPageCount() - 1;
|
||||
if ( bForward )
|
||||
SetSelection(nSel == nMax ? 0 : nSel + 1);
|
||||
else
|
||||
SetSelection(nSel == 0 ? nMax : nSel - 1);
|
||||
}
|
||||
|
||||
bool wxNotebook::SetPageText(int nPage, const wxString& strText)
|
||||
{
|
||||
wxASSERT( IS_VALID_PAGE(nPage) );
|
||||
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
wxString wxNotebook::GetPageText(int nPage) const
|
||||
{
|
||||
wxASSERT( IS_VALID_PAGE(nPage) );
|
||||
|
||||
// TODO
|
||||
return wxString("");
|
||||
}
|
||||
|
||||
int wxNotebook::GetPageImage(int nPage) const
|
||||
{
|
||||
wxASSERT( IS_VALID_PAGE(nPage) );
|
||||
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool wxNotebook::SetPageImage(int nPage, int nImage)
|
||||
{
|
||||
wxASSERT( IS_VALID_PAGE(nPage) );
|
||||
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void wxNotebook::SetImageList(wxImageList* imageList)
|
||||
{
|
||||
m_pImageList = imageList;
|
||||
// TODO
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxNotebook operations
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// remove one page from the notebook
|
||||
bool wxNotebook::DeletePage(int nPage)
|
||||
{
|
||||
wxCHECK( IS_VALID_PAGE(nPage), FALSE );
|
||||
|
||||
// TODO: delete native widget page
|
||||
|
||||
delete m_aPages[nPage];
|
||||
m_aPages.Remove(nPage);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// remove one page from the notebook, without deleting the window
|
||||
bool wxNotebook::RemovePage(int nPage)
|
||||
{
|
||||
wxCHECK( IS_VALID_PAGE(nPage), FALSE );
|
||||
|
||||
m_aPages.Remove(nPage);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// remove all pages
|
||||
bool wxNotebook::DeleteAllPages()
|
||||
{
|
||||
// TODO: delete native widget pages
|
||||
|
||||
int nPageCount = GetPageCount();
|
||||
int nPage;
|
||||
for ( nPage = 0; nPage < nPageCount; nPage++ )
|
||||
delete m_aPages[nPage];
|
||||
|
||||
m_aPages.Clear();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// add a page to the notebook
|
||||
bool wxNotebook::AddPage(wxNotebookPage *pPage,
|
||||
const wxString& strText,
|
||||
bool bSelect,
|
||||
int imageId)
|
||||
{
|
||||
return InsertPage(GetPageCount(), pPage, strText, bSelect, imageId);
|
||||
}
|
||||
|
||||
// same as AddPage() but does it at given position
|
||||
bool wxNotebook::InsertPage(int nPage,
|
||||
wxNotebookPage *pPage,
|
||||
const wxString& strText,
|
||||
bool bSelect,
|
||||
int imageId)
|
||||
{
|
||||
wxASSERT( pPage != NULL );
|
||||
wxCHECK( IS_VALID_PAGE(nPage) || nPage == GetPageCount(), FALSE );
|
||||
|
||||
ControlTabInfoRec tie ;
|
||||
Boolean enabled = true ;
|
||||
if ( nPage + 1 > GetControlMaximum( m_macControl ) )
|
||||
{
|
||||
SetControlMaximum( m_macControl , nPage + 1 ) ;
|
||||
}
|
||||
|
||||
tie.version = 0 ;
|
||||
tie.iconSuiteID = 0 ;
|
||||
strcpy( (char*) tie.name , strText ) ;
|
||||
c2pstr( (char*) tie.name ) ;
|
||||
SetControlData( m_macControl, nPage + 1, kControlTabInfoTag , sizeof( ControlTabInfoRec) , (char*) &tie ) ;
|
||||
SetControlData( m_macControl, m_nSelection + 1, kControlTabEnabledFlagTag, sizeof( Boolean ), (Ptr)&enabled );
|
||||
|
||||
// save the pointer to the page
|
||||
m_aPages.Insert(pPage, nPage);
|
||||
|
||||
// some page must be selected: either this one or the first one if there is
|
||||
// still no selection
|
||||
if ( bSelect )
|
||||
m_nSelection = nPage;
|
||||
else if ( m_nSelection == -1 )
|
||||
m_nSelection = 0;
|
||||
|
||||
// don't show pages by default (we'll need to adjust their size first)
|
||||
pPage->Show( FALSE ) ;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxNotebook callbacks
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// @@@ OnSize() is used for setting the font when it's called for the first
|
||||
// time because doing it in ::Create() doesn't work (for unknown reasons)
|
||||
void wxNotebook::OnSize(wxSizeEvent& event)
|
||||
{
|
||||
static bool s_bFirstTime = TRUE;
|
||||
if ( s_bFirstTime ) {
|
||||
// TODO: any first-time-size processing.
|
||||
s_bFirstTime = FALSE;
|
||||
}
|
||||
|
||||
// TODO: all this may or may not be necessary for your platform
|
||||
|
||||
// emulate page change (it's esp. important to do it first time because
|
||||
// otherwise our page would stay invisible)
|
||||
int nSel = m_nSelection;
|
||||
m_nSelection = -1;
|
||||
SetSelection(nSel);
|
||||
|
||||
// fit the notebook page to the tab control's display area
|
||||
int w, h;
|
||||
GetSize(&w, &h);
|
||||
|
||||
unsigned int nCount = m_aPages.Count();
|
||||
for ( unsigned int nPage = 0; nPage < nCount; nPage++ ) {
|
||||
wxNotebookPage *pPage = m_aPages[nPage];
|
||||
pPage->SetSize(kwxMacTabLeftMargin, kwxMacTabTopMargin, w - kwxMacTabLeftMargin - kwxMacTabRightMargin,
|
||||
h - kwxMacTabTopMargin - kwxMacTabBottomMargin );
|
||||
// pPage->SetSize(0, 0, w, h);
|
||||
if ( pPage->GetAutoLayout() )
|
||||
pPage->Layout();
|
||||
}
|
||||
|
||||
// Processing continues to next OnSize
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void wxNotebook::OnSelChange(wxNotebookEvent& event)
|
||||
{
|
||||
// is it our tab control?
|
||||
if ( event.GetEventObject() == this )
|
||||
ChangePage(event.GetOldSelection(), event.GetSelection());
|
||||
|
||||
// we want to give others a chance to process this message as well
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void wxNotebook::OnSetFocus(wxFocusEvent& event)
|
||||
{
|
||||
// set focus to the currently selected page if any
|
||||
if ( m_nSelection != -1 )
|
||||
m_aPages[m_nSelection]->SetFocus();
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void wxNotebook::OnNavigationKey(wxNavigationKeyEvent& event)
|
||||
{
|
||||
if ( event.IsWindowChange() ) {
|
||||
// change pages
|
||||
AdvanceSelection(event.GetDirection());
|
||||
}
|
||||
else {
|
||||
// pass to the parent
|
||||
if ( GetParent() ) {
|
||||
event.SetCurrentFocus(this);
|
||||
GetParent()->ProcessEvent(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxNotebook base class virtuals
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// override these 2 functions to do nothing: everything is done in OnSize
|
||||
|
||||
void wxNotebook::SetConstraintSizes(bool /* recurse */)
|
||||
{
|
||||
// don't set the sizes of the pages - their correct size is not yet known
|
||||
wxControl::SetConstraintSizes(FALSE);
|
||||
}
|
||||
|
||||
bool wxNotebook::DoPhase(int /* nPhase */)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void wxNotebook::Command(wxCommandEvent& event)
|
||||
{
|
||||
wxFAIL_MSG("wxNotebook::Command not implemented");
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxNotebook helper functions
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// hide the currently active panel and show the new one
|
||||
void wxNotebook::ChangePage(int nOldSel, int nSel)
|
||||
{
|
||||
// it's not an error (the message may be generated by the tab control itself)
|
||||
// and it may happen - just do nothing
|
||||
if ( nSel == nOldSel )
|
||||
{
|
||||
wxNotebookPage *pPage = m_aPages[nSel];
|
||||
pPage->Show(FALSE);
|
||||
pPage->Show(TRUE);
|
||||
pPage->SetFocus();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( nOldSel != -1 ) {
|
||||
m_aPages[nOldSel]->Show(FALSE);
|
||||
}
|
||||
|
||||
wxNotebookPage *pPage = m_aPages[nSel];
|
||||
pPage->Show(TRUE);
|
||||
pPage->SetFocus();
|
||||
|
||||
m_nSelection = nSel;
|
||||
}
|
||||
|
||||
void wxNotebook::MacHandleControlClick( ControlHandle control , SInt16 controlpart )
|
||||
{
|
||||
wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, m_windowId , ::GetControlValue(m_macControl) - 1, m_nSelection);
|
||||
event.SetEventObject(this);
|
||||
|
||||
ProcessEvent(event);
|
||||
}
|
||||
|
108
src/mac/carbon/statbrma.cpp
Normal file
108
src/mac/carbon/statbrma.cpp
Normal file
@ -0,0 +1,108 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: statbar.cpp
|
||||
// Purpose: native implementation of wxStatusBar (optional)
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1998 AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "statusbr.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/mac/statusbr.h"
|
||||
|
||||
#if !USE_SHARED_LIBRARY
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxStatusBarMac, wxStatusBarGeneric);
|
||||
|
||||
BEGIN_EVENT_TABLE(wxStatusBarMac, wxStatusBarGeneric)
|
||||
EVT_PAINT(wxStatusBarMac::OnPaint)
|
||||
END_EVENT_TABLE()
|
||||
#endif //USE_SHARED_LIBRARY
|
||||
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxStatusBarXX class
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxStatusBarMac::wxStatusBarMac()
|
||||
{
|
||||
SetParent(NULL);
|
||||
}
|
||||
|
||||
wxStatusBarMac::~wxStatusBarMac()
|
||||
{
|
||||
}
|
||||
|
||||
bool wxStatusBarMac::Create(wxWindow *parent, wxWindowID id,
|
||||
long style ,
|
||||
const wxString& name)
|
||||
{
|
||||
return wxStatusBarGeneric::Create( parent , id , style , name ) ;
|
||||
}
|
||||
|
||||
void wxStatusBarMac::DrawFieldText(wxDC& dc, int i)
|
||||
{
|
||||
int leftMargin = 2;
|
||||
|
||||
wxRect rect;
|
||||
GetFieldRect(i, rect);
|
||||
|
||||
wxString text(GetStatusText(i));
|
||||
|
||||
long x, y;
|
||||
|
||||
dc.GetTextExtent(text, &x, &y);
|
||||
|
||||
int xpos = rect.x + leftMargin + 1 ;
|
||||
int ypos = 2 ;
|
||||
|
||||
dc.SetClippingRegion(rect.x, 0, rect.width, m_height);
|
||||
|
||||
dc.DrawText(text, xpos, ypos);
|
||||
|
||||
dc.DestroyClippingRegion();
|
||||
}
|
||||
|
||||
void wxStatusBarMac::DrawField(wxDC& dc, int i)
|
||||
{
|
||||
DrawFieldText(dc, i);
|
||||
}
|
||||
|
||||
void wxStatusBarMac::OnPaint(wxPaintEvent& WXUNUSED(event) )
|
||||
{
|
||||
wxPaintDC dc(this);
|
||||
wxPen black( wxBLACK , 1 , wxSOLID ) ;
|
||||
wxPen white( wxWHITE , 1 , wxSOLID ) ;
|
||||
|
||||
dc.SetPen(black);
|
||||
dc.DrawLine(0, 0 ,
|
||||
m_width , 0);
|
||||
dc.SetPen(white);
|
||||
dc.DrawLine(0, 1 ,
|
||||
m_width , 1);
|
||||
|
||||
|
||||
int i;
|
||||
if ( GetFont().Ok() )
|
||||
dc.SetFont(GetFont());
|
||||
dc.SetBackgroundMode(wxTRANSPARENT);
|
||||
|
||||
for ( i = 0; i < m_nFields; i ++ )
|
||||
DrawField(dc, i);
|
||||
|
||||
# ifdef __WXMSW__
|
||||
dc.SetFont(wxNullFont);
|
||||
# endif // MSW
|
||||
}
|
61
src/mac/carbon/statlmac.cpp
Normal file
61
src/mac/carbon/statlmac.cpp
Normal file
@ -0,0 +1,61 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: generic/statline.cpp
|
||||
// Purpose: a generic wxStaticLine class
|
||||
// Author: Vadim Zeitlin
|
||||
// Created: 28.06.99
|
||||
// Version: $Id$
|
||||
// Copyright: (c) 1998 Vadim Zeitlin
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "statline.h"
|
||||
#endif
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#include "wx/statline.h"
|
||||
#include "wx/statbox.h"
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxStaticLine, wxControl)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxStaticLine
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
bool wxStaticLine::Create( wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint &pos,
|
||||
const wxSize &size,
|
||||
long style,
|
||||
const wxString &name)
|
||||
{
|
||||
if ( !CreateBase(parent, id, pos, size, style, wxDefaultValidator, name) )
|
||||
return FALSE;
|
||||
|
||||
// ok, this is ugly but it's better than nothing: use a thin static box to
|
||||
// emulate static line
|
||||
|
||||
wxSize sizeReal = AdjustSize(size);
|
||||
|
||||
// m_statbox = new wxStaticBox(parent, id, wxT(""), pos, sizeReal, style, name);
|
||||
|
||||
return TRUE;
|
||||
}
|
334
src/mac/carbon/tooltip.cpp
Normal file
334
src/mac/carbon/tooltip.cpp
Normal file
@ -0,0 +1,334 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: tooltip.cpp
|
||||
// Purpose: wxToolTip implementation
|
||||
// Author: Robert Roebling
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "tooltip.h"
|
||||
#endif
|
||||
|
||||
#include "wx/setup.h"
|
||||
|
||||
#if wxUSE_TOOLTIPS
|
||||
|
||||
#include "wx/window.h"
|
||||
#include "wx/tooltip.h"
|
||||
#include "wx/geometry.h"
|
||||
#include "wx/mac/aga.h"
|
||||
#include "wx/mac/uma.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// global data
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxMacToolTip
|
||||
{
|
||||
public :
|
||||
wxMacToolTip( ) ;
|
||||
~wxMacToolTip() ;
|
||||
|
||||
void Setup( WindowRef window , wxString text , wxPoint localPosition ) ;
|
||||
long GetMark() { return m_mark ; }
|
||||
void Draw() ;
|
||||
void Clear() ;
|
||||
bool IsShown() { return m_shown ; }
|
||||
private :
|
||||
|
||||
wxString m_label ;
|
||||
wxPoint m_position ;
|
||||
Rect m_rect ;
|
||||
WindowRef m_window ;
|
||||
PicHandle m_backpict ;
|
||||
bool m_shown ;
|
||||
long m_mark ;
|
||||
} ;
|
||||
|
||||
class wxMacToolTipTimer : wxTimer
|
||||
{
|
||||
public:
|
||||
wxMacToolTipTimer(wxMacToolTip* tip, int iMilliseconds) ;
|
||||
|
||||
void Notify()
|
||||
{
|
||||
if ( m_mark == m_tip->GetMark() )
|
||||
m_tip->Draw() ;
|
||||
|
||||
delete this;
|
||||
}
|
||||
|
||||
protected:
|
||||
wxMacToolTip* m_tip;
|
||||
long m_mark ;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxToolTip
|
||||
//-----------------------------------------------------------------------------
|
||||
static long s_ToolTipDelay = 500 ;
|
||||
static bool s_ShowToolTips = true ;
|
||||
static wxMacToolTip s_ToolTip ;
|
||||
static wxWindow* s_LastWindowEntered = NULL ;
|
||||
static wxRect2DInt s_ToolTipArea ;
|
||||
static WindowRef s_ToolTipWindowRef = NULL ;
|
||||
wxToolTip::wxToolTip( const wxString &tip )
|
||||
{
|
||||
m_text = tip;
|
||||
m_window = (wxWindow*) NULL;
|
||||
}
|
||||
|
||||
wxToolTip::~wxToolTip()
|
||||
{
|
||||
}
|
||||
|
||||
void wxToolTip::SetTip( const wxString &tip )
|
||||
{
|
||||
m_text = tip;
|
||||
|
||||
if ( m_window )
|
||||
{
|
||||
/*
|
||||
// update it immediately
|
||||
wxToolInfo ti(GetHwndOf(m_window));
|
||||
ti.lpszText = (wxChar *)m_text.c_str();
|
||||
|
||||
(void)SendTooltipMessage(GetToolTipCtrl(), TTM_UPDATETIPTEXT, 0, &ti);
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
void wxToolTip::SetWindow( wxWindow *win )
|
||||
{
|
||||
m_window = win;
|
||||
}
|
||||
|
||||
void wxToolTip::Enable( bool flag )
|
||||
{
|
||||
if ( s_ShowToolTips != flag )
|
||||
{
|
||||
s_ShowToolTips = flag ;
|
||||
if ( s_ShowToolTips )
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
s_ToolTip.Clear() ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void wxToolTip::SetDelay( long msecs )
|
||||
{
|
||||
s_ToolTipDelay = msecs ;
|
||||
}
|
||||
|
||||
void wxToolTip::RelayEvent( wxWindow *win , wxMouseEvent &event )
|
||||
{
|
||||
if ( s_ShowToolTips )
|
||||
{
|
||||
if ( event.GetEventType() == wxEVT_LEAVE_WINDOW )
|
||||
{
|
||||
s_ToolTip.Clear() ;
|
||||
}
|
||||
else if (event.GetEventType() == wxEVT_ENTER_WINDOW || event.GetEventType() == wxEVT_MOTION )
|
||||
{
|
||||
wxPoint2DInt where( event.m_x , event.m_y ) ;
|
||||
if ( s_LastWindowEntered == win && s_ToolTipArea.Contains( where ) )
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
s_ToolTip.Clear() ;
|
||||
s_ToolTipArea = wxRect2DInt( event.m_x - 2 , event.m_y - 2 , 4 , 4 ) ;
|
||||
s_LastWindowEntered = win ;
|
||||
|
||||
WindowRef window = win->GetMacRootWindow() ;
|
||||
int x = event.m_x ;
|
||||
int y = event.m_y ;
|
||||
wxPoint local( x , y ) ;
|
||||
win->MacClientToRootWindow( &x, &y ) ;
|
||||
wxPoint windowlocal( x , y ) ;
|
||||
s_ToolTip.Setup( window , win->MacGetToolTipString( local ) , windowlocal ) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void wxToolTip::RemoveToolTips()
|
||||
{
|
||||
s_ToolTip.Clear() ;
|
||||
}
|
||||
// --- mac specific
|
||||
|
||||
wxMacToolTipTimer::wxMacToolTipTimer( wxMacToolTip *tip , int msec )
|
||||
{
|
||||
m_tip = tip;
|
||||
m_mark = tip->GetMark() ;
|
||||
Start(msec, true);
|
||||
}
|
||||
|
||||
wxMacToolTip::wxMacToolTip()
|
||||
{
|
||||
m_window = NULL ;
|
||||
m_backpict = NULL ;
|
||||
m_mark = 0 ;
|
||||
m_shown = false ;
|
||||
}
|
||||
|
||||
void wxMacToolTip::Setup( WindowRef window , wxString text , wxPoint localPosition )
|
||||
{
|
||||
m_mark++ ;
|
||||
Clear() ;
|
||||
m_position = localPosition ;
|
||||
m_label = wxMacMakeMacStringFromPC( text ) ;
|
||||
m_window = window ;
|
||||
s_ToolTipWindowRef = window ;
|
||||
m_backpict = NULL ;
|
||||
new wxMacToolTipTimer( this , s_ToolTipDelay ) ;
|
||||
}
|
||||
|
||||
wxMacToolTip::~wxMacToolTip()
|
||||
{
|
||||
if ( m_backpict )
|
||||
Clear() ;
|
||||
}
|
||||
|
||||
const short kTipBorder = 2 ;
|
||||
const short kTipOffset = 5 ;
|
||||
|
||||
void wxMacToolTip::Draw()
|
||||
{
|
||||
if ( m_label.Length() == 0 )
|
||||
return ;
|
||||
|
||||
if ( m_window == s_ToolTipWindowRef )
|
||||
{
|
||||
#if TARGET_CARBON
|
||||
AGAPortHelper help( GetWindowPort( m_window ) );
|
||||
#else
|
||||
AGAPortHelper help( ( m_window ) );
|
||||
#endif
|
||||
m_shown = true ;
|
||||
|
||||
SetOrigin( 0 , 0 ) ;
|
||||
TextFont( kFontIDGeneva ) ;
|
||||
TextSize( 9 ) ;
|
||||
TextFace( 0 ) ;
|
||||
FontInfo fontInfo;
|
||||
::GetFontInfo(&fontInfo);
|
||||
short lineh = fontInfo.ascent + fontInfo.descent + fontInfo.leading;
|
||||
short height = 0 ;
|
||||
// short width = TextWidth( m_label , 0 ,m_label.Length() ) ;
|
||||
|
||||
int i = 0 ;
|
||||
int length = m_label.Length() ;
|
||||
int width = 0 ;
|
||||
int thiswidth = 0 ;
|
||||
int laststop = 0 ;
|
||||
const char *text = m_label ;
|
||||
while( i < length )
|
||||
{
|
||||
if( text[i] == 13 || text[i] == 10)
|
||||
{
|
||||
thiswidth = ::TextWidth( text , laststop , i - laststop ) ;
|
||||
if ( thiswidth > width )
|
||||
width = thiswidth ;
|
||||
|
||||
height += lineh ;
|
||||
laststop = i+1 ;
|
||||
}
|
||||
i++ ;
|
||||
}
|
||||
if ( i - laststop > 0 )
|
||||
{
|
||||
thiswidth = ::TextWidth( text , laststop , i - laststop ) ;
|
||||
if ( thiswidth > width )
|
||||
width = thiswidth ;
|
||||
height += lineh ;
|
||||
}
|
||||
|
||||
|
||||
m_rect.left = m_position.x + kTipOffset;
|
||||
m_rect.top = m_position.y + kTipOffset;
|
||||
m_rect.right = m_rect.left + width + 2 * kTipBorder;
|
||||
m_rect.bottom = m_rect.top + height + 2 * kTipBorder;
|
||||
ClipRect( &m_rect ) ;
|
||||
BackColor( whiteColor ) ;
|
||||
ForeColor(blackColor ) ;
|
||||
m_backpict = OpenPicture(&m_rect);
|
||||
|
||||
CopyBits(GetPortBitMapForCopyBits(GetWindowPort(m_window)),
|
||||
GetPortBitMapForCopyBits(GetWindowPort(m_window)),
|
||||
&m_rect,
|
||||
&m_rect,
|
||||
srcCopy,
|
||||
NULL);
|
||||
|
||||
ClosePicture();
|
||||
RGBColor yellow = { 0xFFFF , 0xFFFF , (153<<8)+153 } ;
|
||||
RGBBackColor( &yellow ) ;
|
||||
EraseRect( &m_rect ) ;
|
||||
FrameRect( &m_rect ) ;
|
||||
BackColor( whiteColor ) ;
|
||||
ForeColor(blackColor ) ;
|
||||
::MoveTo( m_rect.left + kTipBorder , m_rect.top + fontInfo.ascent + kTipBorder);
|
||||
|
||||
i = 0 ;
|
||||
laststop = 0 ;
|
||||
height = 0 ;
|
||||
while( i < length )
|
||||
{
|
||||
if( text[i] == 13 || text[i] == 10)
|
||||
{
|
||||
::DrawText( text , laststop , i - laststop ) ;
|
||||
height += lineh ;
|
||||
::MoveTo( m_rect.left + kTipBorder , m_rect.top + fontInfo.ascent + kTipBorder + height );
|
||||
laststop = i+1 ;
|
||||
}
|
||||
i++ ;
|
||||
}
|
||||
|
||||
::DrawText( text , laststop , i - laststop ) ;
|
||||
::TextMode( srcOr ) ;
|
||||
|
||||
// DrawText( m_label , 0 , m_label.Length() ) ;
|
||||
}
|
||||
}
|
||||
|
||||
void wxToolTip::NotifyWindowDelete( WindowRef win )
|
||||
{
|
||||
if ( win == s_ToolTipWindowRef )
|
||||
{
|
||||
s_ToolTipWindowRef = NULL ;
|
||||
}
|
||||
}
|
||||
|
||||
void wxMacToolTip::Clear()
|
||||
{
|
||||
m_mark++ ;
|
||||
if ( !m_shown )
|
||||
return ;
|
||||
|
||||
if ( m_window == s_ToolTipWindowRef && m_backpict )
|
||||
{
|
||||
#if TARGET_CARBON
|
||||
AGAPortHelper help( GetWindowPort(m_window) ) ;
|
||||
#else
|
||||
AGAPortHelper help( (m_window) ) ;
|
||||
#endif
|
||||
m_shown = false ;
|
||||
|
||||
SetOrigin( 0 , 0 ) ;
|
||||
BackColor( whiteColor ) ;
|
||||
ForeColor(blackColor ) ;
|
||||
DrawPicture(m_backpict, &m_rect);
|
||||
KillPicture(m_backpict);
|
||||
m_backpict = NULL ;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Binary file not shown.
166
src/mac/fontenum.cpp
Normal file
166
src/mac/fontenum.cpp
Normal file
@ -0,0 +1,166 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: mac/fontenum.cpp
|
||||
// Purpose: wxFontEnumerator class for MacOS
|
||||
// Author: Stefan Csomor
|
||||
// Modified by:
|
||||
// Created: 04/01/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Stefan Csomor
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "fontenum.h"
|
||||
#endif
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#ifndef WX_PRECOMP
|
||||
#include "wx/font.h"
|
||||
#endif
|
||||
|
||||
#include "wx/fontenum.h"
|
||||
#include "wx/fontmap.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// private classes
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class wxFontEnumeratorHelper
|
||||
{
|
||||
public:
|
||||
wxFontEnumeratorHelper(wxFontEnumerator *fontEnum);
|
||||
|
||||
// control what exactly are we enumerating
|
||||
bool SetEncoding(wxFontEncoding encoding);
|
||||
void SetFixedOnly(bool fixedOnly)
|
||||
{ m_fixedOnly = fixedOnly; }
|
||||
|
||||
// call to start enumeration
|
||||
void DoEnumerate();
|
||||
|
||||
private:
|
||||
// the object we forward calls to OnFont() to
|
||||
wxFontEnumerator *m_fontEnum;
|
||||
|
||||
// if != -1, enum only fonts which have this encoding
|
||||
int m_charset;
|
||||
|
||||
// if not empty, enum only the fonts with this facename
|
||||
wxString m_facename;
|
||||
|
||||
// if TRUE, enum only fixed fonts
|
||||
bool m_fixedOnly;
|
||||
};
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxFontEnumeratorHelper
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxFontEnumeratorHelper::wxFontEnumeratorHelper(wxFontEnumerator *fontEnum)
|
||||
{
|
||||
m_fontEnum = fontEnum;
|
||||
m_charset = -1;
|
||||
m_fixedOnly = FALSE;
|
||||
}
|
||||
|
||||
bool wxFontEnumeratorHelper::SetEncoding(wxFontEncoding encoding)
|
||||
{
|
||||
wxNativeEncodingInfo info;
|
||||
if ( !wxGetNativeFontEncoding(encoding, &info) )
|
||||
{
|
||||
if ( !wxTheFontMapper->GetAltForEncoding(encoding, &info) )
|
||||
{
|
||||
// no such encodings at all
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
m_charset = info.charset;
|
||||
m_facename = info.facename;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void wxFontEnumeratorHelper::DoEnumerate()
|
||||
{
|
||||
MenuHandle menu ;
|
||||
Str255 name ;
|
||||
short lines ;
|
||||
|
||||
menu = NewMenu( 32000 , "\pFont" ) ;
|
||||
AppendResMenu( menu , 'FONT' ) ;
|
||||
lines = CountMenuItems( menu ) ;
|
||||
|
||||
for ( int i = 1 ; i < lines+1 ; i ++ )
|
||||
{
|
||||
GetMenuItemText( menu , i , name ) ;
|
||||
p2cstr( name ) ;
|
||||
/*
|
||||
|
||||
if ( m_fixedOnly )
|
||||
{
|
||||
// check that it's a fixed pitch font (there is *no* error here, the
|
||||
// flag name is misleading!)
|
||||
if ( tm->tmPitchAndFamily & TMPF_FIXED_PITCH )
|
||||
{
|
||||
// not a fixed pitch font
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_charset != -1 )
|
||||
{
|
||||
// check that we have the right encoding
|
||||
if ( lf->lfCharSet != m_charset )
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
m_fontEnum->OnFacename( name ) ;
|
||||
}
|
||||
DisposeMenu( menu ) ;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxFontEnumerator
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
bool wxFontEnumerator::EnumerateFacenames(wxFontEncoding encoding,
|
||||
bool fixedWidthOnly)
|
||||
{
|
||||
wxFontEnumeratorHelper fe(this);
|
||||
if ( fe.SetEncoding(encoding) )
|
||||
{
|
||||
fe.SetFixedOnly(fixedWidthOnly);
|
||||
|
||||
fe.DoEnumerate();
|
||||
}
|
||||
// else: no such fonts, unknown encoding
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxFontEnumerator::EnumerateEncodings(const wxString& family)
|
||||
{
|
||||
wxFAIL_MSG(wxT("TODO"));
|
||||
|
||||
return TRUE;
|
||||
}
|
1593
src/mac/gsocket.c
Normal file
1593
src/mac/gsocket.c
Normal file
File diff suppressed because it is too large
Load Diff
Binary file not shown.
137
src/mac/macnotfy.cpp
Normal file
137
src/mac/macnotfy.cpp
Normal file
@ -0,0 +1,137 @@
|
||||
/* -------------------------------------------------------------------------
|
||||
* Project: Mac Notifier Support
|
||||
* Name: macnotfy.c
|
||||
* Author: Stefan CSomor
|
||||
* Purpose: Mac Notifier main file
|
||||
* CVSID: $Id$
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#include "wx/mac/macnotfy.h"
|
||||
|
||||
const short kMaxEvents = 1000 ;
|
||||
|
||||
struct wxMacNotificationEvents
|
||||
{
|
||||
short top ;
|
||||
short bottom ;
|
||||
|
||||
wxMacNotificationProcPtr proc[kMaxEvents] ;
|
||||
unsigned long events[kMaxEvents] ;
|
||||
void* data[kMaxEvents] ;
|
||||
} ;
|
||||
|
||||
typedef struct wxMacNotificationEvents wxMacNotificationEvents ;
|
||||
wxMacNotificationEvents gMacNotificationEvents ;
|
||||
|
||||
ProcessSerialNumber gSocketProcess ;
|
||||
|
||||
void wxMacWakeUp()
|
||||
{
|
||||
ProcessSerialNumber psn ;
|
||||
Boolean isSame ;
|
||||
psn.highLongOfPSN = 0 ;
|
||||
psn.lowLongOfPSN = kCurrentProcess ;
|
||||
SameProcess( &gSocketProcess , &psn , &isSame ) ;
|
||||
if ( isSame )
|
||||
{
|
||||
PostEvent( nullEvent , 0 ) ;
|
||||
}
|
||||
else
|
||||
{
|
||||
WakeUpProcess( &gSocketProcess ) ;
|
||||
}
|
||||
}
|
||||
|
||||
void wxMacCreateNotifierTable()
|
||||
{
|
||||
GetCurrentProcess(&gSocketProcess);
|
||||
gMacNotificationEvents.top = 0 ;
|
||||
gMacNotificationEvents.bottom = 0 ;
|
||||
for ( int i = 0 ; i < kMaxEvents ; ++i )
|
||||
{
|
||||
gMacNotificationEvents.proc[i] = NULL ;
|
||||
gMacNotificationEvents.events[i] = NULL ;
|
||||
gMacNotificationEvents.data[i] = NULL ;
|
||||
}
|
||||
}
|
||||
|
||||
void wxMacDestroyNotifierTable()
|
||||
{
|
||||
wxASSERT( gMacNotificationEvents.top == gMacNotificationEvents.bottom ) ;
|
||||
}
|
||||
|
||||
wxMacNotifierTableRef wxMacGetNotifierTable()
|
||||
{
|
||||
return (wxMacNotifierTableRef) &gMacNotificationEvents ;
|
||||
}
|
||||
|
||||
void wxMacAddEvent(
|
||||
wxMacNotifierTableRef table ,
|
||||
wxMacNotificationProcPtr handler ,
|
||||
unsigned long event ,
|
||||
void* data ,
|
||||
short wakeUp )
|
||||
{
|
||||
wxMacNotificationEvents *e = (wxMacNotificationEvents *) table ;
|
||||
/* this should be protected eventually */
|
||||
short index = e->top++ ;
|
||||
|
||||
if ( e->top == kMaxEvents )
|
||||
e->top = 0 ;
|
||||
|
||||
e->proc[index] = handler ;
|
||||
e->events[index] = event ;
|
||||
e->data[index] = data ;
|
||||
if ( wakeUp )
|
||||
wxMacWakeUp() ;
|
||||
}
|
||||
|
||||
bool gInProcessing = false ;
|
||||
|
||||
void wxMacRemoveAllNotifiersForData( wxMacNotifierTableRef table , void* data )
|
||||
{
|
||||
wxMacNotificationEvents *e = (wxMacNotificationEvents *) table ;
|
||||
/* this should be protected eventually */
|
||||
short index = e->bottom ;
|
||||
|
||||
while ( e->top != index )
|
||||
{
|
||||
if ( index == kMaxEvents )
|
||||
index = 0 ;
|
||||
if ( e->data[index] == data )
|
||||
e->data[index] = NULL ;
|
||||
index++ ;
|
||||
}
|
||||
}
|
||||
|
||||
void wxMacProcessNotifierEvents()
|
||||
{
|
||||
// if ( gInProcessing )
|
||||
// return ;
|
||||
|
||||
gInProcessing = true ;
|
||||
while ( gMacNotificationEvents.top != gMacNotificationEvents.bottom )
|
||||
{
|
||||
// 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] ;
|
||||
|
||||
gMacNotificationEvents.data[index] = NULL ;
|
||||
gMacNotificationEvents.events[index] = NULL ;
|
||||
gMacNotificationEvents.proc[index] = NULL ;
|
||||
|
||||
handler( event , data ) ;
|
||||
}
|
||||
gInProcessing = false ;
|
||||
}
|
||||
|
||||
void wxMacProcessNotifierAndPendingEvents()
|
||||
{
|
||||
wxMacProcessNotifierEvents() ;
|
||||
wxTheApp->ProcessPendingEvents() ;
|
||||
}
|
413
src/mac/notebmac.cpp
Normal file
413
src/mac/notebmac.cpp
Normal file
@ -0,0 +1,413 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: notebook.cpp
|
||||
// Purpose: implementation of wxNotebook
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "notebook.h"
|
||||
#endif
|
||||
|
||||
#include <wx/string.h>
|
||||
#include <wx/log.h>
|
||||
#include <wx/imaglist.h>
|
||||
#include <wx/notebook.h>
|
||||
#include <wx/mac/uma.h>
|
||||
// ----------------------------------------------------------------------------
|
||||
// macros
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// check that the page index is valid
|
||||
#define IS_VALID_PAGE(nPage) (((nPage) >= 0) && ((nPage) < GetPageCount()))
|
||||
|
||||
const short kwxMacTabLeftMargin = 16 ;
|
||||
const short kwxMacTabTopMargin = 30 ;
|
||||
const short kwxMacTabRightMargin = 16 ;
|
||||
const short kwxMacTabBottomMargin = 16 ;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// event table
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#if !USE_SHARED_LIBRARIES
|
||||
BEGIN_EVENT_TABLE(wxNotebook, wxControl)
|
||||
EVT_NOTEBOOK_PAGE_CHANGED(-1, wxNotebook::OnSelChange)
|
||||
|
||||
EVT_SIZE(wxNotebook::OnSize)
|
||||
EVT_SET_FOCUS(wxNotebook::OnSetFocus)
|
||||
EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxControl)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxCommandEvent)
|
||||
#endif
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxNotebook construction
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// common part of all ctors
|
||||
void wxNotebook::Init()
|
||||
{
|
||||
m_pImageList = NULL;
|
||||
m_nSelection = -1;
|
||||
}
|
||||
|
||||
// default for dynamic class
|
||||
wxNotebook::wxNotebook()
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
// the same arguments as for wxControl
|
||||
wxNotebook::wxNotebook(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long style,
|
||||
const wxString& name)
|
||||
{
|
||||
Init();
|
||||
|
||||
Create(parent, id, pos, size, style, name);
|
||||
}
|
||||
|
||||
// Create() function
|
||||
bool wxNotebook::Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint& pos,
|
||||
const wxSize& size,
|
||||
long style,
|
||||
const wxString& name)
|
||||
{
|
||||
Rect bounds ;
|
||||
Str255 title ;
|
||||
|
||||
MacPreControlCreate( parent , id , "" , pos , size ,style, wxDefaultValidator , name , &bounds , title ) ;
|
||||
|
||||
m_macControl = UMANewControl( parent->GetMacRootWindow() , &bounds , title , true , 0 , 0 , 1,
|
||||
kControlTabSmallProc , (long) this ) ;
|
||||
|
||||
MacPostControlCreate() ;
|
||||
return TRUE ;
|
||||
}
|
||||
|
||||
// dtor
|
||||
wxNotebook::~wxNotebook()
|
||||
{
|
||||
m_macControl = NULL ;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxNotebook accessors
|
||||
// ----------------------------------------------------------------------------
|
||||
int wxNotebook::GetPageCount() const
|
||||
{
|
||||
return m_aPages.Count();
|
||||
}
|
||||
|
||||
int wxNotebook::GetRowCount() const
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
int wxNotebook::SetSelection(int nPage)
|
||||
{
|
||||
wxASSERT( IS_VALID_PAGE(nPage) );
|
||||
|
||||
ChangePage(m_nSelection, nPage);
|
||||
SetControlValue( m_macControl , m_nSelection + 1 ) ;
|
||||
// Boolean enabled = true ;
|
||||
|
||||
// SetControlData( m_macControl, m_nSelection + 1, kControlTabEnabledFlagTag, sizeof( Boolean ), (Ptr)&enabled );
|
||||
return m_nSelection;
|
||||
}
|
||||
|
||||
void wxNotebook::AdvanceSelection(bool bForward)
|
||||
{
|
||||
int nSel = GetSelection();
|
||||
int nMax = GetPageCount() - 1;
|
||||
if ( bForward )
|
||||
SetSelection(nSel == nMax ? 0 : nSel + 1);
|
||||
else
|
||||
SetSelection(nSel == 0 ? nMax : nSel - 1);
|
||||
}
|
||||
|
||||
bool wxNotebook::SetPageText(int nPage, const wxString& strText)
|
||||
{
|
||||
wxASSERT( IS_VALID_PAGE(nPage) );
|
||||
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
wxString wxNotebook::GetPageText(int nPage) const
|
||||
{
|
||||
wxASSERT( IS_VALID_PAGE(nPage) );
|
||||
|
||||
// TODO
|
||||
return wxString("");
|
||||
}
|
||||
|
||||
int wxNotebook::GetPageImage(int nPage) const
|
||||
{
|
||||
wxASSERT( IS_VALID_PAGE(nPage) );
|
||||
|
||||
// TODO
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool wxNotebook::SetPageImage(int nPage, int nImage)
|
||||
{
|
||||
wxASSERT( IS_VALID_PAGE(nPage) );
|
||||
|
||||
// TODO
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void wxNotebook::SetImageList(wxImageList* imageList)
|
||||
{
|
||||
m_pImageList = imageList;
|
||||
// TODO
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxNotebook operations
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// remove one page from the notebook
|
||||
bool wxNotebook::DeletePage(int nPage)
|
||||
{
|
||||
wxCHECK( IS_VALID_PAGE(nPage), FALSE );
|
||||
|
||||
// TODO: delete native widget page
|
||||
|
||||
delete m_aPages[nPage];
|
||||
m_aPages.Remove(nPage);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// remove one page from the notebook, without deleting the window
|
||||
bool wxNotebook::RemovePage(int nPage)
|
||||
{
|
||||
wxCHECK( IS_VALID_PAGE(nPage), FALSE );
|
||||
|
||||
m_aPages.Remove(nPage);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// remove all pages
|
||||
bool wxNotebook::DeleteAllPages()
|
||||
{
|
||||
// TODO: delete native widget pages
|
||||
|
||||
int nPageCount = GetPageCount();
|
||||
int nPage;
|
||||
for ( nPage = 0; nPage < nPageCount; nPage++ )
|
||||
delete m_aPages[nPage];
|
||||
|
||||
m_aPages.Clear();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// add a page to the notebook
|
||||
bool wxNotebook::AddPage(wxNotebookPage *pPage,
|
||||
const wxString& strText,
|
||||
bool bSelect,
|
||||
int imageId)
|
||||
{
|
||||
return InsertPage(GetPageCount(), pPage, strText, bSelect, imageId);
|
||||
}
|
||||
|
||||
// same as AddPage() but does it at given position
|
||||
bool wxNotebook::InsertPage(int nPage,
|
||||
wxNotebookPage *pPage,
|
||||
const wxString& strText,
|
||||
bool bSelect,
|
||||
int imageId)
|
||||
{
|
||||
wxASSERT( pPage != NULL );
|
||||
wxCHECK( IS_VALID_PAGE(nPage) || nPage == GetPageCount(), FALSE );
|
||||
|
||||
ControlTabInfoRec tie ;
|
||||
Boolean enabled = true ;
|
||||
if ( nPage + 1 > GetControlMaximum( m_macControl ) )
|
||||
{
|
||||
SetControlMaximum( m_macControl , nPage + 1 ) ;
|
||||
}
|
||||
|
||||
tie.version = 0 ;
|
||||
tie.iconSuiteID = 0 ;
|
||||
strcpy( (char*) tie.name , strText ) ;
|
||||
c2pstr( (char*) tie.name ) ;
|
||||
SetControlData( m_macControl, nPage + 1, kControlTabInfoTag , sizeof( ControlTabInfoRec) , (char*) &tie ) ;
|
||||
SetControlData( m_macControl, m_nSelection + 1, kControlTabEnabledFlagTag, sizeof( Boolean ), (Ptr)&enabled );
|
||||
|
||||
// save the pointer to the page
|
||||
m_aPages.Insert(pPage, nPage);
|
||||
|
||||
// some page must be selected: either this one or the first one if there is
|
||||
// still no selection
|
||||
if ( bSelect )
|
||||
m_nSelection = nPage;
|
||||
else if ( m_nSelection == -1 )
|
||||
m_nSelection = 0;
|
||||
|
||||
// don't show pages by default (we'll need to adjust their size first)
|
||||
pPage->Show( FALSE ) ;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxNotebook callbacks
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// @@@ OnSize() is used for setting the font when it's called for the first
|
||||
// time because doing it in ::Create() doesn't work (for unknown reasons)
|
||||
void wxNotebook::OnSize(wxSizeEvent& event)
|
||||
{
|
||||
static bool s_bFirstTime = TRUE;
|
||||
if ( s_bFirstTime ) {
|
||||
// TODO: any first-time-size processing.
|
||||
s_bFirstTime = FALSE;
|
||||
}
|
||||
|
||||
// TODO: all this may or may not be necessary for your platform
|
||||
|
||||
// emulate page change (it's esp. important to do it first time because
|
||||
// otherwise our page would stay invisible)
|
||||
int nSel = m_nSelection;
|
||||
m_nSelection = -1;
|
||||
SetSelection(nSel);
|
||||
|
||||
// fit the notebook page to the tab control's display area
|
||||
int w, h;
|
||||
GetSize(&w, &h);
|
||||
|
||||
unsigned int nCount = m_aPages.Count();
|
||||
for ( unsigned int nPage = 0; nPage < nCount; nPage++ ) {
|
||||
wxNotebookPage *pPage = m_aPages[nPage];
|
||||
pPage->SetSize(kwxMacTabLeftMargin, kwxMacTabTopMargin, w - kwxMacTabLeftMargin - kwxMacTabRightMargin,
|
||||
h - kwxMacTabTopMargin - kwxMacTabBottomMargin );
|
||||
// pPage->SetSize(0, 0, w, h);
|
||||
if ( pPage->GetAutoLayout() )
|
||||
pPage->Layout();
|
||||
}
|
||||
|
||||
// Processing continues to next OnSize
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void wxNotebook::OnSelChange(wxNotebookEvent& event)
|
||||
{
|
||||
// is it our tab control?
|
||||
if ( event.GetEventObject() == this )
|
||||
ChangePage(event.GetOldSelection(), event.GetSelection());
|
||||
|
||||
// we want to give others a chance to process this message as well
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void wxNotebook::OnSetFocus(wxFocusEvent& event)
|
||||
{
|
||||
// set focus to the currently selected page if any
|
||||
if ( m_nSelection != -1 )
|
||||
m_aPages[m_nSelection]->SetFocus();
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void wxNotebook::OnNavigationKey(wxNavigationKeyEvent& event)
|
||||
{
|
||||
if ( event.IsWindowChange() ) {
|
||||
// change pages
|
||||
AdvanceSelection(event.GetDirection());
|
||||
}
|
||||
else {
|
||||
// pass to the parent
|
||||
if ( GetParent() ) {
|
||||
event.SetCurrentFocus(this);
|
||||
GetParent()->ProcessEvent(event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxNotebook base class virtuals
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// override these 2 functions to do nothing: everything is done in OnSize
|
||||
|
||||
void wxNotebook::SetConstraintSizes(bool /* recurse */)
|
||||
{
|
||||
// don't set the sizes of the pages - their correct size is not yet known
|
||||
wxControl::SetConstraintSizes(FALSE);
|
||||
}
|
||||
|
||||
bool wxNotebook::DoPhase(int /* nPhase */)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void wxNotebook::Command(wxCommandEvent& event)
|
||||
{
|
||||
wxFAIL_MSG("wxNotebook::Command not implemented");
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxNotebook helper functions
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// hide the currently active panel and show the new one
|
||||
void wxNotebook::ChangePage(int nOldSel, int nSel)
|
||||
{
|
||||
// it's not an error (the message may be generated by the tab control itself)
|
||||
// and it may happen - just do nothing
|
||||
if ( nSel == nOldSel )
|
||||
{
|
||||
wxNotebookPage *pPage = m_aPages[nSel];
|
||||
pPage->Show(FALSE);
|
||||
pPage->Show(TRUE);
|
||||
pPage->SetFocus();
|
||||
return;
|
||||
}
|
||||
|
||||
if ( nOldSel != -1 ) {
|
||||
m_aPages[nOldSel]->Show(FALSE);
|
||||
}
|
||||
|
||||
wxNotebookPage *pPage = m_aPages[nSel];
|
||||
pPage->Show(TRUE);
|
||||
pPage->SetFocus();
|
||||
|
||||
m_nSelection = nSel;
|
||||
}
|
||||
|
||||
void wxNotebook::MacHandleControlClick( ControlHandle control , SInt16 controlpart )
|
||||
{
|
||||
wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, m_windowId , ::GetControlValue(m_macControl) - 1, m_nSelection);
|
||||
event.SetEventObject(this);
|
||||
|
||||
ProcessEvent(event);
|
||||
}
|
||||
|
108
src/mac/statbrma.cpp
Normal file
108
src/mac/statbrma.cpp
Normal file
@ -0,0 +1,108 @@
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Name: statbar.cpp
|
||||
// Purpose: native implementation of wxStatusBar (optional)
|
||||
// Author: AUTHOR
|
||||
// Modified by:
|
||||
// Created: ??/??/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 1998 AUTHOR
|
||||
// Licence: wxWindows licence
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "statusbr.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/mac/statusbr.h"
|
||||
|
||||
#if !USE_SHARED_LIBRARY
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxStatusBarMac, wxStatusBarGeneric);
|
||||
|
||||
BEGIN_EVENT_TABLE(wxStatusBarMac, wxStatusBarGeneric)
|
||||
EVT_PAINT(wxStatusBarMac::OnPaint)
|
||||
END_EVENT_TABLE()
|
||||
#endif //USE_SHARED_LIBRARY
|
||||
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxStatusBarXX class
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
wxStatusBarMac::wxStatusBarMac()
|
||||
{
|
||||
SetParent(NULL);
|
||||
}
|
||||
|
||||
wxStatusBarMac::~wxStatusBarMac()
|
||||
{
|
||||
}
|
||||
|
||||
bool wxStatusBarMac::Create(wxWindow *parent, wxWindowID id,
|
||||
long style ,
|
||||
const wxString& name)
|
||||
{
|
||||
return wxStatusBarGeneric::Create( parent , id , style , name ) ;
|
||||
}
|
||||
|
||||
void wxStatusBarMac::DrawFieldText(wxDC& dc, int i)
|
||||
{
|
||||
int leftMargin = 2;
|
||||
|
||||
wxRect rect;
|
||||
GetFieldRect(i, rect);
|
||||
|
||||
wxString text(GetStatusText(i));
|
||||
|
||||
long x, y;
|
||||
|
||||
dc.GetTextExtent(text, &x, &y);
|
||||
|
||||
int xpos = rect.x + leftMargin + 1 ;
|
||||
int ypos = 2 ;
|
||||
|
||||
dc.SetClippingRegion(rect.x, 0, rect.width, m_height);
|
||||
|
||||
dc.DrawText(text, xpos, ypos);
|
||||
|
||||
dc.DestroyClippingRegion();
|
||||
}
|
||||
|
||||
void wxStatusBarMac::DrawField(wxDC& dc, int i)
|
||||
{
|
||||
DrawFieldText(dc, i);
|
||||
}
|
||||
|
||||
void wxStatusBarMac::OnPaint(wxPaintEvent& WXUNUSED(event) )
|
||||
{
|
||||
wxPaintDC dc(this);
|
||||
wxPen black( wxBLACK , 1 , wxSOLID ) ;
|
||||
wxPen white( wxWHITE , 1 , wxSOLID ) ;
|
||||
|
||||
dc.SetPen(black);
|
||||
dc.DrawLine(0, 0 ,
|
||||
m_width , 0);
|
||||
dc.SetPen(white);
|
||||
dc.DrawLine(0, 1 ,
|
||||
m_width , 1);
|
||||
|
||||
|
||||
int i;
|
||||
if ( GetFont().Ok() )
|
||||
dc.SetFont(GetFont());
|
||||
dc.SetBackgroundMode(wxTRANSPARENT);
|
||||
|
||||
for ( i = 0; i < m_nFields; i ++ )
|
||||
DrawField(dc, i);
|
||||
|
||||
# ifdef __WXMSW__
|
||||
dc.SetFont(wxNullFont);
|
||||
# endif // MSW
|
||||
}
|
61
src/mac/statlmac.cpp
Normal file
61
src/mac/statlmac.cpp
Normal file
@ -0,0 +1,61 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: generic/statline.cpp
|
||||
// Purpose: a generic wxStaticLine class
|
||||
// Author: Vadim Zeitlin
|
||||
// Created: 28.06.99
|
||||
// Version: $Id$
|
||||
// Copyright: (c) 1998 Vadim Zeitlin
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "statline.h"
|
||||
#endif
|
||||
|
||||
// For compilers that support precompilation, includes "wx.h".
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#include "wx/statline.h"
|
||||
#include "wx/statbox.h"
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxStaticLine, wxControl)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxStaticLine
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
bool wxStaticLine::Create( wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxPoint &pos,
|
||||
const wxSize &size,
|
||||
long style,
|
||||
const wxString &name)
|
||||
{
|
||||
if ( !CreateBase(parent, id, pos, size, style, wxDefaultValidator, name) )
|
||||
return FALSE;
|
||||
|
||||
// ok, this is ugly but it's better than nothing: use a thin static box to
|
||||
// emulate static line
|
||||
|
||||
wxSize sizeReal = AdjustSize(size);
|
||||
|
||||
// m_statbox = new wxStaticBox(parent, id, wxT(""), pos, sizeReal, style, name);
|
||||
|
||||
return TRUE;
|
||||
}
|
334
src/mac/tooltip.cpp
Normal file
334
src/mac/tooltip.cpp
Normal file
@ -0,0 +1,334 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: tooltip.cpp
|
||||
// Purpose: wxToolTip implementation
|
||||
// Author: Robert Roebling
|
||||
// Id: $Id$
|
||||
// Copyright: (c) 1998 Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "tooltip.h"
|
||||
#endif
|
||||
|
||||
#include "wx/setup.h"
|
||||
|
||||
#if wxUSE_TOOLTIPS
|
||||
|
||||
#include "wx/window.h"
|
||||
#include "wx/tooltip.h"
|
||||
#include "wx/geometry.h"
|
||||
#include "wx/mac/aga.h"
|
||||
#include "wx/mac/uma.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// global data
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
class wxMacToolTip
|
||||
{
|
||||
public :
|
||||
wxMacToolTip( ) ;
|
||||
~wxMacToolTip() ;
|
||||
|
||||
void Setup( WindowRef window , wxString text , wxPoint localPosition ) ;
|
||||
long GetMark() { return m_mark ; }
|
||||
void Draw() ;
|
||||
void Clear() ;
|
||||
bool IsShown() { return m_shown ; }
|
||||
private :
|
||||
|
||||
wxString m_label ;
|
||||
wxPoint m_position ;
|
||||
Rect m_rect ;
|
||||
WindowRef m_window ;
|
||||
PicHandle m_backpict ;
|
||||
bool m_shown ;
|
||||
long m_mark ;
|
||||
} ;
|
||||
|
||||
class wxMacToolTipTimer : wxTimer
|
||||
{
|
||||
public:
|
||||
wxMacToolTipTimer(wxMacToolTip* tip, int iMilliseconds) ;
|
||||
|
||||
void Notify()
|
||||
{
|
||||
if ( m_mark == m_tip->GetMark() )
|
||||
m_tip->Draw() ;
|
||||
|
||||
delete this;
|
||||
}
|
||||
|
||||
protected:
|
||||
wxMacToolTip* m_tip;
|
||||
long m_mark ;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxToolTip
|
||||
//-----------------------------------------------------------------------------
|
||||
static long s_ToolTipDelay = 500 ;
|
||||
static bool s_ShowToolTips = true ;
|
||||
static wxMacToolTip s_ToolTip ;
|
||||
static wxWindow* s_LastWindowEntered = NULL ;
|
||||
static wxRect2DInt s_ToolTipArea ;
|
||||
static WindowRef s_ToolTipWindowRef = NULL ;
|
||||
wxToolTip::wxToolTip( const wxString &tip )
|
||||
{
|
||||
m_text = tip;
|
||||
m_window = (wxWindow*) NULL;
|
||||
}
|
||||
|
||||
wxToolTip::~wxToolTip()
|
||||
{
|
||||
}
|
||||
|
||||
void wxToolTip::SetTip( const wxString &tip )
|
||||
{
|
||||
m_text = tip;
|
||||
|
||||
if ( m_window )
|
||||
{
|
||||
/*
|
||||
// update it immediately
|
||||
wxToolInfo ti(GetHwndOf(m_window));
|
||||
ti.lpszText = (wxChar *)m_text.c_str();
|
||||
|
||||
(void)SendTooltipMessage(GetToolTipCtrl(), TTM_UPDATETIPTEXT, 0, &ti);
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
void wxToolTip::SetWindow( wxWindow *win )
|
||||
{
|
||||
m_window = win;
|
||||
}
|
||||
|
||||
void wxToolTip::Enable( bool flag )
|
||||
{
|
||||
if ( s_ShowToolTips != flag )
|
||||
{
|
||||
s_ShowToolTips = flag ;
|
||||
if ( s_ShowToolTips )
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
s_ToolTip.Clear() ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void wxToolTip::SetDelay( long msecs )
|
||||
{
|
||||
s_ToolTipDelay = msecs ;
|
||||
}
|
||||
|
||||
void wxToolTip::RelayEvent( wxWindow *win , wxMouseEvent &event )
|
||||
{
|
||||
if ( s_ShowToolTips )
|
||||
{
|
||||
if ( event.GetEventType() == wxEVT_LEAVE_WINDOW )
|
||||
{
|
||||
s_ToolTip.Clear() ;
|
||||
}
|
||||
else if (event.GetEventType() == wxEVT_ENTER_WINDOW || event.GetEventType() == wxEVT_MOTION )
|
||||
{
|
||||
wxPoint2DInt where( event.m_x , event.m_y ) ;
|
||||
if ( s_LastWindowEntered == win && s_ToolTipArea.Contains( where ) )
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
s_ToolTip.Clear() ;
|
||||
s_ToolTipArea = wxRect2DInt( event.m_x - 2 , event.m_y - 2 , 4 , 4 ) ;
|
||||
s_LastWindowEntered = win ;
|
||||
|
||||
WindowRef window = win->GetMacRootWindow() ;
|
||||
int x = event.m_x ;
|
||||
int y = event.m_y ;
|
||||
wxPoint local( x , y ) ;
|
||||
win->MacClientToRootWindow( &x, &y ) ;
|
||||
wxPoint windowlocal( x , y ) ;
|
||||
s_ToolTip.Setup( window , win->MacGetToolTipString( local ) , windowlocal ) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void wxToolTip::RemoveToolTips()
|
||||
{
|
||||
s_ToolTip.Clear() ;
|
||||
}
|
||||
// --- mac specific
|
||||
|
||||
wxMacToolTipTimer::wxMacToolTipTimer( wxMacToolTip *tip , int msec )
|
||||
{
|
||||
m_tip = tip;
|
||||
m_mark = tip->GetMark() ;
|
||||
Start(msec, true);
|
||||
}
|
||||
|
||||
wxMacToolTip::wxMacToolTip()
|
||||
{
|
||||
m_window = NULL ;
|
||||
m_backpict = NULL ;
|
||||
m_mark = 0 ;
|
||||
m_shown = false ;
|
||||
}
|
||||
|
||||
void wxMacToolTip::Setup( WindowRef window , wxString text , wxPoint localPosition )
|
||||
{
|
||||
m_mark++ ;
|
||||
Clear() ;
|
||||
m_position = localPosition ;
|
||||
m_label = wxMacMakeMacStringFromPC( text ) ;
|
||||
m_window = window ;
|
||||
s_ToolTipWindowRef = window ;
|
||||
m_backpict = NULL ;
|
||||
new wxMacToolTipTimer( this , s_ToolTipDelay ) ;
|
||||
}
|
||||
|
||||
wxMacToolTip::~wxMacToolTip()
|
||||
{
|
||||
if ( m_backpict )
|
||||
Clear() ;
|
||||
}
|
||||
|
||||
const short kTipBorder = 2 ;
|
||||
const short kTipOffset = 5 ;
|
||||
|
||||
void wxMacToolTip::Draw()
|
||||
{
|
||||
if ( m_label.Length() == 0 )
|
||||
return ;
|
||||
|
||||
if ( m_window == s_ToolTipWindowRef )
|
||||
{
|
||||
#if TARGET_CARBON
|
||||
AGAPortHelper help( GetWindowPort( m_window ) );
|
||||
#else
|
||||
AGAPortHelper help( ( m_window ) );
|
||||
#endif
|
||||
m_shown = true ;
|
||||
|
||||
SetOrigin( 0 , 0 ) ;
|
||||
TextFont( kFontIDGeneva ) ;
|
||||
TextSize( 9 ) ;
|
||||
TextFace( 0 ) ;
|
||||
FontInfo fontInfo;
|
||||
::GetFontInfo(&fontInfo);
|
||||
short lineh = fontInfo.ascent + fontInfo.descent + fontInfo.leading;
|
||||
short height = 0 ;
|
||||
// short width = TextWidth( m_label , 0 ,m_label.Length() ) ;
|
||||
|
||||
int i = 0 ;
|
||||
int length = m_label.Length() ;
|
||||
int width = 0 ;
|
||||
int thiswidth = 0 ;
|
||||
int laststop = 0 ;
|
||||
const char *text = m_label ;
|
||||
while( i < length )
|
||||
{
|
||||
if( text[i] == 13 || text[i] == 10)
|
||||
{
|
||||
thiswidth = ::TextWidth( text , laststop , i - laststop ) ;
|
||||
if ( thiswidth > width )
|
||||
width = thiswidth ;
|
||||
|
||||
height += lineh ;
|
||||
laststop = i+1 ;
|
||||
}
|
||||
i++ ;
|
||||
}
|
||||
if ( i - laststop > 0 )
|
||||
{
|
||||
thiswidth = ::TextWidth( text , laststop , i - laststop ) ;
|
||||
if ( thiswidth > width )
|
||||
width = thiswidth ;
|
||||
height += lineh ;
|
||||
}
|
||||
|
||||
|
||||
m_rect.left = m_position.x + kTipOffset;
|
||||
m_rect.top = m_position.y + kTipOffset;
|
||||
m_rect.right = m_rect.left + width + 2 * kTipBorder;
|
||||
m_rect.bottom = m_rect.top + height + 2 * kTipBorder;
|
||||
ClipRect( &m_rect ) ;
|
||||
BackColor( whiteColor ) ;
|
||||
ForeColor(blackColor ) ;
|
||||
m_backpict = OpenPicture(&m_rect);
|
||||
|
||||
CopyBits(GetPortBitMapForCopyBits(GetWindowPort(m_window)),
|
||||
GetPortBitMapForCopyBits(GetWindowPort(m_window)),
|
||||
&m_rect,
|
||||
&m_rect,
|
||||
srcCopy,
|
||||
NULL);
|
||||
|
||||
ClosePicture();
|
||||
RGBColor yellow = { 0xFFFF , 0xFFFF , (153<<8)+153 } ;
|
||||
RGBBackColor( &yellow ) ;
|
||||
EraseRect( &m_rect ) ;
|
||||
FrameRect( &m_rect ) ;
|
||||
BackColor( whiteColor ) ;
|
||||
ForeColor(blackColor ) ;
|
||||
::MoveTo( m_rect.left + kTipBorder , m_rect.top + fontInfo.ascent + kTipBorder);
|
||||
|
||||
i = 0 ;
|
||||
laststop = 0 ;
|
||||
height = 0 ;
|
||||
while( i < length )
|
||||
{
|
||||
if( text[i] == 13 || text[i] == 10)
|
||||
{
|
||||
::DrawText( text , laststop , i - laststop ) ;
|
||||
height += lineh ;
|
||||
::MoveTo( m_rect.left + kTipBorder , m_rect.top + fontInfo.ascent + kTipBorder + height );
|
||||
laststop = i+1 ;
|
||||
}
|
||||
i++ ;
|
||||
}
|
||||
|
||||
::DrawText( text , laststop , i - laststop ) ;
|
||||
::TextMode( srcOr ) ;
|
||||
|
||||
// DrawText( m_label , 0 , m_label.Length() ) ;
|
||||
}
|
||||
}
|
||||
|
||||
void wxToolTip::NotifyWindowDelete( WindowRef win )
|
||||
{
|
||||
if ( win == s_ToolTipWindowRef )
|
||||
{
|
||||
s_ToolTipWindowRef = NULL ;
|
||||
}
|
||||
}
|
||||
|
||||
void wxMacToolTip::Clear()
|
||||
{
|
||||
m_mark++ ;
|
||||
if ( !m_shown )
|
||||
return ;
|
||||
|
||||
if ( m_window == s_ToolTipWindowRef && m_backpict )
|
||||
{
|
||||
#if TARGET_CARBON
|
||||
AGAPortHelper help( GetWindowPort(m_window) ) ;
|
||||
#else
|
||||
AGAPortHelper help( (m_window) ) ;
|
||||
#endif
|
||||
m_shown = false ;
|
||||
|
||||
SetOrigin( 0 , 0 ) ;
|
||||
BackColor( whiteColor ) ;
|
||||
ForeColor(blackColor ) ;
|
||||
DrawPicture(m_backpict, &m_rect);
|
||||
KillPicture(m_backpict);
|
||||
m_backpict = NULL ;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user