/************************************************************************* * sbList.cpp - items scrolling container * * author: Konstantin Maslyuk "Kalemas" mailto:kalemas@mail.ru * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation version 2. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. ************************************************************************/ #ifndef SBLIST_H #define SBLIST_H #include #include #include #include #include "sbItem.h" class sbList { public: enum TYPE { TYPE_NONE = 0, TYPE_CURRENT, // virtual, to update current list PIN_NEXT, // pin PIN_PREV, // pin TYPE_MODULE_VIEW, TYPE_SELECT_MODULE, TYPE_SELECT_BOOK, TYPE_SELECT_VERSE, TYPE_FOLDER_VIEW, TYPE_FILE_VIEW, // html / txt / rtf / doc TYPE_HOME, TYPE_BOOKMARKS, TYPE_READINGS, TYPE_HISTORY, TYPE_SEARCH_OPTIONS, TYPE_SEARCH_RESULTS, TYPE_MENU_EXIT, TYPE_MENU_SELECT_VERSE, TYPE_MENU_SELECT_CHAPTER, TYPE_MENU_OPTIONS, TYPE_MODULE_INSTALLER_DISCLAIMER, TYPE_MODULE_INSTALLER, TYPE_SEARCH, TYPES_COUNT }; sbList ( sbList::TYPE type ); ~sbList (); // event handlers void onPressed ( int x, int y ); void onReleased ( int x, int y ); void onClicked ( int x, int y ); void onTapped ( int x, int y ); bool onChar ( TCHAR character ); bool onKey ( int key ); void onTimer ( const int timer ); void onActivate ( ); bool onControl ( sbControl::TYPE type ); void onItem ( sbItem * item ); // methods void attach ( sbList * list, sbList::TYPE pin ); bool scroll ( float amount ); void render ( sbSurface rc , bool showPlace = false , int sideDisplacement = 0 ); float displace; int screenHeight; int needScroll; bool needFill; const TYPE type; sbList* getNext () const {return next;} sbList* getPrev () const {return prev;} void process ( bool *abort ); const std::vector * getControls () const { return &controls; } private: void clear (); sbItem* getItem ( int x , int y ) const; struct sbMenu { sbItem * item; sbRect rect; int displace; }; class sbMinilog { typedef std::list> ITEM; ITEM items; }; sbMinilog minilog; sbItem *itemCurrent; sbItem *itemHover; sbItem *itemSelected; sbItem *itemBanner; sbItem *itemMenu; sbPoint menuPosition; void setEditMode ( sbItem * item ); sbItem *itemEdit; int itemEditCursor; // Module List Related struct BOUND { BOUND () { memset (this,0,sizeof(BOUND)); constructed = true; } sbItem *verse; int verseCount; bool constructed; int height; }; BOUND before,after; // List Related sbList *next; sbList *prev; void addControl ( sbControl::TYPE type ); void removeControl ( sbControl::TYPE type ); std::vector controls; sbRect rect; std::vector options; public: int controlSelected; const char *module; sword::VerseKey place; int attachedReading; int attachedHistory; }; #endif