UICocoaSpecialControls.mm revision d34409ad02ea0d28e08a6c4b089a412fdb3b4c9c
/* $Id$ */
/** @file
* VBox Qt GUI - UICocoaSpecialControls implementation.
*/
/*
* Copyright (C) 2009-2011 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
/* VBox includes */
#include "UICocoaSpecialControls.h"
#include "VBoxUtils-darwin.h"
#include "UIImageTools.h"
/* System includes */
#import <AppKit/NSApplication.h>
#import <AppKit/NSBezierPath.h>
#import <AppKit/NSButton.h>
#import <AppKit/NSFont.h>
#import <AppKit/NSImage.h>
#import <AppKit/NSSegmentedControl.h>
/* Qt includes */
/*
* Private interfaces
*/
@interface UIButtonTargetPrivate: NSObject
{
}
/* The next method used to be called initWithObject, but Xcode 4.1 preview 5
cannot cope with that for some reason. Hope this doesn't break anything... */
@end
@interface UISegmentedButtonTargetPrivate: NSObject
{
}
@end
@interface UISearchFieldCellPrivate: NSSearchFieldCell
{
}
@end
@interface UISearchFieldPrivate: NSSearchField
{
}
@end
#else
@interface UISearchFieldDelegatePrivate: NSObject
{}
@end
/*
* Implementation of the private interfaces
*/
{
return self;
}
{
mRealTarget->onClicked();
}
@end
{
return self;
}
{
}
@end
{
return self;
}
- (void)dealloc
{
[super dealloc];
}
{
{
}
}
{
{
}
}
@end
{
return [UISearchFieldCellPrivate class];
}
{
return self;
}
{
/* This here is a little bit hacky. Grab important keys & forward they to
the parent Qt widget. There a special key handling is done. */
/* Get the pressed character */
{
}
{
}
else if (ch == NSF3FunctionKey)
{
QKeyEvent ke(QEvent::KeyPress, Qt::Key_F3, [theEvent modifierFlags] & NSShiftKeyMask ? Qt::ShiftModifier : Qt::NoModifier);
}
}
//{
// QWidget *w = QApplication::focusWidget();
// if (w)
// w->clearFocus();
//}
{
}
@end
-(BOOL)control:(NSControl*)control textView:(NSTextView*)textView doCommandBySelector:(SEL)commandSelector
{
// NSLog(NSStringFromSelector(commandSelector));
/* Don't execute the selector for Enter & Escape. */
return YES;
return NO;
}
@end
/*
* Helper functions
*/
{
return aRect;
}
/*
* Public classes
*/
, m_pContainer(0)
{
}
{
if (m_pContainer)
}
{
switch (aType)
{
case HelpButton:
{
break;
};
case CancelButton:
{
break;
}
case ResetButton:
{
break;
}
}
/* Create the container widget and attach the native view. */
/* Finally resize the widget */
}
{
}
{
}
{
/* Set it for accessibility reasons as alternative title */
}
{
}
void UICocoaButton::onClicked()
{
}
UICocoaSegmentedButton::UICocoaSegmentedButton(int count, CocoaSegmentType type /* = RoundRectSegment */, QWidget *pParent /* = 0 */)
{
switch (type)
{
case RoundRectSegment:
{
break;
}
case TexturedRoundedSegment:
{
break;
}
}
/* Create the container widget and attach the native view. */
/* Finally resize the widget */
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
{
/* Use our own delegate */
/* Create the container widget and attach the native view. */
/* Finally resize the widget */
}
{
}
{
}
{
}
{
[[m_pNativeRef currentEditor] setString: [[m_pNativeRef stringValue] stringByAppendingString: ::darwinQStringToNSString(strText)]];
}
{
}
void UICocoaSearchField::selectAll()
{
}
void UICocoaSearchField::markError()
{
}
void UICocoaSearchField::unmarkError()
{
}
{
}