Moved wxApplet files to the correct locations.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9987 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Kendall Bennett
2001-05-03 20:10:52 +00:00
parent 50c76ce1f7
commit 26ffe1fdba
16 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
<html>
<head><title>Scitech Display Doctor</title></head>
<body>
<BODY BGCOLOR="#FFFFFF" >
<center><IMG SRC="biglogo.bmp"></center>
<hr>
</body>
</html>

View File

@@ -0,0 +1,155 @@
/****************************************************************************
*
* wxWindows HTML Applet Package
*
* ========================================================================
*
* The contents of this file are subject to the wxWindows licence; you
* may not use this file except in compliance with the License. You may
* obtain a copy of the License at http://www.wxwindows.org/licence.htm
*
* Software distributed under the License is distributed on an
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Copyright (C) 2001 SciTech Software, Inc.
*
* The Initial Developer of the Original Code is SciTech Software, Inc.
* All Rights Reserved.
*
* ========================================================================
*
* Language: ANSI C++
* Environment: Any
*
* Description: Main wxApplet sample program
*
****************************************************************************/
// For compilers that support precompilation, includes "wx/wx.h".
#include <wx/wxprec.h>
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/applet/window.h"
#include "applet.h"
/*---------------------------- Global variables ---------------------------*/
// Define the event tables for handling application frame events
BEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(Minimal_Quit, MyFrame::OnQuit)
EVT_MENU(Minimal_About, MyFrame::OnAbout)
EVT_MENU(Minimal_Back, MyFrame::OnBack)
EVT_MENU(Minimal_Forward, MyFrame::OnForward)
END_EVENT_TABLE()
// Create a new application object: this macro will allow wxWindows to create
// the application object during program execution (it's better than using a
// static object for many reasons) and also declares the accessor function
// wxGetApp() which will return the reference of the right type (i.e. MyApp and
// not wxApp)
IMPLEMENT_APP(MyApp)
/*------------------------- Implementation --------------------------------*/
/****************************************************************************
PARAMETERS:
title - Title for the frame window
pos - Position to place to frame window
size - Size of the frame window
REMARKS:
Application frame window constructor
****************************************************************************/
MyFrame::MyFrame(
const wxString& title,
const wxPoint& pos,
const wxSize& size)
: wxFrame(NULL, -1, title, pos, size)
{
// Create a menu bar
wxMenu *menuFile = new wxMenu;
wxMenu *menuNav = new wxMenu;
menuFile->Append(Minimal_Quit, "E&xit");
menuNav->Append(Minimal_Back, "Go &back");
menuNav->Append(Minimal_Forward, "Go &forward");
// Now append the freshly created menu to the menu bar...
wxMenuBar *menuBar = new wxMenuBar;
menuBar->Append(menuFile, "&File");
menuBar->Append(menuNav, "&Navigate");
// ... and attach this menu bar to the frame
SetMenuBar(menuBar);
CreateStatusBar(2);
// Create the HTML window
html = new wxHtmlAppletWindow(this);
html->SetRelatedFrame(this, "wxApplet Demo: '%s'");
html->SetRelatedStatusBar(1);
html->LoadPage("index.html");
}
/****************************************************************************
REMARKS:
Event handler for the 'Exit' menu item
****************************************************************************/
void MyFrame::OnQuit(
wxCommandEvent&)
{
// TRUE is to force the frame to close
Close(TRUE);
}
/****************************************************************************
REMARKS:
Event handler for the 'About' menu item
****************************************************************************/
void MyFrame::OnAbout(
wxCommandEvent&)
{
// TODO: Bring up and about html page!
}
/****************************************************************************
REMARKS:
Event handler for the 'Go back' menu item
****************************************************************************/
void MyFrame::OnBack(
wxCommandEvent&)
{
if (!html -> HistoryBack())
wxMessageBox("You reached prehistory era!");
}
/****************************************************************************
REMARKS:
Event handler for the 'Go forward' menu item
****************************************************************************/
void MyFrame::OnForward(
wxCommandEvent&)
{
if (!html -> HistoryForward())
wxMessageBox("No more items in history!");
}
/****************************************************************************
REMARKS:
`Main program' equivalent: the program execution "starts" here
****************************************************************************/
bool MyApp::OnInit()
{
// Create the main application window
MyFrame *frame = new MyFrame("wxApplet testing application",
wxPoint(50, 50), wxSize(640, 480));
// Show it and tell the application that it's our main window
frame->Show(TRUE);
SetTopWindow(frame);
// Success: wxApp::OnRun() will be called to run the application
return TRUE;
}

