Home | History | Annotate | Download | only in platform
      1 /*
      2  * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
      3  * Copyright (C) 2006 Apple Computer, Inc.
      4  *
      5  * This library is free software; you can redistribute it and/or
      6  * modify it under the terms of the GNU Library General Public
      7  * License as published by the Free Software Foundation; either
      8  * version 2 of the License, or (at your option) any later version.
      9  *
     10  * This library is distributed in the hope that it will be useful,
     11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     13  * Library General Public License for more details.
     14  *
     15  * You should have received a copy of the GNU Library General Public License
     16  * along with this library; see the file COPYING.LIB.  If not, write to
     17  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     18  * Boston, MA 02110-1301, USA.
     19  *
     20  */
     21 
     22 #ifndef PopupMenuClient_h
     23 #define PopupMenuClient_h
     24 
     25 #include "platform/LayoutUnit.h"
     26 #include "platform/PlatformExport.h"
     27 #include "platform/PopupMenuStyle.h"
     28 #include "wtf/Forward.h"
     29 
     30 namespace blink {
     31 
     32 class PopupMenuClient {
     33 public:
     34     virtual ~PopupMenuClient() { }
     35     virtual void valueChanged(unsigned listIndex, bool fireEvents = true) = 0;
     36     virtual void selectionChanged(unsigned listIndex, bool fireEvents = true) = 0;
     37     virtual void selectionCleared() = 0;
     38 
     39     virtual String itemText(unsigned listIndex) const = 0;
     40     virtual String itemToolTip(unsigned listIndex) const = 0;
     41     virtual String itemAccessibilityText(unsigned listIndex) const = 0;
     42     virtual bool itemIsEnabled(unsigned listIndex) const = 0;
     43     virtual PopupMenuStyle itemStyle(unsigned listIndex) const = 0;
     44     virtual PopupMenuStyle menuStyle() const = 0;
     45     virtual LayoutUnit clientPaddingLeft() const = 0;
     46     virtual LayoutUnit clientPaddingRight() const = 0;
     47     virtual int listSize() const = 0;
     48     virtual int selectedIndex() const = 0;
     49     virtual void popupDidHide() = 0;
     50     virtual bool itemIsSeparator(unsigned listIndex) const = 0;
     51     virtual bool itemIsLabel(unsigned listIndex) const = 0;
     52     virtual bool itemIsSelected(unsigned listIndex) const = 0;
     53     virtual void setTextFromItem(unsigned listIndex) = 0;
     54 
     55     virtual void listBoxSelectItem(int /*listIndex*/, bool /*allowMultiplySelections*/, bool /*shift*/, bool /*fireOnChangeNow*/ = true) { ASSERT_NOT_REACHED(); }
     56     virtual bool multiple() const
     57     {
     58         ASSERT_NOT_REACHED();
     59         return false;
     60     }
     61 };
     62 
     63 }
     64 
     65 #endif
     66