gtk_search_win.h
上传用户:psq1974
上传日期:2007-01-06
资源大小:1195k
文件大小:2k
- /* Copyright (C) 1998, 1999 State University of New York at Stony Brook
- Author: Andrew V. Shuvalov ( andrew@ecsl.cs.sunysb.edu )
- Software license is located in file "COPYING"
- */
- #ifndef _gtk_search_win_h_
- #define _gtk_search_win_h_
- #include "session.h"
- #include <vector>
- class SearchItem : public Gtk_HBox {
- /** session */
- Session &session;
- SearchWindow &searchWin;
- /** position in queue */
- int position;
-
- Gtk_Combo *boolOpEntry;
- Gtk_Combo *textEntry;
- Gtk_Button *lessButton;
- Gtk_Button *moreButton;
- Gtk_Button *searchButton;
- public:
- typedef enum { and, andnot, or, resultand, resultandnot, err, result }
- type;
- public:
- SearchItem( Session &s, SearchWindow &w, int _pos );
- void boolOpVisible( bool v ) {
- if( v )
- boolOpEntry->show();
- else
- boolOpEntry->hide();
- }
- void lessButVisible( bool v ) {
- if( v )
- lessButton->show();
- else
- lessButton->hide();
- }
- void buttonsVisible( bool v ) {
- if( v ) {
- moreButton->show();
- searchButton->show();
- }
- else {
- moreButton->hide();
- searchButton->hide();
- }
- }
- const gchar *get_text() const {
- return textEntry->get_entry()->get_text().c_str();
- }
- type get_type() const;
-
- void callback_hint();
- };
- class SearchResults;
- class BoolSearchOperation;
- class SearchWindow : public Gtk_Window {
-
- /** session */
- Session &session;
- /** vector of text search items, connected by boolean operation */
- vector< SearchItem * > searchItems;
- /** and corresponding container */
- Gtk_VBox *searchItemsVBox;
- SearchResults *searchResults;
- static const int topWindowInitSizeX;
- static const int topWindowInitSizeY;
- public:
-
- SearchWindow( Session &s );
- void find_hint_words( int position, GList *&hints );
- /** callbacks */
- void callback_less( int pos );
- void callback_more( int pos );
- void callback_close();
- void callback_search();
- };
- /** clist to display search results */
- class SearchResults : public Gtk_CList {
- Session &session;
- SearchWindow &searchWindow;
- /** each row is index in this vector
- */
- WordOccurencesT WordOccurences;
- static const int col0width;
- static const int col1width;
- static const int col2width;
- static const int TextColumns;
- public:
- SearchResults( Session &s, SearchWindow &sw );
- void display_results( const WordOccurencesT &result );
- void callback_select_row( gint row, gint col, GdkEvent *button );
- };
- #endif // _gtk_search_win_h_