View File

@@ -0,0 +1,78 @@
/****************************************************************************
*
* wxWindows HTML Applet Package
*
* ========================================================================
*
* The contents of this file are subject to the wxWindows licence; you
* may not use this file except in compliance with the License. You may
* obtain a copy of the License at http://www.wxwindows.org/licence.htm
*
* Software distributed under the License is distributed on an
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Copyright (C) 2001 SciTech Software, Inc.
*
* The Initial Developer of the Original Code is SciTech Software, Inc.
* All Rights Reserved.
*
* ========================================================================
*
* Language: ANSI C++
* Environment: Any
*
* Description: Main wxApplet sample program header file
*
****************************************************************************/
#ifndef __SAMPLE_H
/*------------------------------ Constants --------------------------------*/
enum {
// Menu items
Minimal_Quit = 1,
Minimal_About,
Minimal_Back,
Minimal_Forward,
// Controls start here (the numbers are, of course, arbitrary)
Minimal_Text = 1000,
};
/*--------------------------- Class Definitions ---------------------------*/
/****************************************************************************
REMARKS:
Define a new application type, each program should derive a class from wxApp
****************************************************************************/
class MyApp : public wxApp {
public:
// Initialise the application on startup
virtual bool OnInit();
};
/****************************************************************************
REMARKS:
Define a new frame type: this is going to be our main frame
****************************************************************************/
class MyFrame : public wxFrame {
private:
DECLARE_EVENT_TABLE() // Declare event table
wxHtmlAppletWindow *html; // Pointer to the html applet window
public:
// Constructor
MyFrame(const wxString& title, const wxPoint& pos, const wxSize& size);
// Event handlers
void OnQuit(wxCommandEvent& event);
void OnAbout(wxCommandEvent& event);
void OnBack(wxCommandEvent& event);
void OnForward(wxCommandEvent& event);
};
#endif // __SAMPLE_H

View File

@@ -0,0 +1,2 @@
#include "wx/msw/wx.rc"

View File

