view include/rsearcher.h @ 5:e3b10fb860b3

release v1.0.
author pyon@macmini
date Mon, 22 Oct 2018 22:17:02 +0900
parents 06342fc544e4
children 9a8b581c1993
line wrap: on
line source

// Filename   : rsearcher.h
// Last Change: 2018-10-22 ŒŽ 13:08:14.
//

#ifndef __RSEARCH_H__
#define __RSEARCH_H__

#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/string.h>
#include <wx/srchctrl.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/button.h>
#include <wx/notebook.h>
#include <wx/dataview.h>
#include <wx/slider.h>
#include <wx/sizer.h>
#include <wx/html/htmlwin.h>
#include <wx/frame.h>
#include <wx/statbmp.h>
#include <wx/msgdlg.h> 
#include <wx/filefn.h> 
#include <wx/regex.h>
#include <wx/progdlg.h>
#include <wx/utils.h> 
#include <wx/textfile.h>
#include <wx/timer.h>
#include <wx/hashmap.h>

/* Data Class */
class HhsClass {
	public:
		wxString no;
		wxString birth;
		wxString name;
		wxString kana;
		wxString addr;
		wxString sex;

		HhsClass( wxArrayString& buf );
};

WX_DECLARE_HASH_MAP( wxString, HhsClass*, wxStringHash, wxStringEqual, HhsHash );

/* Control-Window Class */
class MySearchCtrl : public wxSearchCtrl
{
    DECLARE_EVENT_TABLE()
	public:
		MySearchCtrl( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style );
		~MySearchCtrl();

        void OnKey( wxKeyEvent& event );
};

class MyStaticBitmap : public wxStaticBitmap
{
	private:
        int m_dragx, m_dragy;	// for image drag
		int cx, cy;             // for mouse-gesture
        int m_zoom = 0;
        wxBitmap m_bmp[5];
		wxScrolledWindow* m_parent;
		int select_tab = 0;

	public:
        MyStaticBitmap( wxScrolledWindow *parent, wxWindowID id, const wxBitmap &label, const wxPoint &pos, const wxSize &size, long style, const wxString &name );
        ~MyStaticBitmap();

        void OnLeftDown( wxMouseEvent& event );
        void OnLeftUp( wxMouseEvent& event );
		void OnStartRGesture( wxMouseEvent& event );
		void OnEndRGesture( wxMouseEvent& event );
        void OnMotion( wxMouseEvent& event );
        void OnWheel( wxMouseEvent& event );
        void SetImage( int i, wxBitmap bmp ) { m_bmp[i] = bmp; };
        void SetZoom( int m_zoom );
		void ChangeBook( int i );
};

class MainFrame : public wxFrame 
{
	DECLARE_EVENT_TABLE()
	private:
		bool		  startup = true;
		wxString	  m_server;
		wxString	  m_hhs;
		wxString	  m_user;
		wxArrayString m_index;
		wxTimer       m_timer;
		HhsHash       hhash;
	
	protected:
		MySearchCtrl*		m_searchCtrl;
        MyStaticBitmap*     m_staticBitmap1;
        MyStaticBitmap*     m_staticBitmap2;
        MyStaticBitmap*     m_staticBitmap3;
        MyStaticBitmap*     m_staticBitmap4;
        MyStaticBitmap*     m_staticBitmap5;
        MyStaticBitmap*     m_staticBitmap6;

		wxNotebook*         m_notebook;
		wxScrolledWindow*   m_scrolledWindow1;
		wxScrolledWindow*   m_scrolledWindow2;
		wxScrolledWindow*   m_scrolledWindow3;
		wxScrolledWindow*   m_scrolledWindow4;
		wxScrolledWindow*   m_scrolledWindow5;
		wxScrolledWindow*   m_scrolledWindow6;

		wxTextCtrl* 		m_textCtrlName;
		wxTextCtrl* 		m_textCtrlAddr;
		wxDataViewListCtrl* m_dataViewListCtrl;
		wxDataViewColumn* 	m_dataViewListColumnNo;
		wxDataViewColumn* 	m_dataViewListColumnDate;
		wxTextCtrl* 		m_textCtrlLog;
		wxSlider*           m_slider;
		wxButton*           m_buttonPsearch;
		wxButton*           m_buttonPrint;
		wxButton*           m_buttonHelp;
		wxButton*           m_buttonLogout;
	
	public:
		MainFrame( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT( "Searcher Remote" ), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,300 ), long style = wxDEFAULT_FRAME_STYLE|wxTAB_TRAVERSAL );
		~MainFrame();

		void SetServer( wxString server ) { m_server = server; };
		void SetUser( wxString user ) { m_user = user; WriteLog( wxT( "[login] " ) + m_user ); };
		void CreateControls( void );
		void SetAccelerator( void );
		void Cmd( wxString cmd );
		void Search( void );
		void PasteSeaarch( void );
		void LoadDB( void );
        bool LoadBitmap( wxScrolledWindow* sc, wxStaticBitmap* sb, wxString file );
        bool LoadBitmaps( wxString date, bool reload );
        void GetImages( wxString hhs, wxString date );
		void PrintImages( void );
		void WriteLog( wxString msg );
		void RemoveFile( wxString pattern );
        void InDevelop( bool );

		void OnItemSelected( wxDataViewEvent& event );
		void OnItemDClicked( wxDataViewEvent& event );
        void OnNBookChanged( wxBookCtrlEvent& event );
        void OnPasteSearch( wxCommandEvent& event );
        void OnPrint( wxCommandEvent& event );
		void OnClose( wxCloseEvent& event );	// save config
		void OnIdle( wxIdleEvent& event );
		void OnTimer( wxTimerEvent& event );
        void OnHelp( wxCommandEvent& event );
        void OnLogout( wxCommandEvent& event );
};

#endif // __RSEARCH_H__