|
Shinya Kitaoka |
810553 |
#pragma once
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifndef T_THUMBNAILVIEWE_INCLUDED
|
|
Toshihiro Shimizu |
890ddd |
#define T_THUMBNAILVIEWE_INCLUDED
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "tw/scrollview.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// forward declaration
|
|
Toshihiro Shimizu |
890ddd |
class Thumbnail;
|
|
Toshihiro Shimizu |
890ddd |
class TTextField;
|
|
Toshihiro Shimizu |
890ddd |
class TFilePath;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
class ThumbnailViewer : public TScrollView {
|
|
Shinya Kitaoka |
120a6e |
vector<thumbnail *=""> m_items;</thumbnail>
|
|
Shinya Kitaoka |
120a6e |
int m_selectedItemIndex;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
const TDimension m_itemSize;
|
|
Shinya Kitaoka |
120a6e |
const TDimension m_itemSpace;
|
|
Shinya Kitaoka |
120a6e |
const TDimension m_margins;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
const TRect m_playButtonBox;
|
|
Shinya Kitaoka |
120a6e |
const TRect m_iconBox;
|
|
Shinya Kitaoka |
120a6e |
const TRect m_textBox;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TPoint m_oldPos;
|
|
Shinya Kitaoka |
120a6e |
bool m_dragDropArmed;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
bool m_flag;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
bool m_playing, m_loading;
|
|
Shinya Kitaoka |
120a6e |
bool m_timerActive;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
class NameField;
|
|
Shinya Kitaoka |
120a6e |
NameField *m_nameField;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
ThumbnailViewer(TWidget *parent, string name = "thumbnailViewer");
|
|
Shinya Kitaoka |
120a6e |
~ThumbnailViewer();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void addItem(Thumbnail *item);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
//! removes the item from the ThumbnailViewer. It doesn't destroy the item
|
|
Shinya Kitaoka |
120a6e |
void removeItem(Thumbnail *item);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
TDimension getIconSize() const { return m_iconBox.getSize(); }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
int getItemCount() const;
|
|
Shinya Kitaoka |
120a6e |
Thumbnail *getItem(int index) const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
//! find the max number of thumbnails which fit the current widget width
|
|
Shinya Kitaoka |
120a6e |
int getColumnCount() const;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
//! find the bottom-left corner coordinate of the index-th thumbnail
|
|
Shinya Kitaoka |
120a6e |
//! (icon+controls)
|
|
Shinya Kitaoka |
120a6e |
TPoint getItemPos(int index);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// ! find the region covered by the index-th thumbnail (icon+controls)
|
|
Shinya Kitaoka |
120a6e |
TRect getItemBounds(int index);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
// ! coordinate --> thumbnail index; returns -1 if not found
|
|
Shinya Kitaoka |
120a6e |
int findItem(const TPoint &pos);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void configureNotify(const TDimension &d);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
//! draw the index-th thumbnail current frame
|
|
Shinya Kitaoka |
120a6e |
void drawFrame(int index);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
//! draw the index-th thumbnail
|
|
Shinya Kitaoka |
120a6e |
void drawItem(int index);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
//! draw the empty space around and between thumbnails
|
|
Shinya Kitaoka |
120a6e |
void drawBackground();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void repaint();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void leftButtonDown(const TMouseEvent &e);
|
|
Shinya Kitaoka |
120a6e |
void leftButtonDrag(const TMouseEvent &e);
|
|
Shinya Kitaoka |
120a6e |
void leftButtonUp(const TMouseEvent &e);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void leftButtonDoubleClick(const TMouseEvent &e);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void onTimer(int);
|
|
Shinya Kitaoka |
120a6e |
void startPlaying();
|
|
Shinya Kitaoka |
120a6e |
void stopPlaying();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void select(int);
|
|
Shinya Kitaoka |
120a6e |
int getSelectedItemIndex() { return m_selectedItemIndex; }
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void clearItems();
|
|
Shinya Kitaoka |
120a6e |
void loadDirectory(const TFilePath &dirPath, const vector<string> &fileTypes);</string>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void updateContentSize();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void middleButtonDown(const TMouseEvent &e) {}
|
|
Shinya Kitaoka |
120a6e |
void middleButtonDrag(const TMouseEvent &e) {}
|
|
Shinya Kitaoka |
120a6e |
void middleButtonUp(const TMouseEvent &e) {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void scrollPage(int y);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
virtual void onDoubleClick(int index) {}
|
|
Shinya Kitaoka |
120a6e |
virtual void onSelect(int index) {}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#endif
|