@@ -0,0 +1,172 @@
/****************************************************************************
*
* wxWindows HTML Applet Package
*
* ========================================================================
*
* The contents of this file are subject to the wxWindows licence; you
* may not use this file except in compliance with the License. You may
* obtain a copy of the License at http://www.wxwindows.org/licence.htm
*
* Software distributed under the License is distributed on an
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Copyright (C) 2001 SciTech Software, Inc.
*
* The Initial Developer of the Original Code is SciTech Software, Inc.
* All Rights Reserved.
*
* ========================================================================
*
* Language: ANSI C++
* Environment: Any
*
* Description: Combobox wrapper. This file implements the custom
* combo boxes used for this sample program.
*
****************************************************************************/
// For compilers that support precompilation, includes "wx/wx.h".
#include <wx/wxprec.h>
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "combobox.h"
/*------------------------- Implementation --------------------------------*/
ComboBox::ComboBox(
wxWindow *parent,
int listid,
int textid)
: m_Parent(parent), m_ListBoxId(listid), m_TextCtrlId(textid)
{
m_ListBox = wxDynamicCast(m_Parent->FindWindow(listid),wxListBox);
m_TextCtrl = wxDynamicCast(m_Parent->FindWindow(textid),wxTextCtrl);
}
int ComboBox::GetListBoxId()
{
return m_ListBoxId;
}
int ComboBox::GetSelection()
{
return m_ListBox->GetSelection();
}
wxString ComboBox::GetStringSelection()
{
return m_ListBox->GetStringSelection();
}
bool ComboBox::SetStringSelection(const wxString& s, bool select)
{
select = TRUE;
select = m_ListBox->SetStringSelection(s, select);
m_TextCtrl->SetValue(GetStringSelection());
return select;
}
void ComboBox::Select(int n)
{
m_ListBox->Select(n);
m_TextCtrl->SetValue(GetStringSelection());
}
void ComboBox::Deselect(int n)
{
m_ListBox->Deselect(n);
}
void ComboBox::Insert(const wxString& item, int pos)
{
m_ListBox->Insert(item,pos);
}
void ComboBox::Insert(const wxString& item, int pos, void *clientData)
{
m_ListBox->Insert(item, pos, clientData);
}
void ComboBox::Insert(const wxString& item, int pos, wxClientData *clientData)
{
m_ListBox->Insert(item, pos, clientData);
}
void ComboBox::InsertItems(int nItems, const wxString *items, int pos)
{
m_ListBox->InsertItems(nItems, items, pos);
}
void ComboBox::InsertItems(const wxArrayString& items, int pos)
{
m_ListBox->InsertItems(items, pos);
}
void ComboBox::Set(int n, const wxString* items, void **clientData)
{
m_ListBox->Set(n, items, clientData);
m_TextCtrl->SetValue(GetStringSelection());
}
void ComboBox::Set(const wxArrayString& items, void **clientData)
{
m_ListBox->Set(items, clientData);
m_TextCtrl->SetValue(GetStringSelection());
}
int ComboBox::FindString(const wxString &s)
{
return (m_ListBox->FindString(s));
}
void ComboBox::SetFirstItem(int n)
{
m_ListBox->SetFirstItem(n);
m_TextCtrl->SetValue(GetStringSelection());
}
void ComboBox::SetFirstItem(const wxString &s)
{
m_ListBox->SetFirstItem(s);
m_TextCtrl->SetValue(GetStringSelection());
}
void ComboBox::Append(const wxString &item)
{
m_ListBox->Append(item);
m_TextCtrl->SetValue(GetStringSelection());
}
void ComboBox::Append(const wxString& item, void *clientData)
{
m_ListBox->Append(item, clientData);
m_TextCtrl->SetValue(GetStringSelection());
}
void ComboBox::Append(const wxString& item, wxClientData *clientData)
{
m_ListBox->Append(item, clientData);
m_TextCtrl->SetValue(GetStringSelection());
}
void ComboBox::Clear()
{
m_ListBox->Clear();
m_TextCtrl->SetValue(GetStringSelection());
}
void ComboBox::Delete(int n)
{
m_ListBox->Delete(n);
m_TextCtrl->SetValue(GetStringSelection());
}
void ComboBox::OnChange(wxCommandEvent &)
{
m_TextCtrl->SetValue(GetStringSelection());
}

View File

@@ -0,0 +1,98 @@
/****************************************************************************
*
* wxWindows HTML Applet Package
*
* ========================================================================
*
* The contents of this file are subject to the wxWindows licence; you
* may not use this file except in compliance with the License. You may
* obtain a copy of the License at http://www.wxwindows.org/licence.htm
*
* Software distributed under the License is distributed on an
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is Copyright (C) 2001 SciTech Software, Inc.
*
* The Initial Developer of the Original Code is SciTech Software, Inc.
* All Rights Reserved.
*
* ========================================================================
*
* Language: ANSI C++
* Environment: Any
*
* Description: Combobox wrapper. This header file defines the custom
* combo boxes used for this sample program.
*
****************************************************************************/
#ifndef __COMBOBOX_H
#define __COMBOBOX_H
/*--------------------------- Class Definitions ---------------------------*/
/****************************************************************************
REMARKS:
Defines a Custom ComboBox. This combobox is a portable implementation of
the msw combobox control. It is made of the wxWindows textctrl primitive and
the listbox primitive. This object does not create or display the controls,
it provides the relationship and underlying behavior layer for the primitives
allready created via wxDesigner.
****************************************************************************/
class ComboBox {
private:
int m_ListBoxId;
int m_TextCtrlId;
wxWindow *m_Parent;
wxListBox *m_ListBox;
wxTextCtrl *m_TextCtrl;
public:
// Constructor
ComboBox(wxWindow *parent, int,int);
// Returns the id of the listbox: listBoxId.
int GetListBoxId();
// Inserts: Used to insert items into the listbox
void Insert(const wxString& item, int pos);
void Insert(const wxString& item, int pos, void *clientData);
void Insert(const wxString& item, int pos, wxClientData *clientData);
void InsertItems(int nItems, const wxString *items, int pos);
void InsertItems(const wxArrayString& items, int pos);
// Sets: Used to set items in the combo box
void Set(int n, const wxString* items, void **clientData );
void Set(const wxArrayString& items, void **clientData);
int FindString(const wxString &s);
// Selections: Used to get/de/select items in the listbox
void Select(int n);
void Deselect(int n);
int GetSelection();
wxString GetStringSelection();
bool SetStringSelection(const wxString& s, bool select);
// Set the specified item at the first visible item or scroll to max
// range.
void SetFirstItem(int n);
void SetFirstItem(const wxString& s);
// Append items to the listbox
void Append(const wxString& item);
void Append(const wxString& item, void *clientData);
void Append(const wxString& item, wxClientData *clientData);
// Deleting items from the list box
void Clear();
void Delete(int n);
// OnChange event function (called from SDD dialog box code, see: dialog.h) Mimic
// msw combobox behavior: Click on listbox item it shows in textbox.
void OnChange(wxCommandEvent &event);
};
#endif // __COMBOBOX_H

