File: ExternalInterface.h

package info (click to toggle)
gentle 1.9+cvs20100605+dfsg1-5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 12,224 kB
  • ctags: 6,214
  • sloc: cpp: 41,569; ansic: 3,978; sh: 1,420; makefile: 243
file content (122 lines) | stat: -rw-r--r-- 4,130 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
/** \file
	\brief Contains the ExternalInterface and its helper classes
*/
#ifndef _EXTERNAL_INTERFACE_H_
#define _EXTERNAL_INTERFACE_H_

#include "main.h"
#include "ChildBase.h"
#include <wx/splitter.h>
#include <wx/htmllbox.h>
#include "SendHTTP.h"
#include <wx/thread.h>

enum {
	ID_HLB = 6000,
	ID_T1,
	ID_T2,
	ID_T3,
	ID_T4,
	ID_B1,
	ID_B2,
	ID_B3,
	ID_B_LAST,
	ID_B_NEXT,
	ID_C1,
	ID_C2,
	} ;	

enum {
	EI_NCBI = 1,
	EI_BLAST,
	} ;	
	
class blastThread ;

/// The External Interface List Box class, a specialized wxHtmlListBox
class EILB : public wxHtmlListBox
	{
	public :
	EILB ( wxWindow *parent , int id = wxID_ANY ) ; ///< Constructor
	virtual wxString OnGetItem(size_t n) const ; ///< Get the item string
	virtual void Clear () ; ///< Clear the list box
	virtual void Sort () ; ///< Sort the list box
	virtual void Update () ; ///< Update the list box
	virtual void Set ( int id , wxString s , wxString t = _T("") ) ; ///< Set an entry
	
	wxArrayString was , data ;
	} ;    

/// The External Interface panel class
class EIpanel : public wxPanel
{
    public :
	EIpanel ( wxWindow *parent , int _mode ) ; ///< Constructor
    
//    private :
	virtual void process () ; ///< Runs the query, as process_blast or process_ncbi
    virtual wxString num2html ( int num , int digits ) ; ///< Returns a HTML-formatted number
    void showMessage ( wxString msg ) ; ///< Displays a message beneath the search controls

    virtual void init_blast() ; ///< Initialized BLAST interface
    virtual void process_blast() ; ///< Processes BLAST command, starts thread
    virtual void process_blast2() ; ///< Processes thread results
    virtual void execute_blast_b3() ; ///< Opens the associated link
    virtual void execute_blast() ; ///< Opens returned BLAST entry
    virtual wxString blast_align ( wxString qseq , wxString mseq , wxString hseq , int cpl , int qoff , int hoff ) ;
    
    virtual void init_ncbi() ; ///< Initializes NCBI interface
    virtual void process_ncbi() ; ///< Processes NCBI request
    virtual void execute_ncbi() ; ///< Opens returned sequence entry
    virtual void execute_ncbi_b3() ; ///< Opens the associated link

    virtual void execute_ncbi_load ( wxString database ) ; ///< Load a sequence from NCBI
    
    virtual void OnB1 ( wxCommandEvent& WXUNUSED(event) ) ; ///< Button 1 handler
    virtual void OnB2 ( wxCommandEvent& WXUNUSED(event) ) ; ///< Button 2 handler
    virtual void OnB3 ( wxCommandEvent& WXUNUSED(event) ) ; ///< Button 3 handler
    virtual void OnBlast ( wxCommandEvent& WXUNUSED(event) ) ; ///< "Run BLAST" event handler
    virtual void OnBnext ( wxCommandEvent& WXUNUSED(event) ) ; ///< "Next" event handler
    virtual void OnC1 ( wxCommandEvent& WXUNUSED(event) ) ; ///< Choice box 1 event handler
    virtual void OnLboxDClick ( wxCommandEvent& WXUNUSED(event) ) ; ///< List box double click event handler
    
    virtual wxString val ( TiXmlNode *n ) ; ///< Return safe value
    virtual wxString valFC ( TiXmlNode *n ) ; ///< Return value of FirstChild
    
    int mode ;
    wxPanel *up ;
    EILB *hlb ;
    wxBoxSizer *v0 , *v1 , *h0 , *h1 ;
    wxTextCtrl *t1 , *t2 , *t3 , *t4 ;
    wxStaticText *st_msg ;
    wxButton *b1 , *b2 , *b3 , *b_last , *b_next ;
    wxChoice *c1 , *c2 ;
    long res_count , res_start , RETMAX ;
    
    // BLAST-specific
    blastThread *blast_thread ;
    wxString blast_res ;

    
    DECLARE_EVENT_TABLE()
	} ;    

/**	\brief The External Interface ChildBase class
*/
class ExternalInterface : public ChildBase
    {
    public :
    ExternalInterface(wxWindow *parent, const wxString& title) ; ///< Constructor
    ~ExternalInterface () ; ///< Destructor
    
    void initme () ; ///< Initialization
    virtual wxString getName () ; ///< Returns the class name

    virtual void runBlast ( wxString seq , wxString prg ) ; ///< Directly runs a BLAST query

    wxNotebook *nb ; ///< Pointer to the wxNotebook class containing one or more EIpanel

    DECLARE_EVENT_TABLE()
    } ;

#endif