#ifndef UI_APP_LIST_VIEWS_FOLDER_HEADER_VIEW_H_
#define UI_APP_LIST_VIEWS_FOLDER_HEADER_VIEW_H_
#include <string>
#include "ui/app_list/app_list_export.h"
#include "ui/app_list/app_list_item_observer.h"
#include "ui/views/controls/button/button.h"
#include "ui/views/controls/textfield/textfield_controller.h"
#include "ui/views/view.h"
namespace views {
class ImageButton;
}
namespace app_list {
class AppListFolderItem;
class AppListFolderView;
class FolderHeaderViewDelegate;
namespace test {
class FolderHeaderViewTest;
}
class APP_LIST_EXPORT FolderHeaderView : public views::View,
public views::TextfieldController,
public views::ButtonListener,
public AppListItemObserver {
public:
explicit FolderHeaderView(FolderHeaderViewDelegate* delegate);
virtual ~FolderHeaderView();
void SetFolderItem(AppListFolderItem* folder_item);
void UpdateFolderNameVisibility(bool visible);
void OnFolderItemRemoved();
virtual gfx::Size GetPreferredSize() OVERRIDE;
private:
class FolderNameView;
friend class test::FolderHeaderViewTest;
void Update();
const base::string16& GetFolderNameForTest();
void SetFolderNameForTest(const base::string16& name);
bool IsFolderNameEnabledForTest() const;
virtual void Layout() OVERRIDE;
virtual bool OnKeyPressed(const ui::KeyEvent& event) OVERRIDE;
virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
virtual void ContentsChanged(views::Textfield* sender,
const base::string16& new_contents) OVERRIDE;
virtual void ButtonPressed(views::Button* sender,
const ui::Event& event) OVERRIDE;
virtual void ItemIconChanged() OVERRIDE;
virtual void ItemNameChanged() OVERRIDE;
virtual void ItemHighlightedChanged() OVERRIDE;
virtual void ItemIsInstallingChanged() OVERRIDE;
virtual void ItemPercentDownloadedChanged() OVERRIDE;
AppListFolderItem* folder_item_;
views::ImageButton* back_button_;
FolderNameView* folder_name_view_;
const base::string16 folder_name_placeholder_text_;
FolderHeaderViewDelegate* delegate_;
bool folder_name_visible_;
DISALLOW_COPY_AND_ASSIGN(FolderHeaderView);
};
}
#endif