Binary file not shown.

View File

@@ -0,0 +1,106 @@
//------------------------------------------------------------------------------
// Source code generated by wxDesigner from file: dialogs.wdr
// Do not modify this file, all changes will be lost!
//------------------------------------------------------------------------------
#ifdef __GNUG__
#pragma implementation "dialogs_wdr.cpp"
#endif
// For compilers that support precompilation
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
// Include private header
#include "dialogs_wdr.h"
// Implement window functions
wxSizer *MonitorDialogFunc( wxPanel *parent, bool call_fit, bool set_sizer )
{
wxSizer *item0 = new wxBoxSizer( wxVERTICAL );
wxSizer *item1 = new wxFlexGridSizer( 2, 0, 0 );
wxSizer *item2 = new wxBoxSizer( wxHORIZONTAL );
wxStaticText *item3 = new wxStaticText( parent, ID_TEXT_MANUFACTURER, "Manufacturer:", wxDefaultPosition, wxSize(180,-1), 0 );
item3->SetForegroundColour( *wxBLACK );
item3->SetBackgroundColour( *wxWHITE );
item2->Add( item3, 0, wxALIGN_CENTRE, 5 );
item2->Add( 10, 20, 0, wxALIGN_CENTRE, 5 );
item1->Add( item2, 0, wxALIGN_CENTER_VERTICAL, 5 );
wxSizer *item4 = new wxBoxSizer( wxHORIZONTAL );
wxStaticText *item5 = new wxStaticText( parent, ID_TEXT_MODEL, "Model:", wxDefaultPosition, wxSize(250,-1), 0 );
item5->SetForegroundColour( *wxBLACK );
item5->SetBackgroundColour( *wxWHITE );
item4->Add( item5, 0, wxALIGN_CENTRE, 5 );
item1->Add( item4, 0, wxALIGN_CENTER_VERTICAL, 5 );
wxSizer *item6 = new wxBoxSizer( wxHORIZONTAL );
wxTextCtrl *item7 = new wxTextCtrl( parent, ID_TEXTCTRL_MFTR, "", wxDefaultPosition, wxSize(190,-1), wxTE_READONLY );
item7->SetForegroundColour( *wxBLACK );
item7->SetBackgroundColour( *wxWHITE );
item6->Add( item7, 0, wxALIGN_CENTRE, 5 );
item6->Add( 15, 20, 0, wxALIGN_CENTRE, 5 );
item1->Add( item6, 0, wxALIGN_CENTRE, 5 );
wxSizer *item8 = new wxBoxSizer( wxHORIZONTAL );
wxTextCtrl *item9 = new wxTextCtrl( parent, ID_TEXTCTRL_MDL, "", wxDefaultPosition, wxSize(260,-1), wxTE_READONLY );
item8->Add( item9, 0, wxALIGN_CENTRE, 5 );
item1->Add( item8, 0, wxALIGN_CENTRE, 5 );
wxSizer *item10 = new wxBoxSizer( wxHORIZONTAL );
wxString *strs11 = (wxString*) NULL;
wxListBox *item11 = new wxListBox( parent, ID_LISTBOX_MFTR, wxDefaultPosition, wxSize(190,150), 0, strs11, wxLB_SORT|wxLB_ALWAYS_SB );
item10->Add( item11, 0, wxALIGN_CENTRE, 5 );
item10->Add( 15, 20, 0, wxALIGN_CENTRE, 5 );
item1->Add( item10, 0, wxALIGN_CENTRE, 5 );
wxSizer *item12 = new wxBoxSizer( wxHORIZONTAL );
wxString *strs13 = (wxString*) NULL;
wxListBox *item13 = new wxListBox( parent, ID_LISTBOX_MDL, wxDefaultPosition, wxSize(260,150), 0, strs13, wxLB_SORT|wxLB_NEEDED_SB );
item13->SetForegroundColour( *wxBLACK );
item13->SetBackgroundColour( *wxWHITE );
item12->Add( item13, 0, wxALIGN_CENTRE, 5 );
item1->Add( item12, 0, wxALIGN_CENTRE, 5 );
item0->Add( item1, 0, wxALIGN_CENTRE, 15 );
if (set_sizer)
{
parent->SetAutoLayout( TRUE );
parent->SetSizer( item0 );
if (call_fit)
{
item0->Fit( parent );
item0->SetSizeHints( parent );
}
}
return item0;
}
// Implement bitmap functions
// End of generated file

