예제 #1
0
wxMacSearchFieldControl::wxMacSearchFieldControl( wxTextCtrl *wxPeer,
                         const wxString& str,
                         const wxPoint& pos,
                         const wxSize& size, long style ) : wxMacUnicodeTextControl( wxPeer )
{
    m_font = wxPeer->GetFont() ;
    m_windowStyle = style ;
    m_selection.selStart = m_selection.selEnd = 0;
    Rect bounds = wxMacGetBoundsForControl( wxPeer , pos , size ) ;
    wxString st = str ;
    wxMacConvertNewlines10To13( &st ) ;
    wxCFStringRef cf(st , m_font.GetEncoding()) ;

    m_valueTag = kControlEditTextCFStringTag ;

    OptionBits attributes = kHISearchFieldAttributesSearchIcon;

    HIRect hibounds = { { bounds.left, bounds.top }, { bounds.right-bounds.left, bounds.bottom-bounds.top } };
    verify_noerr( HISearchFieldCreate(
        &hibounds,
        attributes,
        0, // MenuRef
        CFSTR(""),
        &m_controlRef
        ) );
    HIViewSetVisible (m_controlRef, true);

    verify_noerr( SetData<CFStringRef>( 0, kControlEditTextCFStringTag , cf ) ) ;

    ::InstallControlEventHandler( m_controlRef, GetwxMacSearchControlEventHandlerUPP(),
        GetEventTypeCount(eventList), eventList, wxPeer, NULL);
    SetNeedsFrame(false);
    wxMacUnicodeTextControl::InstallEventHandlers();
}
예제 #2
0
OSStatus SearchField::create(WindowRef windowRef)
{
  //  kHISearchFieldNoAttributes = 0,
  //kHISearchFieldAttributesCancel = (1 << 0),
  //kHISearchFieldAttributesSearchIcon = (1 << 1)

  OSStatus result = HISearchFieldCreate(&_bounds,
					kHISearchFieldNoAttributes,
					NULL,
					_label,
					&getControlRef());

  initialise();
  applyActivity();
  applyVisibility();
  return result;
}
예제 #3
0
FilterWidget::FilterWidget(QWidget *parent) : QWidget(parent)
{
	View = 0;

#ifdef Q_OS_MAC

	searchFieldText = CFStringCreateWithCString(0,
		(const char *) tr("Search").toAscii(), 0);
	HISearchFieldCreate(NULL, kHISearchFieldAttributesSearchIcon |
		kHISearchFieldAttributesCancel,
		NULL, searchFieldText, &searchField);
	create(reinterpret_cast<WId>(searchField));
	EventTypeSpec mySFieldEvents[] = {
		{ kEventClassSearchField, kEventSearchFieldCancelClicked },
		{ kEventClassTextField, kEventTextDidChange },
		{ kEventClassTextField, kEventTextAccepted }
	};
	HIViewInstallEventHandler(searchField, FilterFieldEventHandler,
		GetEventTypeCount(mySFieldEvents), mySFieldEvents,
		(void *) this, NULL);

#elif !defined(Q_WS_MAEMO_5)


	QHBoxLayout *layout = new QHBoxLayout(this);
	layout->setMargin(3);

	NameFilterEdit = new LineEditWithClearButton(this);

	setFocusProxy(NameFilterEdit);

	layout->addWidget(new QLabel(tr("Search") + ':', this));
	layout->addWidget(NameFilterEdit);

	connect(NameFilterEdit, SIGNAL(textChanged(const QString &)),
			this, SLOT(filterTextChanged(const QString &)));
#endif
}