File indexing completed on 2024-04-21 04:34:26

0001 /*
0002    Copyright (C) 2010 Niko Sams <niko.sams@gmail.com>
0003 
0004    This library is free software; you can redistribute it and/or
0005    modify it under the terms of the GNU Library General Public
0006    License version 2 as published by the Free Software Foundation.
0007 
0008    This library is distributed in the hope that it will be useful,
0009    but WITHOUT ANY WARRANTY; without even the implied warranty of
0010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0011    Library General Public License for more details.
0012 
0013    You should have received a copy of the GNU Library General Public License
0014    along with this library; see the file COPYING.LIB.  If not, write to
0015    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0016    Boston, MA 02110-1301, USA.
0017 */
0018 
0019 #include "navigationwidget.h"
0020 
0021 #include "fieldnavigationcontext.h"
0022 #include "valuenavigationcontext.h"
0023 #include "colornavigationcontext.h"
0024 
0025 using namespace KDevelop;
0026 
0027 namespace Css {
0028 
0029 NavigationWidget::NavigationWidget(KDevelop::TopDUContextPointer topContext,
0030                                    const Css::ContentAssistData::Field& field)
0031     : AbstractNavigationWidget()
0032 {
0033   initBrowser(200);
0034 
0035   //The first context is registered so it is kept alive by the shared-pointer mechanism
0036   auto context = NavigationContextPointer(new FieldNavigationContext(topContext, field));
0037   setContext(context);
0038 }
0039 
0040 NavigationWidget::NavigationWidget(KDevelop::TopDUContextPointer topContext,
0041                                    const Css::ContentAssistData::Value& value)
0042     : AbstractNavigationWidget()
0043 {
0044   initBrowser(200);
0045 
0046   //The first context is registered so it is kept alive by the shared-pointer mechanism
0047   auto context = NavigationContextPointer(new ValueNavigationContext(topContext, value));
0048   setContext(context);
0049 }
0050 
0051 NavigationWidget::NavigationWidget(KDevelop::TopDUContextPointer topContext,
0052                                    const QString& colorName)
0053   : AbstractNavigationWidget()
0054 {
0055   initBrowser(200);
0056 
0057   //The first context is registered so it is kept alive by the shared-pointer mechanism
0058   auto context = NavigationContextPointer(new ColorNavigationContext(topContext, colorName));
0059   setContext(context);
0060 }
0061 
0062 }