View File

@@ -0,0 +1,42 @@
//------------------------------------------------------------------------------
// Header generated by wxDesigner from file: dialogs.wdr
// Do not modify this file, all changes will be lost!
//------------------------------------------------------------------------------
#ifndef __WDR_dialogs_H__
#define __WDR_dialogs_H__
#ifdef __GNUG__
#pragma interface "dialogs_wdr.cpp"
#endif
// Include wxWindows' headers
#ifndef WX_PRECOMP
#include <wx/wx.h>
#endif
#include <wx/image.h>
#include <wx/statline.h>
#include <wx/spinbutt.h>
#include <wx/spinctrl.h>
#include <wx/splitter.h>
#include <wx/listctrl.h>
#include <wx/treectrl.h>
#include <wx/notebook.h>
// Declare window functions
#define ID_TEXT_MANUFACTURER 10000
#define ID_TEXT_MODEL 10001
#define ID_TEXTCTRL_MFTR 10
#define ID_TEXTCTRL_MDL 20
#define ID_LISTBOX_MFTR 11
#define ID_LISTBOX_MDL 21
wxSizer *MonitorDialogFunc( wxPanel *parent, bool call_fit = TRUE, bool set_sizer = TRUE );
// Declare bitmap functions
#endif
// End of generated file

View File

@@ -0,0 +1,20 @@
<html>
<head><title>Widgets demo</title></head>
<body>
<h3>wxHtmlWidgetCell demonstration</h3>
There is binded window somewhere around. Enjoy it.
<A HREF="about.html">About...</A>
<insert "wxChipsetName">
<hr>
<center>
<embed applet="MonitorApplet" width=100 height=100>
</center>
<hr>
</body>
</html>

View File

