Added original works and stubs to CVS repository

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19676 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
David Elliott
2003-03-21 19:51:47 +00:00
parent 43225e09fe
commit fb896a322a
40 changed files with 4164 additions and 0 deletions

66
src/cocoa/button.mm Normal file
View File

@@ -0,0 +1,66 @@
/////////////////////////////////////////////////////////////////////////////
// Name: cocoa/button.mm
// Purpose: wxButton
// Author: David Elliott
// Modified by:
// Created: 2002/12/30
// RCS-ID: $Id:
// Copyright: (c) 2002 David Elliott
// Licence: wxWindows license
/////////////////////////////////////////////////////////////////////////////
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
#include "wx/defs.h"
#include "wx/button.h"
#include "wx/log.h"
#endif
#import <AppKit/NSButton.h>
#import <Foundation/NSString.h>
IMPLEMENT_DYNAMIC_CLASS(wxButton, wxControl)
BEGIN_EVENT_TABLE(wxButton, wxButtonBase)
END_EVENT_TABLE()
WX_IMPLEMENT_COCOA_OWNER(wxButton,NSButton,NSControl,NSView)
bool wxButton::Create(wxWindow *parent, wxWindowID winid,
const wxString& label, const wxPoint& pos,
const wxSize& size, long style,
const wxValidator& validator, const wxString& name)
{
wxLogDebug("Creating control with id=%d",winid);
if(!CreateControl(parent,winid,pos,size,style,validator,name))
return false;
wxLogDebug("Created control with id=%d",GetId());
NSRect cocoaRect = NSMakeRect(10,10,20,20);
m_cocoaNSView = NULL;
SetNSButton([[NSButton alloc] initWithFrame: cocoaRect]);
// NOTE: YES we want to release this (to match the alloc).
// DoAddChild(this) will retain us again since addSubView doesn't.
[m_cocoaNSView release];
[GetNSButton() setBezelStyle:NSRoundedBezelStyle];
[GetNSButton() setTitle:[NSString stringWithCString: label.c_str()]];
[GetNSControl() sizeToFit];
if(m_parent)
m_parent->CocoaAddChild(this);
return true;
}
wxButton::~wxButton()
{
CocoaRemoveFromParent();
SetNSButton(NULL);
}
void wxButton::Cocoa_wxNSButtonAction(void)
{
wxLogDebug("YAY!");
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, GetId());
InitCommandEvent(event); // event.SetEventObject(this);
Command(event);
}