[sword-cvs] swordreader/src/gui NavFind.cpp,NONE,1.1 NavFind.h,NONE,1.1

sword@www.crosswire.org sword@www.crosswire.org
Sat, 31 Jan 2004 15:44:42 -0700


Update of /cvs/core/swordreader/src/gui
In directory www:/tmp/cvs-serv28255/src/gui

Added Files:
	NavFind.cpp NavFind.h 
Log Message:
- New files for the Find page


--- NEW FILE: NavFind.cpp ---
#include "ApplicationInterface.h"
#include "NavFind.h"
#include "Navigator.h"
#include <winuser.h>

NavFind::NavFind(Navigator* navigator) {
	this->navigator=navigator;
	goButtonID=navigator->getID();
	query=L"Busy implementing";
	queryEdit = CreateWindow(_T("edit"), NULL, 
		WS_CHILD | ES_AUTOHSCROLL | ES_LEFT | WS_TABSTOP | WS_BORDER,
		RECT_SCREEN.left, RECT_SCREEN.top, RECT_SCREEN.right-30, 20, 
		g_hWnd,	NULL, g_hInst, NULL);
	go = CreateWindow(_T("button"), L"Go", 
		WS_CHILD | BS_PUSHBUTTON, 
		RECT_SCREEN.right-30, RECT_SCREEN.top, 30, 20,
		g_hWnd,	registerID(goButtonID), g_hInst, NULL);
}

NavFind::~NavFind() {
}

void NavFind::show() {
	ShowWindow(queryEdit,SW_SHOW);
	ShowWindow(go,SW_SHOW);
}

void NavFind::hide() {
	ShowWindow(queryEdit,SW_HIDE);
	ShowWindow(go,SW_HIDE);
}

void NavFind::paint() {
	RECT rect;
	GetWindowRect(queryEdit,&rect);
	RECT bottom=RECT_SCREEN;
	bottom.top=rect.bottom-rect.top;
	drawText(&bottom, query);
}

void NavFind::buttonClicked(int id) {
	if (id==goButtonID) {
		query=L"Search for '";
		query+=getText(queryEdit);
		query+=L"' not implemented";
		refreshScreen();
	}
}
--- NEW FILE: NavFind.h ---
#ifndef NAVFIND_H
#define NAVFIND_H

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "utils.h"

class Navigator;

class NavFind  
{
public:
	NavFind(Navigator* navigator);
	~NavFind();
	void show();
	void paint();
	void hide();
	void buttonClicked(int id);
private:
	Navigator* navigator;
	HWND queryEdit,go;
	int goButtonID;
	UString query;
};

#endif