@@ -0,0 +1,221 @@
/****************************************************************************
*
* wxWindows HTML Applet Package
*
* Copyright (C) 1991-2001 SciTech Software, Inc.
* All rights reserved.
*
* ======================================================================
* |REMOVAL OR MODIFICATION OF THIS HEADER IS STRICTLY PROHIBITED BY LAW|
* | |
* |This copyrighted computer code is a proprietary trade secret of |
* |SciTech Software, Inc., located at 505 Wall Street, Chico, CA 95928 |
* |USA (www.scitechsoft.com). ANY UNAUTHORIZED POSSESSION, USE, |
* |VIEWING, COPYING, MODIFICATION OR DISSEMINATION OF THIS CODE IS |
* |STRICTLY PROHIBITED BY LAW. Unless you have current, express |
* |written authorization from SciTech to possess or use this code, you |
* |may be subject to civil and/or criminal penalties. |
* | |
* |If you received this code in error or you would like to report |
* |improper use, please immediately contact SciTech Software, Inc. at |
* |530-894-8400. |
* | |
* |REMOVAL OR MODIFICATION OF THIS HEADER IS STRICTLY PROHIBITED BY LAW|
* ======================================================================
*
* Language: ANSI C++
* Environment: Any
*
* Description: Main wxApplet class implementation
*
****************************************************************************/
// For compilers that support precompilation
#include "wx/wxprec.h"
// Include private headers
#include "monitorapplet.h"
/*---------------------------- Global variables ---------------------------*/
// Implement the dynamic class so it can be constructed dynamically
IMPLEMENT_DYNAMIC_CLASS(MonitorApplet, wxApplet);
// Event handler table.
BEGIN_EVENT_TABLE(MonitorApplet, wxApplet)
EVT_LISTBOX(ID_LISTBOX_MFTR, MonitorApplet::OnChange)
EVT_LISTBOX(ID_LISTBOX_MDL, MonitorApplet::OnChange)
END_EVENT_TABLE()
// Include database of known monitors. Normally this would come from a
// real database on disk, but for this simple example we hard code all
// the values into a table.
#include "monitors.c"
/*------------------------- Implementation --------------------------------*/
/****************************************************************************
REMARKS:
Constructor called during dynamic creation. Simple initialise all
internal values for the class so that it can be properly created later
via the virtual Create member function.
****************************************************************************/
MonitorApplet::MonitorApplet()
{
m_Mfr = NULL;
m_Model = NULL;
m_Data = NULL;
}
/****************************************************************************
REMARKS:
Psuedo virtual constructor for the MonitorApplet class.
****************************************************************************/
bool MonitorApplet::Create(
wxHtmlAppletWindow *parent,
const wxSize& size,
long style)
{
bool ret = wxApplet::Create(parent, size, style);
if (ret) {
// Read our cookie or create it if it does not exist
if ((m_Data = (MonitorData*)parent->FindCookie(MONITOR_COOKIE_NAME)) == NULL) {
m_Data = new MonitorData;
memset(&m_Data->m_Monitor,0,sizeof(m_Data->m_Monitor));
parent->RegisterCookie(MONITOR_COOKIE_NAME,m_Data);
}
// Create all the controls and initialise them
MonitorDialogFunc(this,true,true);
if ((m_Mfr = new ComboBox(this , ID_LISTBOX_MFTR, ID_TEXTCTRL_MFTR)) == NULL)
return false;
if ((m_Model = new ComboBox(this , ID_LISTBOX_MDL, ID_TEXTCTRL_MDL)) == NULL)
return false;
ReadMfrList();
ReadModelList(true);
}
return ret;
}
/****************************************************************************
REMARKS:
Destructor for the MonitorApplet class.
****************************************************************************/
MonitorApplet::~MonitorApplet()
{
delete m_Mfr;
delete m_Model;
}
/****************************************************************************
REMARKS:
Save the current state for the applet to our cookie
****************************************************************************/
void MonitorApplet::SaveCurrentState()
{
// Read currently selected strings into cookie
strcpy(m_Data->m_Monitor.m_Mfr,m_Mfr->GetStringSelection());
strcpy(m_Data->m_Monitor.m_Model,m_Model->GetStringSelection());
}
/****************************************************************************
REMARKS:
Handles user navigation away from the applet via an HTML link
****************************************************************************/
void MonitorApplet::OnLinkClicked(
const wxHtmlLinkInfo&)
{
SaveCurrentState();
}
/****************************************************************************
REMARKS:
Handles user navigation away from the applet via the history forward command
****************************************************************************/
void MonitorApplet::OnHistoryForward()
{
SaveCurrentState();
}
/****************************************************************************
REMARKS:
Handles user navigation away from the applet via the history back command
****************************************************************************/
void MonitorApplet::OnHistoryBack()
{
SaveCurrentState();
}
/****************************************************************************
REMARKS:
Handles inter applet communication messages
****************************************************************************/
void MonitorApplet::OnMessage(
wxEvent& msg)
{
msg.Skip(true);
}
/****************************************************************************
REMARKS:
****************************************************************************/
void MonitorApplet::OnChange(
wxCommandEvent &evt)
{
if (evt.GetId() == m_Mfr->GetListBoxId()) {
m_Mfr->OnChange(evt);
ReadModelList(true);
}
else if (evt.GetId() == m_Model->GetListBoxId()) {
m_Model->OnChange(evt);
}
}
/****************************************************************************
REMARKS:
Updates the manufacturer list for the dialog box from the database.
****************************************************************************/
void MonitorApplet::ReadMfrList()
{
char buf[80] = "";
int i,selected = 0;
MonitorEntry *m;
m_Mfr->Clear();
for (m = m_Monitors,i = 0; m->m_Mfr[0] != 0; m++) {
if (stricmp(buf,m->m_Mfr) != 0) {
m_Mfr->Append(m->m_Mfr);
if (stricmp(m_Data->m_Monitor.m_Mfr,m->m_Mfr) == 0)
selected = i;
strcpy(buf,m->m_Mfr);
i++;
}
}
m_Mfr->Select(selected);
}
/****************************************************************************
REMARKS:
Updates the model list for the dialog box for the currently selected
manufacturer type.
****************************************************************************/
void MonitorApplet::ReadModelList(
bool selectCurrent)
{
int i,selected = 0;
MonitorEntry *m;
wxString mfrStr;
mfrStr = m_Mfr->GetStringSelection();
m_Model->Clear();
for (m = m_Monitors,i = 0; m->m_Mfr[0] != 0; m++) {
if (stricmp(mfrStr,m->m_Mfr) == 0) {
m_Model->Append(m->m_Model);
if (selectCurrent && stricmp(m_Data->m_Monitor.m_Model,m->m_Model) == 0)
selected = i;
i++;
}
}
m_Model->Select(selected);
}

