event.SetEventObject(def);
def->Command(event);
return true ;
- }
+ }
}
/* generate wxID_CANCEL if command-. or <esc> has been pressed (typically in dialogs) */
else if (keyval == WXK_ESCAPE || (keyval == '.' && modifiers & cmdKey ) )
// Name: checklst.cpp
// Purpose: implementation of wxCheckListBox class
// Author: Stefan Csomor
-// Modified by:
+// Modified by:
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
}
#if TARGET_API_MAC_OSX
-static pascal void DataBrowserItemNotificationProc(ControlRef browser, DataBrowserItemID itemID,
+static pascal void DataBrowserItemNotificationProc(ControlRef browser, DataBrowserItemID itemID,
DataBrowserItemNotification message, DataBrowserItemDataRef itemData)
#else
-static pascal void DataBrowserItemNotificationProc(ControlRef browser, DataBrowserItemID itemID,
+static pascal void DataBrowserItemNotificationProc(ControlRef browser, DataBrowserItemID itemID,
DataBrowserItemNotification message)
#endif
{
event.SetExtraLong( list->HasMultipleSelection() ? message == kDataBrowserItemSelected : TRUE );
wxPostEvent( list->GetEventHandler() , event ) ;
// direct notification is not always having the listbox GetSelection() having in synch with event
- // list->GetEventHandler()->ProcessEvent(event) ;
- }
+ // list->GetEventHandler()->ProcessEvent(event) ;
+ }
}
}
}
-static pascal OSStatus ListBoxGetSetItemData(ControlRef browser,
- DataBrowserItemID itemID, DataBrowserPropertyID property,
+static pascal OSStatus ListBoxGetSetItemData(ControlRef browser,
+ DataBrowserItemID itemID, DataBrowserPropertyID property,
DataBrowserItemDataRef itemData, Boolean changeValue)
{
- OSStatus err = errDataBrowserPropertyNotSupported;
-
- if ( ! changeValue )
- {
- switch (property)
- {
-
- case kTextColumnId:
- {
- long ref = GetControlReference( browser ) ;
- if ( ref )
- {
- wxCheckListBox* list = wxDynamicCast( (wxObject*) ref , wxCheckListBox ) ;
+ OSStatus err = errDataBrowserPropertyNotSupported;
+
+ if ( ! changeValue )
+ {
+ switch (property)
+ {
+
+ case kTextColumnId:
+ {
+ long ref = GetControlReference( browser ) ;
+ if ( ref )
+ {
+ wxCheckListBox* list = wxDynamicCast( (wxObject*) ref , wxCheckListBox ) ;
int i = itemID - 1 ;
if (i >= 0 && i < list->GetCount() )
- {
- wxMacCFStringHolder cf( list->GetString(i) , list->GetFont().GetEncoding() ) ;
- verify_noerr( ::SetDataBrowserItemDataText( itemData , cf ) ) ;
- err = noErr ;
- }
- }
- }
- break;
- case kCheckboxColumnId :
- {
- long ref = GetControlReference( browser ) ;
- if ( ref )
- {
- wxCheckListBox* list = wxDynamicCast( (wxObject*) ref , wxCheckListBox ) ;
+ {
+ wxMacCFStringHolder cf( list->GetString(i) , list->GetFont().GetEncoding() ) ;
+ verify_noerr( ::SetDataBrowserItemDataText( itemData , cf ) ) ;
+ err = noErr ;
+ }
+ }
+ }
+ break;
+ case kCheckboxColumnId :
+ {
+ long ref = GetControlReference( browser ) ;
+ if ( ref )
+ {
+ wxCheckListBox* list = wxDynamicCast( (wxObject*) ref , wxCheckListBox ) ;
int i = itemID - 1 ;
if (i >= 0 && i < list->GetCount() )
- {
- verify_noerr( ::SetDataBrowserItemDataButtonValue( itemData , list->IsChecked( i ) ? kThemeButtonOn : kThemeButtonOff ) ) ;
- err = noErr ;
- }
- }
- }
- break ;
- case kDataBrowserItemIsEditableProperty:
- {
- err = ::SetDataBrowserItemDataBooleanValue(itemData, true);
- }
- break;
-
- default:
- break;
- }
- }
- else
- {
- switch( property )
- {
- case kCheckboxColumnId :
- {
- long ref = GetControlReference( browser ) ;
- if ( ref )
- {
- wxCheckListBox* list = wxDynamicCast( (wxObject*) ref , wxCheckListBox ) ;
+ {
+ verify_noerr( ::SetDataBrowserItemDataButtonValue( itemData , list->IsChecked( i ) ? kThemeButtonOn : kThemeButtonOff ) ) ;
+ err = noErr ;
+ }
+ }
+ }
+ break ;
+ case kDataBrowserItemIsEditableProperty:
+ {
+ err = ::SetDataBrowserItemDataBooleanValue(itemData, true);
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+ else
+ {
+ switch( property )
+ {
+ case kCheckboxColumnId :
+ {
+ long ref = GetControlReference( browser ) ;
+ if ( ref )
+ {
+ wxCheckListBox* list = wxDynamicCast( (wxObject*) ref , wxCheckListBox ) ;
int i = itemID - 1 ;
if (i >= 0 && i < list->GetCount() )
- {
- // we have to change this behind the back, since Check() would be triggering another update round
+ {
+ // we have to change this behind the back, since Check() would be triggering another update round
bool newVal = !list->IsChecked( i ) ;
- verify_noerr( ::SetDataBrowserItemDataButtonValue( itemData , newVal ? kThemeButtonOn : kThemeButtonOff ) ) ;
- err = noErr ;
- list->m_checks[ i ] = newVal ;
+ verify_noerr( ::SetDataBrowserItemDataButtonValue( itemData , newVal ? kThemeButtonOn : kThemeButtonOff ) ) ;
+ err = noErr ;
+ list->m_checks[ i ] = newVal ;
wxCommandEvent event(wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, list->GetId());
event.SetInt(i);
event.SetEventObject(list);
list->GetEventHandler()->ProcessEvent(event);
- }
- }
-
- }
- break ;
-
- default :
- break ;
- }
- }
-
- return err;
+ }
+ }
+
+ }
+ break ;
+
+ default :
+ break ;
+ }
+ }
+
+ return err;
}
bool wxCheckListBox::Create(wxWindow *parent, wxWindowID id,
const wxPoint& pos,
const wxValidator& validator,
const wxString& name)
{
- m_macIsUserPane = FALSE ;
+ m_macIsUserPane = false ;
wxASSERT_MSG( !(style & wxLB_MULTIPLE) || !(style & wxLB_EXTENDED),
_T("only one of listbox selection modes can be specified") );
-
+
if ( !wxListBoxBase::Create(parent, id, pos, size, style & ~(wxHSCROLL|wxVSCROLL), validator, name) )
return false;
m_peer = new wxMacControl(this) ;
verify_noerr( ::CreateDataBrowserControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()), &bounds, kDataBrowserListView , m_peer->GetControlRefAddr() ) );
-
+
DataBrowserSelectionFlags options = kDataBrowserDragSelect ;
if ( style & wxLB_MULTIPLE )
{
options += kDataBrowserSelectOnlyOne ;
}
- verify_noerr(m_peer->SetSelectionFlags( options ) );
+ verify_noerr(m_peer->SetSelectionFlags( options ) );
DataBrowserListViewColumnDesc columnDesc ;
columnDesc.headerBtnDesc.titleOffset = 0;
- columnDesc.headerBtnDesc.version = kDataBrowserListViewLatestHeaderDesc;
-
- columnDesc.headerBtnDesc.btnFontStyle.flags =
- kControlUseFontMask | kControlUseJustMask;
-
- columnDesc.headerBtnDesc.btnContentInfo.contentType = kControlNoContent;
- columnDesc.headerBtnDesc.btnFontStyle.just = teFlushDefault;
- columnDesc.headerBtnDesc.btnFontStyle.font = kControlFontViewSystemFont;
- columnDesc.headerBtnDesc.btnFontStyle.style = normal;
- columnDesc.headerBtnDesc.titleString = NULL ; // CFSTR( "" );
+ columnDesc.headerBtnDesc.version = kDataBrowserListViewLatestHeaderDesc;
+
+ columnDesc.headerBtnDesc.btnFontStyle.flags =
+ kControlUseFontMask | kControlUseJustMask;
+
+ columnDesc.headerBtnDesc.btnContentInfo.contentType = kControlNoContent;
+ columnDesc.headerBtnDesc.btnFontStyle.just = teFlushDefault;
+ columnDesc.headerBtnDesc.btnFontStyle.font = kControlFontViewSystemFont;
+ columnDesc.headerBtnDesc.btnFontStyle.style = normal;
+ columnDesc.headerBtnDesc.titleString = NULL ; // CFSTR( "" );
// check column
- columnDesc.headerBtnDesc.minimumWidth = 30 ;
- columnDesc.headerBtnDesc.maximumWidth = 30;
+ columnDesc.headerBtnDesc.minimumWidth = 30 ;
+ columnDesc.headerBtnDesc.maximumWidth = 30;
- columnDesc.propertyDesc.propertyID = kCheckboxColumnId;
- columnDesc.propertyDesc.propertyType = kDataBrowserCheckboxType;
- columnDesc.propertyDesc.propertyFlags = kDataBrowserPropertyIsMutable | kDataBrowserTableViewSelectionColumn |
+ columnDesc.propertyDesc.propertyID = kCheckboxColumnId;
+ columnDesc.propertyDesc.propertyType = kDataBrowserCheckboxType;
+ columnDesc.propertyDesc.propertyFlags = kDataBrowserPropertyIsMutable | kDataBrowserTableViewSelectionColumn |
kDataBrowserDefaultPropertyFlags;
- verify_noerr( m_peer->AddListViewColumn( &columnDesc, kDataBrowserListViewAppendColumn) ) ;
+ verify_noerr( m_peer->AddListViewColumn( &columnDesc, kDataBrowserListViewAppendColumn) ) ;
// text column
- columnDesc.headerBtnDesc.minimumWidth = 0;
- columnDesc.headerBtnDesc.maximumWidth = 10000;
+ columnDesc.headerBtnDesc.minimumWidth = 0;
+ columnDesc.headerBtnDesc.maximumWidth = 10000;
- columnDesc.propertyDesc.propertyID = kTextColumnId;
- columnDesc.propertyDesc.propertyType = kDataBrowserTextType;
- columnDesc.propertyDesc.propertyFlags = kDataBrowserTableViewSelectionColumn
+ columnDesc.propertyDesc.propertyID = kTextColumnId;
+ columnDesc.propertyDesc.propertyType = kDataBrowserTextType;
+ columnDesc.propertyDesc.propertyFlags = kDataBrowserTableViewSelectionColumn
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_2
- | kDataBrowserListViewTypeSelectColumn
+ | kDataBrowserListViewTypeSelectColumn
#endif
- ;
+ ;
+
-
- verify_noerr( m_peer->AddListViewColumn( &columnDesc, kDataBrowserListViewAppendColumn) ) ;
+ verify_noerr( m_peer->AddListViewColumn( &columnDesc, kDataBrowserListViewAppendColumn) ) ;
verify_noerr( m_peer->AutoSizeListViewColumns() ) ;
verify_noerr( m_peer->SetHasScrollBars( false , true ) ) ;
DataBrowserCallbacks callbacks ;
callbacks.version = kDataBrowserLatestCallbacks;
InitDataBrowserCallbacks(&callbacks);
- callbacks.u.v1.itemDataCallback = NewDataBrowserItemDataUPP(ListBoxGetSetItemData);
- callbacks.u.v1.itemNotificationCallback =
+ callbacks.u.v1.itemDataCallback = NewDataBrowserItemDataUPP(ListBoxGetSetItemData);
+ callbacks.u.v1.itemNotificationCallback =
#if TARGET_API_MAC_OSX
- (DataBrowserItemNotificationUPP) NewDataBrowserItemNotificationWithItemUPP(DataBrowserItemNotificationProc) ;
+ (DataBrowserItemNotificationUPP) NewDataBrowserItemNotificationWithItemUPP(DataBrowserItemNotificationProc) ;
#else
- NewDataBrowserItemNotificationUPP(DataBrowserItemNotificationProc) ;
+ NewDataBrowserItemNotificationUPP(DataBrowserItemNotificationProc) ;
#endif
m_peer->SetCallbacks( &callbacks);
}
SetBestSize(size); // Needed because it is a wxControlWithItems
-
- return TRUE;
+
+ return true;
}
// ----------------------------------------------------------------------------
bool wxCheckListBox::IsChecked(size_t item) const
{
- wxCHECK_MSG( item < m_checks.GetCount(), FALSE,
+ wxCHECK_MSG( item < m_checks.GetCount(), false,
_T("invalid index in wxCheckListBox::IsChecked") );
return m_checks[item] != 0;
int pos = wxListBox::DoAppend(item);
// the item is initially unchecked
- m_checks.Insert(FALSE, pos);
+ m_checks.Insert(false, pos);
return pos;
}
size_t count = items.GetCount();
for ( size_t n = 0; n < count; n++ )
{
- m_checks.Insert(FALSE, pos + n);
+ m_checks.Insert(false, pos + n);
}
}
size_t count = items.GetCount();
for ( size_t n = 0; n < count; n++ )
{
- m_checks.Add(FALSE);
+ m_checks.Add(false);
}
}
bool wxClipboard::Flush()
{
- return FALSE;
+ return false;
}
bool wxClipboard::Open()
{
- wxCHECK_MSG( !m_open, FALSE, wxT("clipboard already open") );
+ wxCHECK_MSG( !m_open, false, wxT("clipboard already open") );
m_open = true ;
return true ;
}
bool wxClipboard::SetData( wxDataObject *data )
{
- wxCHECK_MSG( m_open, FALSE, wxT("clipboard not open") );
+ wxCHECK_MSG( m_open, false, wxT("clipboard not open") );
- wxCHECK_MSG( data, FALSE, wxT("data is invalid") );
+ wxCHECK_MSG( data, false, wxT("data is invalid") );
Clear();
// as we can only store one wxDataObject, this is the same in this
bool wxClipboard::AddData( wxDataObject *data )
{
- wxCHECK_MSG( m_open, FALSE, wxT("clipboard not open") );
+ wxCHECK_MSG( m_open, false, wxT("clipboard not open") );
- wxCHECK_MSG( data, FALSE, wxT("data is invalid") );
+ wxCHECK_MSG( data, false, wxT("data is invalid") );
/* we can only store one wxDataObject */
Clear();
size_t sz = data->GetDataSize( array[i] ) ;
void* buf = malloc( sz + 1 ) ;
if ( buf )
- {
+ {
// empty the buffer because in some case GetDataHere does not fill buf
memset(buf, 0, sz+1);
data->GetDataHere( array[i] , buf ) ;
wxCHECK_RET( m_open, wxT("clipboard not open") );
m_open = false ;
-
- // Get rid of cached object. If this is not done copying from another application will
- // only work once
+
+ // Get rid of cached object. If this is not done copying from another application will
+ // only work once
if (m_data)
{
delete m_data;
m_data = (wxDataObject*) NULL;
- }
-
+ }
+
}
bool wxClipboard::IsSupported( const wxDataFormat &dataFormat )
{
- if ( m_data )
- {
- return m_data->IsSupported( dataFormat ) ;
- }
+ if ( m_data )
+ {
+ return m_data->IsSupported( dataFormat ) ;
+ }
#if TARGET_CARBON
OSStatus err = noErr;
ScrapRef scrapRef;
{
if (( err = GetScrapFlavorSize( scrapRef, dataFormat.GetFormatId(), &byteCount )) == noErr)
{
- return TRUE ;
+ return true ;
}
}
}
- return FALSE;
+ return false;
#else
long offset ;
bool wxClipboard::GetData( wxDataObject& data )
{
- wxCHECK_MSG( m_open, FALSE, wxT("clipboard not open") );
+ wxCHECK_MSG( m_open, false, wxT("clipboard not open") );
size_t formatcount = data.GetFormatCount() + 1 ;
wxDataFormat *array = new wxDataFormat[ formatcount ];
event.SetEventObject(def);
def->Command(event);
return ;
- }
+ }
}
return;
};
BEGIN_EVENT_TABLE(wxComboBoxChoice, wxChoice)
- EVT_CHOICE(-1, wxComboBoxChoice::OnChoice)
+ EVT_CHOICE(wxID_ANY, wxComboBoxChoice::OnChoice)
END_EVENT_TABLE()
wxComboBox::~wxComboBox()
{
// we might not be fully constructed yet, therefore watch out...
if ( m_choice )
- m_choice->SetSize(0, 0 , width, -1);
+ m_choice->SetSize(0, 0 , width, wxDefaultCoord);
}
else
{
wxCoord wText = width - POPUPWIDTH - MARGIN;
m_text->SetSize(0, 0, wText, height);
- m_choice->SetSize(0 + wText + MARGIN, 0, POPUPWIDTH, -1);
+ m_choice->SetSize(0 + wText + MARGIN, 0, POPUPWIDTH, wxDefaultCoord);
}
#endif
}
else
{
m_text = new wxComboBoxText(this);
- if ( size.y == -1 ) {
+ if ( size.y == wxDefaultCoord ) {
csize.y = m_text->GetSize().y ;
}
}
ProcessCommand(event);
return noErr ;
}
-
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
PixMapHandle bmappixels ;
// Set foreground and background colours (for bitmaps depth = 1)
if(bmp.GetDepth() == 1)
- {
+ {
RGBColor fore = MAC_WXCOLORREF(m_textForegroundColour.GetPixel());
RGBColor back = MAC_WXCOLORREF(m_textBackgroundColour.GetPixel());
RGBForeColor(&fore);
Pattern whiteColor ;
::BackPat(GetQDGlobalsWhite(&whiteColor));
}
-
+
wxASSERT( m_font.Ok() ) ;
-
+
::TextFont( m_font.MacGetFontNum() ) ;
::TextSize( (short)(m_scaleY * m_font.MacGetFontSize()) ) ;
atsuTags, atsuSizes, atsuValues);
wxASSERT_MSG( status == noErr , wxT("couldn't Modify ATSU style") ) ;
-
+
}
Pattern gPatterns[] =
wxString name;
if ( m_data )
{
- name = M_DIR->GetName();
- if ( !name.empty() && (name.Last() == _T('/')) )
- {
- // chop off the last (back)slash
- name.Truncate(name.length() - 1);
- }
+ name = M_DIR->GetName();
+ if ( !name.empty() && (name.Last() == _T('/')) )
+ {
+ // chop off the last (back)slash
+ name.Truncate(name.length() - 1);
+ }
}
return name;
GSocketError GSocket::Connect(GSocketStream stream)
{
InetAddress addr ;
- TEndpointInfo info;
- OSStatus err = kOTNoError;
+ TEndpointInfo info;
+ OSStatus err = kOTNoError;
TCall peer ;
assert(this);
/* Create the socket */
#if TARGET_CARBON
m_endpoint =
- OTOpenEndpointInContext( OTCreateConfiguration( kTCPName) , 0 , &info , &err , NULL ) ;
+ OTOpenEndpointInContext( OTCreateConfiguration( kTCPName) , 0 , &info , &err , NULL ) ;
#else
m_endpoint =
- OTOpenEndpoint( OTCreateConfiguration( kTCPName) , 0 , &info , &err ) ;
+ OTOpenEndpoint( OTCreateConfiguration( kTCPName) , 0 , &info , &err ) ;
#endif
if ( m_endpoint == kOTInvalidEndpointRef || err != kOTNoError )
{
- m_endpoint = kOTInvalidEndpointRef ;
- m_error = GSOCK_IOERR;
- return GSOCK_IOERR;
+ m_endpoint = kOTInvalidEndpointRef ;
+ m_error = GSOCK_IOERR;
+ return GSOCK_IOERR;
}
err = OTBind( m_endpoint , nil , nil ) ;
if ( err != kOTNoError )
{
- return GSOCK_IOERR;
+ return GSOCK_IOERR;
}
SetDefaultEndpointModes( m_endpoint , this ) ;
// TODO
{
if (Output_Timeout() == GSOCK_TIMEDOUT)
{
- OTSndOrderlyDisconnect( m_endpoint ) ;
+ OTSndOrderlyDisconnect( m_endpoint ) ;
m_endpoint = kOTInvalidEndpointRef ;
/* m_error is set in _GSocket_Output_Timeout */
return GSOCK_TIMEDOUT;
if ( ( flags & GSOCK_INPUT_FLAG ) && ! ( m_detected & GSOCK_INPUT_FLAG ) )
{
- size_t sz = 0 ;
- OTCountDataBytes( m_endpoint , &sz ) ;
- if ( state == T_INCON || sz > 0 )
- {
- m_detected |= GSOCK_INPUT_FLAG ;
- (m_cbacks[GSOCK_INPUT])(this, GSOCK_INPUT, m_data[GSOCK_INPUT]);
- }
+ size_t sz = 0 ;
+ OTCountDataBytes( m_endpoint , &sz ) ;
+ if ( state == T_INCON || sz > 0 )
+ {
+ m_detected |= GSOCK_INPUT_FLAG ;
+ (m_cbacks[GSOCK_INPUT])(this, GSOCK_INPUT, m_data[GSOCK_INPUT]);
+ }
}
if ( ( flags & GSOCK_INPUT_FLAG ) && ! ( m_detected & GSOCK_OUTPUT_FLAG ) )
{
- if ( state == T_DATAXFER || state == T_INREL )
- {
- m_detected |=GSOCK_OUTPUT_FLAG ;
- (m_cbacks[GSOCK_OUTPUT])(this, GSOCK_OUTPUT, m_data[GSOCK_OUTPUT]);
- }
+ if ( state == T_DATAXFER || state == T_INREL )
+ {
+ m_detected |=GSOCK_OUTPUT_FLAG ;
+ (m_cbacks[GSOCK_OUTPUT])(this, GSOCK_OUTPUT, m_data[GSOCK_OUTPUT]);
+ }
}
*/
return ( flags & m_detected ) ;
int GSocket::Recv_Stream(char *buffer, int size)
{
- OTFlags flags ;
- OTResult res ;
- OTByteCount sz = 0 ;
-
- OTCountDataBytes( m_endpoint , &sz ) ;
- if ( size > (int)sz )
- size = sz ;
- res = OTRcv( m_endpoint , buffer , size , &flags ) ;
- if ( res < 0 )
- {
- return -1 ;
- }
-
- // we simulate another read event if there are still bytes
- if ( m_takesEvents )
- {
- OTByteCount sz = 0 ;
- OTCountDataBytes( m_endpoint , &sz ) ;
- if ( sz > 0 )
- {
- m_detected |= GSOCK_INPUT_FLAG ;
- (m_cbacks[GSOCK_INPUT])(this, GSOCK_INPUT, m_data[GSOCK_INPUT]);
- }
- }
- return res ;
+ OTFlags flags ;
+ OTResult res ;
+ OTByteCount sz = 0 ;
+
+ OTCountDataBytes( m_endpoint , &sz ) ;
+ if ( size > (int)sz )
+ size = sz ;
+ res = OTRcv( m_endpoint , buffer , size , &flags ) ;
+ if ( res < 0 )
+ {
+ return -1 ;
+ }
+
+ // we simulate another read event if there are still bytes
+ if ( m_takesEvents )
+ {
+ OTByteCount sz = 0 ;
+ OTCountDataBytes( m_endpoint , &sz ) ;
+ if ( sz > 0 )
+ {
+ m_detected |= GSOCK_INPUT_FLAG ;
+ (m_cbacks[GSOCK_INPUT])(this, GSOCK_INPUT, m_data[GSOCK_INPUT]);
+ }
+ }
+ return res ;
}
int GSocket::Recv_Dgram(char *buffer, int size)
int GSocket::Send_Stream(const char *buffer, int size)
{
- OTFlags flags = 0 ;
- OTResult res ;
+ OTFlags flags = 0 ;
+ OTResult res ;
- res = OTSnd( m_endpoint , (void*) buffer , size , flags ) ;
- return res ;
+ res = OTSnd( m_endpoint , (void*) buffer , size , flags ) ;
+ return res ;
}
int GSocket::Send_Dgram(const char *buffer, int size)
GSocketError _GAddress_translate_to(GAddress *address,
InetAddress *addr)
{
- if ( !GSocket_Verify_Inited() )
+ if ( !GSocket_Verify_Inited() )
return GSOCK_IOERR ;
memset(addr, 0 , sizeof(struct InetAddress));
OTInitInetAddress( addr , address->m_port , address->m_host ) ;
ret = OTInetStringToAddress( gInetSvcRef , (char*) hostname , &hinfo ) ;
if ( ret != kOTNoError )
{
- address->m_host = INADDR_NONE ;
+ address->m_host = INADDR_NONE ;
address->m_error = GSOCK_NOHOST;
return GSOCK_NOHOST;
}
struct service_entry
{
- const char * name ;
- unsigned short port ;
- const char * protocol ;
+ const char * name ;
+ unsigned short port ;
+ const char * protocol ;
} ;
typedef struct service_entry service_entry ;
service_entry gServices[] =
{
- { "http" , 80 , "tcp" }
+ { "http" , 80 , "tcp" }
} ;
GSocketError GAddress_INET_SetPortName(GAddress *address, const char *port,
}
for ( i = 0 ; i < sizeof( gServices) / sizeof( service_entry ) ; ++i )
{
- if ( strcmp( port , gServices[i].name ) == 0 )
- {
- if ( protocol == NULL || strcmp( protocol , gServices[i].protocol ) )
- {
- address->m_port = gServices[i].port ;
- return GSOCK_NOERROR;
- }
- }
+ if ( strcmp( port , gServices[i].name ) == 0 )
+ {
+ if ( protocol == NULL || strcmp( protocol , gServices[i].protocol ) )
+ {
+ address->m_port = gServices[i].port ;
+ return GSOCK_NOERROR;
+ }
+ }
}
if (isdigit(port[0]))
GSocketError GAddress_INET_GetHostName(GAddress *address, char *hostname, size_t sbuf)
{
InetDomainName name ;
- if ( !GSocket_Verify_Inited() )
+ if ( !GSocket_Verify_Inited() )
return GSOCK_IOERR ;
assert(address != NULL);
void GSocket::Enable_Events()
{
- if ( m_takesEvents )
- return ;
+ if ( m_takesEvents )
+ return ;
- {
- OTResult state ;
- m_takesEvents = true ;
- state = OTGetEndpointState(m_endpoint);
-
- {
- OTByteCount sz = 0 ;
- OTCountDataBytes( m_endpoint , &sz ) ;
- if ( state == T_INCON || sz > 0 )
- {
- m_detected |= GSOCK_INPUT_FLAG ;
- (m_cbacks[GSOCK_INPUT])(this, GSOCK_INPUT, m_data[GSOCK_INPUT]);
- }
- }
- {
- if ( state == T_DATAXFER || state == T_INREL )
- {
- m_detected |=GSOCK_OUTPUT_FLAG ;
- (m_cbacks[GSOCK_OUTPUT])(this, GSOCK_OUTPUT, m_data[GSOCK_OUTPUT]);
- }
- }
- }
+ {
+ OTResult state ;
+ m_takesEvents = true ;
+ state = OTGetEndpointState(m_endpoint);
+
+ {
+ OTByteCount sz = 0 ;
+ OTCountDataBytes( m_endpoint , &sz ) ;
+ if ( state == T_INCON || sz > 0 )
+ {
+ m_detected |= GSOCK_INPUT_FLAG ;
+ (m_cbacks[GSOCK_INPUT])(this, GSOCK_INPUT, m_data[GSOCK_INPUT]);
+ }
+ }
+ {
+ if ( state == T_DATAXFER || state == T_INREL )
+ {
+ m_detected |=GSOCK_OUTPUT_FLAG ;
+ (m_cbacks[GSOCK_OUTPUT])(this, GSOCK_OUTPUT, m_data[GSOCK_OUTPUT]);
+ }
+ }
+ }
}
void GSocket::Disable_Events()
{
- m_takesEvents = false ;
+ m_takesEvents = false ;
}
/* _GSocket_Input_Timeout:
while( (now.hi * 4294967296.0 + now.lo) - (start.hi * 4294967296.0 + start.lo) < m_timeout * 1000.0 )
{
- OTResult state ;
- OTByteCount sz = 0 ;
- state = OTGetEndpointState(m_endpoint);
-
- OTCountDataBytes( m_endpoint , &sz ) ;
- if ( state == T_INCON || sz > 0 )
- {
- m_takesEvents = formerTakesEvents ;
- return GSOCK_NOERROR;
- }
- Microseconds(&now);
+ OTResult state ;
+ OTByteCount sz = 0 ;
+ state = OTGetEndpointState(m_endpoint);
+
+ OTCountDataBytes( m_endpoint , &sz ) ;
+ if ( state == T_INCON || sz > 0 )
+ {
+ m_takesEvents = formerTakesEvents ;
+ return GSOCK_NOERROR;
+ }
+ Microseconds(&now);
}
m_takesEvents = formerTakesEvents ;
m_error = GSOCK_TIMEDOUT;
while( (now.hi * 4294967296.0 + now.lo) - (start.hi * 4294967296.0 + start.lo) < m_timeout * 1000.0 )
{
- OTResult state ;
- state = OTGetEndpointState(m_endpoint);
-
- if ( state == T_DATAXFER || state == T_INREL )
- {
- m_takesEvents = formerTakesEvents ;
- return GSOCK_NOERROR;
- }
- Microseconds(&now);
+ OTResult state ;
+ state = OTGetEndpointState(m_endpoint);
+
+ if ( state == T_DATAXFER || state == T_INREL )
+ {
+ m_takesEvents = formerTakesEvents ;
+ return GSOCK_NOERROR;
+ }
+ Microseconds(&now);
}
m_takesEvents = formerTakesEvents ;
m_error = GSOCK_TIMEDOUT;
*/
if ( /* (socket != NULL) && */ (socket->m_takesEvents))
{
- switch (ev)
- {
- case T_LISTEN :
- event = GSOCK_CONNECTION ;
- break ;
- case T_CONNECT :
- event = GSOCK_CONNECTION ;
- event2 = GSOCK_OUTPUT ;
- {
- TCall retCall;
-
- retCall.addr.buf = NULL;
- retCall.addr.maxlen = 0;
- retCall.opt.buf = NULL;
- retCall.opt.maxlen = 0;
- retCall.udata.buf = NULL;
- retCall.udata.maxlen= 0;
- OTRcvConnect( socket->m_endpoint , &retCall ) ;
- }
- break ;
- case T_DISCONNECT :
- event = GSOCK_LOST ;
- break ;
- case T_GODATA :
- case T_GOEXDATA :
- event = GSOCK_OUTPUT ;
- break ;
- case T_DATA :
- event = GSOCK_INPUT ;
- break ;
- case T_EXDATA :
- event = GSOCK_INPUT ;
- break ;
+ switch (ev)
+ {
+ case T_LISTEN :
+ event = GSOCK_CONNECTION ;
+ break ;
+ case T_CONNECT :
+ event = GSOCK_CONNECTION ;
+ event2 = GSOCK_OUTPUT ;
+ {
+ TCall retCall;
+
+ retCall.addr.buf = NULL;
+ retCall.addr.maxlen = 0;
+ retCall.opt.buf = NULL;
+ retCall.opt.maxlen = 0;
+ retCall.udata.buf = NULL;
+ retCall.udata.maxlen = 0;
+ OTRcvConnect( socket->m_endpoint , &retCall ) ;
+ }
+ break ;
+ case T_DISCONNECT :
+ event = GSOCK_LOST ;
+ break ;
+ case T_GODATA :
+ case T_GOEXDATA :
+ event = GSOCK_OUTPUT ;
+ break ;
+ case T_DATA :
+ event = GSOCK_INPUT ;
+ break ;
+ case T_EXDATA :
+ event = GSOCK_INPUT ;
+ break ;
}
if (event != GSOCK_MAX_EVENT)
{
if ( !
#if wxUSE_CREATEMOVIECONTROL
- ctrl->wxWindow::Create(parent, id, pos, size,
- wxWindow::MacRemoveBordersFromStyle(style),
- name)
+ ctrl->wxWindow::Create(parent, id, pos, size,
+ wxWindow::MacRemoveBordersFromStyle(style),
+ name)
#else
- ctrl->wxControl::Create(parent, id, pos, size,
- wxWindow::MacRemoveBordersFromStyle(style),
- validator, name)
+ ctrl->wxControl::Create(parent, id, pos, size,
+ wxWindow::MacRemoveBordersFromStyle(style),
+ validator, name)
#endif
)
return false;
#if wxUSE_VALIDATORS
- ctrl->SetValidator(validator);
+ ctrl->SetValidator(validator);
#endif
m_ctrl = ctrl;
movieTrackEnabledOnly) != NULL)
{
#if wxUSE_CREATEMOVIECONTROL
- //
- //Native CreateMovieControl QT control (Thanks to Kevin Olliver's
- //wxQTMovie for some of this).
- //
- #define GetControlPeer(whatever) ctrl->m_peer
- wxMediaCtrl* ctrl = (wxMediaCtrl*) m_ctrl;
- Rect bounds = wxMacGetBoundsForControl(m_ctrl,
- m_ctrl->GetPosition(),
- m_ctrl->GetSize());
-
- //Dispose of old control for new one
- if (GetControlPeer(m_ctrl) && GetControlPeer(m_ctrl)->Ok() )
- GetControlPeer(m_ctrl)->Dispose();
-
- //Options-
- //kMovieControlOptionXXX
- //HideController - hide the movie controller
- //LocateTopLeft - movie is pinned to top left rather than centered in the control
- //EnableEditing - Allows programmatic editing and dragn'drop
- //HandleEditingHI- Installs event stuff for edit menu - forces EnableEditing also
- //SetKeysEnabled - Allows keyboard input
- //ManuallyIdled - app handles movie idling rather than internal timer event loop
+ //
+ //Native CreateMovieControl QT control (Thanks to Kevin Olliver's
+ //wxQTMovie for some of this).
+ //
+ #define GetControlPeer(whatever) ctrl->m_peer
+ wxMediaCtrl* ctrl = (wxMediaCtrl*) m_ctrl;
+ Rect bounds = wxMacGetBoundsForControl(m_ctrl,
+ m_ctrl->GetPosition(),
+ m_ctrl->GetSize());
+
+ //Dispose of old control for new one
+ if (GetControlPeer(m_ctrl) && GetControlPeer(m_ctrl)->Ok() )
+ GetControlPeer(m_ctrl)->Dispose();
+
+ //Options-
+ //kMovieControlOptionXXX
+ //HideController - hide the movie controller
+ //LocateTopLeft - movie is pinned to top left rather than centered in the control
+ //EnableEditing - Allows programmatic editing and dragn'drop
+ //HandleEditingHI- Installs event stuff for edit menu - forces EnableEditing also
+ //SetKeysEnabled - Allows keyboard input
+ //ManuallyIdled - app handles movie idling rather than internal timer event loop
::CreateMovieControl(
(WindowRef)
ctrl->MacGetTopLevelWindowRef(), //parent
::EmbedControl(ctrl->m_peer->GetControlRef(), (ControlRef)ctrl->GetParent()->GetHandle());
#else
- //
- //"Emulation"
- //
+ //
+ //"Emulation"
+ //
SetMovieGWorld(m_movie,
(CGrafPtr)
GetWindowPort(
FORCE_LINK_ME(basewxmediabackends);
#endif //wxUSE_MEDIACTRL
-
-
-
-
-
// Name: menuitem.cpp
// Purpose: wxMenuItem implementation
// Author: Stefan Csomor
-// Modified by:
+// Modified by:
// Created: 1998-01-01
// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
const wxString& text,
const wxString& strHelp,
wxItemKind kind,
- wxMenu *pSubMenu)
- : wxMenuItemBase(pParentMenu, id, text, strHelp, kind, pSubMenu)
+ wxMenu *pSubMenu)
+ :wxMenuItemBase(pParentMenu, id, text, strHelp, kind, pSubMenu)
{
wxASSERT_MSG( id != 0 || pSubMenu != NULL , wxT("A MenuItem ID of Zero does not work under Mac") ) ;
-
+
// In other languages there is no difference in naming the Exit/Quit menu item between MacOS and Windows guidelines
// therefore these item must not be translated
if ( wxStripMenuCodes(m_text).Upper() == wxT("EXIT") )
}
m_radioGroup.start = -1;
- m_isRadioGroupStart = FALSE;
+ m_isRadioGroupStart = false;
}
-wxMenuItem::~wxMenuItem()
+wxMenuItem::~wxMenuItem()
{
}
// change item state
// -----------------
-void wxMenuItem::SetBitmap(const wxBitmap& bitmap)
-{
- m_bitmap = bitmap;
- UpdateItemBitmap() ;
+void wxMenuItem::SetBitmap(const wxBitmap& bitmap)
+{
+ m_bitmap = bitmap;
+ UpdateItemBitmap();
}
-void wxMenuItem::UpdateItemBitmap()
+void wxMenuItem::UpdateItemBitmap()
{
if ( !m_parentMenu )
return ;
-
+
MenuHandle mhandle = MAC_WXHMENU(m_parentMenu->GetHMenu()) ;
MenuItemIndex index = m_parentMenu->MacGetIndexFromItem( this ) ;
if( mhandle == NULL || index == 0)
return ;
-
+
if ( m_bitmap.Ok() )
{
#if wxUSE_BMPBUTTON
if ( info.contentType != kControlNoContent )
{
if ( info.contentType == kControlContentIconRef )
- SetMenuItemIconHandle( mhandle , index ,
+ SetMenuItemIconHandle( mhandle , index ,
kMenuIconRefType , (Handle) info.u.iconRef ) ;
}
wxMacReleaseBitmapButton( &info ) ;
-#endif
+#endif
}
}
-void wxMenuItem::UpdateItemStatus()
+void wxMenuItem::UpdateItemStatus()
{
if ( !m_parentMenu )
return ;
-
+
#if TARGET_CARBON
if ( UMAGetSystemVersion() >= 0x1000 && GetId() == wxApp::s_macPreferencesMenuItemId)
{
EnableMenuCommand( NULL , kHICommandQuit ) ;
}
#endif
- {
+ {
MenuHandle mhandle = MAC_WXHMENU(m_parentMenu->GetHMenu()) ;
MenuItemIndex index = m_parentMenu->MacGetIndexFromItem( this ) ;
if( mhandle == NULL || index == 0)
return ;
- UMAEnableMenuItem( mhandle , index , m_isEnabled ) ;
- if ( IsCheckable() && IsChecked() )
+ UMAEnableMenuItem( mhandle , index , m_isEnabled ) ;
+ if ( IsCheckable() && IsChecked() )
::SetItemMark( mhandle , index , 0x12 ) ; // checkmark
else
::SetItemMark( mhandle , index , 0 ) ; // no mark
- UMASetMenuItemText( mhandle , index , m_text , wxFont::GetDefaultEncoding() ) ;
- wxAcceleratorEntry *entry = wxGetAccelFromString( m_text ) ;
+ UMASetMenuItemText( mhandle , index , m_text , wxFont::GetDefaultEncoding() ) ;
+ wxAcceleratorEntry *entry = wxGetAccelFromString( m_text ) ;
UMASetMenuItemShortcut( mhandle , index , entry ) ;
delete entry ;
}
}
-void wxMenuItem::UpdateItemText()
+void wxMenuItem::UpdateItemText()
{
if ( !m_parentMenu )
return ;
-
+
MenuHandle mhandle = MAC_WXHMENU(m_parentMenu->GetHMenu()) ;
MenuItemIndex index = m_parentMenu->MacGetIndexFromItem( this ) ;
if( mhandle == NULL || index == 0)
return ;
- UMASetMenuItemText( mhandle , index , m_text , wxFont::GetDefaultEncoding() ) ;
- wxAcceleratorEntry *entry = wxGetAccelFromString( m_text ) ;
+ UMASetMenuItemText( mhandle , index , m_text , wxFont::GetDefaultEncoding() ) ;
+ wxAcceleratorEntry *entry = wxGetAccelFromString( m_text ) ;
UMASetMenuItemShortcut( mhandle , index , entry ) ;
delete entry ;
}
}
void wxMenuItem::UncheckRadio()
{
- if ( m_isChecked )
+ if ( m_isChecked )
{
wxMenuItemBase::Check( false ) ;
UpdateItemStatus() ;
{
wxCHECK_RET( IsCheckable(), wxT("only checkable items may be checked") );
- if ( m_isChecked != bDoCheck )
+ if ( m_isChecked != bDoCheck )
{
if ( GetKind() == wxITEM_RADIO )
{
{
wxMenuItemBase::Check( bDoCheck ) ;
UpdateItemStatus() ;
-
+
// get the index of this item in the menu
const wxMenuItemList& items = m_parentMenu->GetMenuItems();
int pos = items.IndexOf(this);
return;
wxMenuItemBase::SetText(text);
-
+
UpdateItemText() ;
}
void wxMenuItem::SetAsRadioGroupStart()
{
- m_isRadioGroupStart = TRUE;
+ m_isRadioGroupStart = true;
}
void wxMenuItem::SetRadioGroupStart(int start)
// Created: ??/??/98
// RCS-ID: $Id$
// Copyright: (c) AUTHOR
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
const wxValidator& validator,
const wxString& name)
{
- m_macIsUserPane = FALSE ;
-
+ m_macIsUserPane = false ;
+
if ( !wxControl::Create(parent, id, pos, size, style, validator, name) )
return false;
-
+
m_label = label ;
Rect bounds = wxMacGetBoundsForControl( this , pos , size ) ;
-
+
m_peer = new wxMacControl(this) ;
- verify_noerr ( CreateRadioButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") ,
+ verify_noerr ( CreateRadioButtonControl( MAC_WXHWND(parent->MacGetTopLevelWindowRef()) , &bounds , CFSTR("") ,
0 , false /* no autotoggle */ , m_peer->GetControlRefAddr() ) );
-
+
MacPostControlCreate(pos,size) ;
- m_cycle = this ;
-
- if (HasFlag(wxRB_GROUP))
- {
- AddInCycle( NULL ) ;
- }
- else
- {
- /* search backward for last group start */
- wxRadioButton *chief = (wxRadioButton*) NULL;
- wxWindowList::compatibility_iterator node = parent->GetChildren().GetLast();
- while (node)
+ m_cycle = this ;
+
+ if (HasFlag(wxRB_GROUP))
{
- wxWindow *child = node->GetData();
- if (child->IsKindOf( CLASSINFO( wxRadioButton ) ) )
- {
- chief = (wxRadioButton*) child;
- if (child->HasFlag(wxRB_GROUP)) break;
- }
- node = node->GetPrevious();
+ AddInCycle( NULL ) ;
}
- AddInCycle( chief ) ;
- }
- return TRUE;
+ else
+ {
+ /* search backward for last group start */
+ wxRadioButton *chief = (wxRadioButton*) NULL;
+ wxWindowList::compatibility_iterator node = parent->GetChildren().GetLast();
+ while (node)
+ {
+ wxWindow *child = node->GetData();
+ if (child->IsKindOf( CLASSINFO( wxRadioButton ) ) )
+ {
+ chief = (wxRadioButton*) child;
+ if (child->HasFlag(wxRB_GROUP)) break;
+ }
+ node = node->GetPrevious();
+ }
+ AddInCycle( chief ) ;
+ }
+ return true;
}
void wxRadioButton::SetValue(bool val)
wxRadioButton *cycle;
if ( m_peer->GetValue() == val )
return ;
-
+
m_peer->SetValue( val ) ;
- if (val)
+ if (val)
{
cycle=this->NextInCycle();
- if (cycle!=NULL)
+ if (cycle!=NULL)
{
- while (cycle!=this)
- {
- cycle->SetValue(false);
- cycle=cycle->NextInCycle();
- }
- }
+ while (cycle!=this)
+ {
+ cycle->SetValue(false);
+ cycle=cycle->NextInCycle();
+ }
+ }
}
}
ProcessCommand (event);
}
-wxInt32 wxRadioButton::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF WXUNUSED(event) )
+wxInt32 wxRadioButton::MacControlHit(WXEVENTHANDLERREF WXUNUSED(handler) , WXEVENTREF WXUNUSED(event) )
{
// if already set -> no action
if ( GetValue() )
return noErr;
-
+
wxRadioButton *cycle;
cycle=this->NextInCycle();
if (cycle!=NULL) {
wxRadioButton *wxRadioButton::AddInCycle(wxRadioButton *cycle)
{
wxRadioButton *next,*current;
-
- if (cycle==NULL) {
+
+ if (cycle==NULL)
+ {
m_cycle=this;
return(this);
- }
- else {
+ }
+ else
+ {
current=cycle;
- while ((next=current->m_cycle)!=cycle)
+ while ((next=current->m_cycle)!=cycle)
current=current->m_cycle;
- m_cycle=cycle;
- current->m_cycle=this;
- return(cycle);
- }
-}
+ m_cycle=cycle;
+ current->m_cycle=this;
+ return(cycle);
+ }
+}
#endif
#endif
#ifndef __WXMAC_OSX__
-enum
+enum
{
kTXNVisibilityTag = 'visb' /*set the visibility state of the object */
};
protected :
OSStatus DoCreate();
-
+
void MacUpdatePosition() ;
void MacActivatePaneText(Boolean setActive) ;
void MacFocusPaneText(Boolean setFocus) ;
Rect m_txnControlBounds ;
Rect m_txnVisBounds ;
#ifdef __WXMAC_OSX__
- static pascal void TXNScrollInfoProc (SInt32 iValue, SInt32 iMaximumValue,
+ static pascal void TXNScrollInfoProc (SInt32 iValue, SInt32 iMaximumValue,
TXNScrollBarOrientation iScrollBarOrientation, SInt32 iRefCon) ;
static pascal void TXNScrollActionProc( ControlRef controlRef , ControlPartCode partCode ) ;
ControlRef m_sbHorizontal ;
{
SetEditable( false ) ;
}
-
+
SetCursor( wxCursor( wxCURSOR_IBEAM ) ) ;
return true;
}
-void wxTextCtrl::MacSuperChangedPosition()
+void wxTextCtrl::MacSuperChangedPosition()
{
wxWindow::MacSuperChangedPosition() ;
GetPeer()->SuperChangedPosition() ;
event.SetEventObject(def);
def->Command(event);
return ;
- }
+ }
}
// this will make wxWidgets eat the ENTER key so that
TXNControlData m_data[1] ;
} ;
-wxMacMLTEControl::wxMacMLTEControl( wxTextCtrl *peer ) : wxMacTextControl( peer )
+wxMacMLTEControl::wxMacMLTEControl( wxTextCtrl *peer ) : wxMacTextControl( peer )
{
- SetNeedsFocusRect( true ) ;
+ SetNeedsFocusRect( true ) ;
}
wxString wxMacMLTEControl::GetStringValue() const
TXNFrameOptions wxMacMLTEControl::FrameOptionsFromWXStyle( long wxStyle )
{
TXNFrameOptions frameOptions =
- kTXNDontDrawCaretWhenInactiveMask
+ kTXNDontDrawCaretWhenInactiveMask
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
| kTXNDoFontSubstitutionMask
#endif
void wxMacMLTEControl::AdjustCreationAttributes( const wxColour &background, bool visible )
{
- TXNControlTag iControlTags[] =
- {
- kTXNDoFontSubstitution,
+ TXNControlTag iControlTags[] =
+ {
+ kTXNDoFontSubstitution,
kTXNWordWrapStateTag ,
};
- TXNControlData iControlData[] =
- {
- {true},
+ TXNControlData iControlData[] =
+ {
+ {true},
{kTXNNoAutoWrap},
};
-
+
int toptag = WXSIZEOF( iControlTags ) ;
if ( m_windowStyle & wxTE_MULTILINE )
kTXNStartOffset,
kTXNEndOffset) );
}
-
+
if ( m_windowStyle & wxTE_PASSWORD )
{
UniChar c = 0xA5 ;
TXNScrollInfoUPP gTXNScrollInfoProc = NULL ;
ControlActionUPP gTXNScrollActionProc = NULL ;
-pascal void wxMacMLTEClassicControl::TXNScrollInfoProc (SInt32 iValue, SInt32 iMaximumValue, TXNScrollBarOrientation
+pascal void wxMacMLTEClassicControl::TXNScrollInfoProc (SInt32 iValue, SInt32 iMaximumValue, TXNScrollBarOrientation
iScrollBarOrientation, SInt32 iRefCon)
{
wxMacMLTEClassicControl* mlte = (wxMacMLTEClassicControl*) iRefCon ;
SInt32 value = wxMax( iValue , 0 ) ;
SInt32 maximum = wxMax( iMaximumValue , 0 ) ;
-
+
if ( iScrollBarOrientation == kTXNHorizontal )
{
if ( mlte->m_sbHorizontal )
wxMacMLTEClassicControl* mlte = (wxMacMLTEClassicControl*) GetControlReference( controlRef ) ;
if ( mlte == NULL )
return ;
-
+
if ( controlRef != mlte->m_sbVertical && controlRef != mlte->m_sbHorizontal )
- return ;
-
- bool isHorizontal = ( controlRef == mlte->m_sbHorizontal ) ;
-
+ return ;
+
+ bool isHorizontal = ( controlRef == mlte->m_sbHorizontal ) ;
+
SInt32 minimum = 0 ;
SInt32 maximum = GetControl32BitMaximum( controlRef ) ;
SInt32 value = GetControl32BitValue( controlRef ) ;
delta = -GetControlViewSize( controlRef ) ;
break ;
case kControlIndicatorPart :
- delta = value -
+ delta = value -
( isHorizontal ? mlte->m_lastHorizontalValue : mlte->m_lastVerticalValue ) ;
break ;
default :
if ( delta != 0 )
{
SInt32 newValue = value ;
-
+
if ( partCode != kControlIndicatorPart )
{
if( value + delta < minimum )
SetControl32BitValue( controlRef , value + delta ) ;
newValue = value + delta ;
}
-
+
SInt32 verticalDelta = isHorizontal ? 0 : delta ;
SInt32 horizontalDelta = isHorizontal ? delta : 0 ;
-
+
err = TXNScroll( mlte->m_txn , kTXNScrollUnitsInPixels, kTXNScrollUnitsInPixels,
&verticalDelta , &horizontalDelta );
-
+
if ( isHorizontal )
mlte->m_lastHorizontalValue = newValue ;
else
#endif
// make correct activations
-void wxMacMLTEClassicControl::MacActivatePaneText(Boolean setActive)
+void wxMacMLTEClassicControl::MacActivatePaneText(Boolean setActive)
{
wxTextCtrl* textctrl = (wxTextCtrl*) GetControlReference(m_controlRef);
TXNFocus( m_txn, setActive);
}
-void wxMacMLTEClassicControl::MacFocusPaneText(Boolean setFocus)
+void wxMacMLTEClassicControl::MacFocusPaneText(Boolean setFocus)
{
TXNFocus( m_txn, setFocus);
}
-// guards against inappropriate redraw (hidden objects drawing onto window)
+// guards against inappropriate redraw (hidden objects drawing onto window)
void wxMacMLTEClassicControl::MacSetObjectVisibility(Boolean vis)
{
ControlRef controlFocus = 0 ;
GetKeyboardFocus( m_txnWindow , &controlFocus ) ;
-
+
if ( controlFocus == m_controlRef && vis == false )
{
SetKeyboardFocus( m_txnWindow , m_controlRef , kControlFocusNoPart ) ;
}
-
+
TXNControlTag iControlTags[1] = { kTXNVisibilityTag };
TXNControlData iControlData[1] = { {(UInt32) false } };
verify_noerr( TXNGetTXNObjectControls( m_txn , 1,
iControlTags, iControlData ) ) ;
-
+
if ( iControlData[0].uValue != vis )
{
iControlData[0].uValue = vis ;
// make sure that the TXNObject is at the right position
-void wxMacMLTEClassicControl::MacUpdatePosition()
+void wxMacMLTEClassicControl::MacUpdatePosition()
{
wxTextCtrl* textctrl = (wxTextCtrl*) GetControlReference(m_controlRef);
if ( textctrl == NULL )
Rect bounds ;
UMAGetControlBoundsInWindowCoords(m_controlRef, &bounds);
-
+
wxRect visRect = textctrl->MacGetClippedClientRect() ;
Rect visBounds = { visRect.y , visRect.x , visRect.y + visRect.height , visRect.x + visRect.width } ;
int x , y ;
x = y = 0 ;
textctrl->MacWindowToRootWindow( &x , &y ) ;
OffsetRect( &visBounds , x , y ) ;
-
+
if ( !EqualRect( &bounds , &m_txnControlBounds ) || !EqualRect( &visBounds , &m_txnVisBounds) )
{
m_txnControlBounds = bounds ;
sbBounds.top = h - 14 ;
sbBounds.right = w + 1 ;
sbBounds.bottom = h + 1 ;
-
+
if ( !isCompositing )
OffsetRect( &sbBounds , m_txnControlBounds.left , m_txnControlBounds.top ) ;
-
+
SetControlBounds( m_sbHorizontal , &sbBounds ) ;
SetControlViewSize( m_sbHorizontal , w ) ;
}
sbBounds.top = -1 ;
sbBounds.right = w + 1 ;
sbBounds.bottom = m_sbHorizontal ? h - 14 : h + 1 ;
-
+
if ( !isCompositing )
OffsetRect( &sbBounds , m_txnControlBounds.left , m_txnControlBounds.top ) ;
SetControlViewSize( m_sbVertical , h ) ;
}
}
-
+
Rect oldviewRect ;
TXNLongRect olddestRect ;
TXNGetRectBounds( m_txn , &oldviewRect , &olddestRect , NULL ) ;
-
+
Rect viewRect = { m_txnControlBounds.top, m_txnControlBounds.left,
m_txnControlBounds.bottom - ( m_sbHorizontal ? 14 : 0 ) , m_txnControlBounds.right - ( m_sbVertical ? 14 : 0 ) } ;
TXNLongRect destRect = { m_txnControlBounds.top, m_txnControlBounds.left,
m_txnControlBounds.bottom - ( m_sbHorizontal ? 14 : 0 ) , m_txnControlBounds.right - ( m_sbVertical ? 14 : 0 ) } ;
-
+
if ( olddestRect.right >= 10000 )
destRect.right = destRect.left + 32000 ;
-
+
if ( olddestRect.bottom >= 0x20000000 )
destRect.bottom = destRect.top + 0x40000000 ;
-
- SectRect( &viewRect , &visBounds , &viewRect ) ;
+
+ SectRect( &viewRect , &visBounds , &viewRect ) ;
TXNSetRectBounds( m_txn , &viewRect , &destRect , true ) ;
/*
TXNSetFrameBounds( m_txn, m_txnControlBounds.top, m_txnControlBounds.left,
m_txnControlBounds.bottom - ( m_sbHorizontal ? 14 : 0 ) , m_txnControlBounds.right - ( m_sbVertical ? 14 : 0 ), m_txnFrameID);
*/
#else
-
+
TXNSetFrameBounds( m_txn, m_txnControlBounds.top, m_txnControlBounds.left,
- wxMax( m_txnControlBounds.bottom , m_txnControlBounds.top ) ,
+ wxMax( m_txnControlBounds.bottom , m_txnControlBounds.top ) ,
wxMax( m_txnControlBounds.right , m_txnControlBounds.left ) , m_txnFrameID);
- // the SetFrameBounds method unter classic sometimes does not correctly scroll a selection into sight after a
+ // the SetFrameBounds method unter classic sometimes does not correctly scroll a selection into sight after a
// movement, therefore we have to force it
TXNLongRect textRect ;
- TXNGetRectBounds( m_txn , NULL , NULL , &textRect ) ;
+ TXNGetRectBounds( m_txn , NULL , NULL , &textRect ) ;
if ( textRect.left < m_txnControlBounds.left )
{
TXNShowSelection( m_txn , false ) ;
}
}
-void wxMacMLTEClassicControl::SetRect( Rect *r )
+void wxMacMLTEClassicControl::SetRect( Rect *r )
{
wxMacControl::SetRect( r ) ;
MacUpdatePosition() ;
}
-void wxMacMLTEClassicControl::MacControlUserPaneDrawProc(wxInt16 thePart)
+void wxMacMLTEClassicControl::MacControlUserPaneDrawProc(wxInt16 thePart)
{
wxTextCtrl* textctrl = (wxTextCtrl*) GetControlReference(m_controlRef);
if ( textctrl == NULL )
}
}
-wxInt16 wxMacMLTEClassicControl::MacControlUserPaneHitTestProc(wxInt16 x, wxInt16 y)
+wxInt16 wxMacMLTEClassicControl::MacControlUserPaneHitTestProc(wxInt16 x, wxInt16 y)
{
Point where = { y , x } ;
ControlPartCode result;
wxTextCtrl* textctrl = (wxTextCtrl*) GetControlReference(m_controlRef);
if ( textctrl == NULL )
return 0 ;
-
+
if (textctrl->MacIsReallyShown() )
{
if (PtInRect(where, &m_txnControlBounds))
return result;
}
-wxInt16 wxMacMLTEClassicControl::MacControlUserPaneTrackingProc( wxInt16 x, wxInt16 y, void* actionProc )
+wxInt16 wxMacMLTEClassicControl::MacControlUserPaneTrackingProc( wxInt16 x, wxInt16 y, void* actionProc )
{
wxTextCtrl* textctrl = (wxTextCtrl*) GetControlReference(m_controlRef);
if ( textctrl == NULL )
return partCodeResult;
}
-void wxMacMLTEClassicControl::MacControlUserPaneIdleProc()
+void wxMacMLTEClassicControl::MacControlUserPaneIdleProc()
{
wxTextCtrl* textctrl = (wxTextCtrl*) GetControlReference(m_controlRef);
if ( textctrl == NULL )
return ;
- if (textctrl->MacIsReallyShown())
+ if (textctrl->MacIsReallyShown())
{
- if (IsControlActive(m_controlRef))
+ if (IsControlActive(m_controlRef))
{
Point mousep;
TXNIdle(m_txn);
- if (PtInRect(mousep, &m_txnControlBounds))
+ if (PtInRect(mousep, &m_txnControlBounds))
{
RgnHandle theRgn;
RectRgn((theRgn = NewRgn()), &m_txnControlBounds);
}
}
-wxInt16 wxMacMLTEClassicControl::MacControlUserPaneKeyDownProc (wxInt16 keyCode, wxInt16 charCode, wxInt16 modifiers)
+wxInt16 wxMacMLTEClassicControl::MacControlUserPaneKeyDownProc (wxInt16 keyCode, wxInt16 charCode, wxInt16 modifiers)
{
wxTextCtrl* textctrl = (wxTextCtrl*) GetControlReference(m_controlRef);
if ( textctrl == NULL )
ev.modifiers = modifiers ;
ev.message = (( keyCode << 8 ) & keyCodeMask ) + ( charCode & charCodeMask ) ;
TXNKeyDown( m_txn , &ev);
-
+
return kControlEntireControl;
}
-void wxMacMLTEClassicControl::MacControlUserPaneActivateProc( bool activating)
+void wxMacMLTEClassicControl::MacControlUserPaneActivateProc( bool activating)
{
MacActivatePaneText( activating );
}
-wxInt16 wxMacMLTEClassicControl::MacControlUserPaneFocusProc(wxInt16 action)
+wxInt16 wxMacMLTEClassicControl::MacControlUserPaneFocusProc(wxInt16 action)
{
ControlPartCode focusResult;
return 0;
wxMacWindowClipper clipper( textctrl ) ;
-
+
ControlRef controlFocus = 0 ;
GetKeyboardFocus( m_txnWindow , &controlFocus ) ;
bool wasFocused = ( controlFocus == m_controlRef ) ;
- switch (action)
+ switch (action)
{
case kControlFocusPrevPart:
case kControlFocusNextPart:
MacFocusPaneText( ( !wasFocused));
focusResult = (!wasFocused) ? (ControlPartCode) kControlEditTextPart : (ControlPartCode) kControlFocusNoPart;
break;
-
+
case kControlFocusNoPart:
default:
MacFocusPaneText( false);
#endif
/* calculate the rectangles used by the control */
UMAGetControlBoundsInWindowCoords(m_controlRef, &bounds);
-
+
m_txnControlBounds = bounds ;
m_txnVisBounds = bounds ;
-
+
CGrafPtr origPort = NULL ;
GDHandle origDev = NULL ;
GetGWorld( &origPort , &origDev ) ;
m_sbVertical = 0 ;
m_lastHorizontalValue = 0 ;
m_lastVerticalValue = 0 ;
-
+
Rect sb = { 0 , 0 , 0 , 0 } ;
if ( frameOptions & kTXNWantVScrollBarMask )
{
&m_txn, &m_txnFrameID, NULL ) );
/*
TXNCarbonEventInfo cInfo ;
-
+
cInfo.useCarbonEvents = false ;
cInfo.filler = 0 ;
cInfo.flags = 0 ;
cInfo.fDictionary = NULL ;
- TXNControlTag iControlTags[] =
- {
+ TXNControlTag iControlTags[] =
+ {
kTXNUseCarbonEvents ,
};
- TXNControlData iControlData[] =
- {
+ TXNControlData iControlData[] =
+ {
{(UInt32) &cInfo },
};
-
+
int toptag = WXSIZEOF( iControlTags ) ;
verify_noerr( TXNSetTXNObjectControls( m_txn, false , toptag,
return;
}
- if ( x == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE) )
+ if ( x == wxDefaultCoord && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE) )
x = currentX;
- if ( y == -1 && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE) )
+ if ( y == wxDefaultCoord && !(sizeFlags & wxSIZE_ALLOW_MINUS_ONE) )
y = currentY;
AdjustForParentClientOrigin(x, y, sizeFlags);
- wxSize size(-1, -1);
- if ( width == -1 )
+ wxSize size = wxDefaultSize;
+ if ( width == wxDefaultCoord )
{
if ( sizeFlags & wxSIZE_AUTO_WIDTH )
{
}
}
- if ( height == -1 )
+ if ( height == wxDefaultCoord )
{
if ( sizeFlags & wxSIZE_AUTO_HEIGHT )
{
- if ( size.x == -1 )
+ if ( size.x == wxDefaultCoord )
{
size = DoGetBestSize();
}
void wxWindowMac::DoSetClientSize(int clientwidth, int clientheight)
{
- if ( clientheight != -1 || clientheight != -1 )
+ if ( clientheight != wxDefaultCoord || clientheight != wxDefaultCoord )
{
int currentclientwidth , currentclientheight ;
int currentwidth , currentheight ;
GetClientSize( ¤tclientwidth , ¤tclientheight ) ;
GetSize( ¤twidth , ¤theight ) ;
- DoSetSize( -1 , -1 , currentwidth + clientwidth - currentclientwidth ,
+ DoSetSize( wxDefaultCoord , wxDefaultCoord , currentwidth + clientwidth - currentclientwidth ,
currentheight + clientheight - currentclientheight , wxSIZE_USE_EXISTING ) ;
}
}
void wxWindowMac::OnEraseBackground(wxEraseEvent& event)
{
- if ( MacGetTopLevelWindow() == NULL )
- return ;
+ if ( MacGetTopLevelWindow() == NULL )
+ return ;
#if TARGET_API_MAC_OSX
if ( MacGetTopLevelWindow()->MacUsesCompositing() && (m_macBackgroundBrush.Ok() == false || m_macBackgroundBrush.GetStyle() == wxTRANSPARENT ) )
{
if( dx == 0 && dy ==0 )
return ;
- int width , height ;
- GetClientSize( &width , &height ) ;
+ int width , height ;
+ GetClientSize( &width , &height ) ;
#if TARGET_API_MAC_OSX
if ( 1 /* m_peer->IsCompositing() */ )
{
Rect scrollrect;
RgnHandle updateRgn = NewRgn() ;
- {
+ {
wxClientDC dc(this) ;
wxMacPortSetter helper(&dc) ;
bool wxWindowMac::Reparent(wxWindowBase *newParentBase)
{
wxWindowMac *newParent = (wxWindowMac *)newParentBase;
-
+
if ( !wxWindowBase::Reparent(newParent) )
- return FALSE;
-
+ return false;
+
//copied from MacPostControlCreate
ControlRef container = (ControlRef) GetParent()->GetHandle() ;
wxASSERT_MSG( container != NULL , wxT("No valid mac container control") ) ;
::EmbedControl( m_peer->GetControlRef() , container ) ;
-
- return TRUE;
-}
+ return true;
+}