View File

@@ -0,0 +1,114 @@
/****************************************************************************
*
* Copyright (C) 1991-2001 SciTech Software, Inc.
* All rights reserved.
*
* ======================================================================
* |REMOVAL OR MODIFICATION OF THIS HEADER IS STRICTLY PROHIBITED BY LAW|
* | |
* |This copyrighted computer code is a proprietary trade secret of |
* |SciTech Software, Inc., located at 505 Wall Street, Chico, CA 95928 |
* |USA (www.scitechsoft.com). ANY UNAUTHORIZED POSSESSION, USE, |
* |VIEWING, COPYING, MODIFICATION OR DISSEMINATION OF THIS CODE IS |
* |STRICTLY PROHIBITED BY LAW. Unless you have current, express |
* |written authorization from SciTech to possess or use this code, you |
* |may be subject to civil and/or criminal penalties. |
* | |
* |If you received this code in error or you would like to report |
* |improper use, please immediately contact SciTech Software, Inc. at |
* |530-894-8400. |
* | |
* |REMOVAL OR MODIFICATION OF THIS HEADER IS STRICTLY PROHIBITED BY LAW|
* ======================================================================
*
* Language: ANSI C++
* Environment: Any
*
* Description: Header file for the MonitorApplet class
*
****************************************************************************/
#ifndef __WX_MONITORAPPLET_H
#define __WX_MONITORAPPLET_H
#include "wx/applet/applet.h"
#include "combobox.h"
#include "dialogs_wdr.h"
/*--------------------------- Class Definitions ---------------------------*/
/****************************************************************************
REMARKS:
Structure defining the simple monitor database records.
****************************************************************************/
struct MonitorEntry {
char m_Mfr[60];
char m_Model[60];
};
/****************************************************************************
REMARKS:
Defines our wxMonitorData cookie object that is stored to maintain state
information for this MonitorApplet.
****************************************************************************/
class MonitorData : public wxObject {
public:
MonitorEntry m_Monitor;
};
// Name used to track the monitor data cookie
#define MONITOR_COOKIE_NAME "MonitorData"
/****************************************************************************
REMARKS:
Defines our wxMonitor applet class
****************************************************************************/
class MonitorApplet : public wxApplet {
private:
DECLARE_DYNAMIC_CLASS(MonitorApplet);
DECLARE_EVENT_TABLE();
protected:
ComboBox *m_Mfr;
ComboBox *m_Model;
MonitorData *m_Data;
static MonitorEntry m_Monitors[];
// Flush the current state to a cookie
void SaveCurrentState();
public:
// Constructor (called during dynamic creation)
MonitorApplet();
// Psuedo virtual constructor
virtual bool Create(
wxHtmlAppletWindow *parent,
const wxSize& size,
long style);
// Virtual destructor
virtual ~MonitorApplet();
// Handle HTML navigation to a new URL
virtual void OnLinkClicked(const wxHtmlLinkInfo& link);
// Handle HTML navigation forward command in applet
virtual void OnHistoryForward();
// Handle HTML navigation back command in applet
virtual void OnHistoryBack();
// Handle messages from the wxAppletManager and other applets
virtual void OnMessage(wxEvent& msg);
// Update the model and menufacturer lists
void ReadMfrList();
void ReadModelList(bool selectCurrent);
// Event handlers
void OnChange(wxCommandEvent &event);
};
#endif // __WX_MONITORAPPLET_H

File diff suppressed because it is too large Load Diff