You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
104 lines
2.6 KiB
104 lines
2.6 KiB
11 years ago
|
import org.trinitydesktop.qt.*;
|
||
|
import org.trinitydesktop.koala.*;
|
||
15 years ago
|
|
||
|
/**
|
||
|
* Class KHelpers is the main application window.
|
||
|
*
|
||
|
* Taken from KDE 2.0 Development book
|
||
|
*
|
||
|
* ToolTips, What's This?, and More
|
||
|
*
|
||
|
*
|
||
|
*
|
||
12 years ago
|
* @see TDEMainWindow
|
||
12 years ago
|
* @see TDEApplication
|
||
15 years ago
|
*
|
||
|
* @author java translation Kenneth J. Pouncey, kjpou@hotmail.com
|
||
|
* @version 0.1
|
||
|
*/
|
||
|
|
||
12 years ago
|
public class KHelpers extends TDEMainWindow {
|
||
15 years ago
|
|
||
|
// File menu item id's
|
||
|
protected int idfilenew;
|
||
|
protected int idfileopen;
|
||
|
protected int idfilesave;
|
||
12 years ago
|
protected int idfilequit;
|
||
15 years ago
|
|
||
|
// reference to the application
|
||
12 years ago
|
TDEApplication kapp;
|
||
15 years ago
|
|
||
|
// time to display the message in the status bar
|
||
|
int HelpMessageTime = 200;
|
||
|
|
||
|
public KHelpers () {
|
||
|
|
||
|
// get a reference to the application
|
||
12 years ago
|
kapp = TDEApplication.kApplication();
|
||
15 years ago
|
|
||
13 years ago
|
TQPopupMenu file = new TQPopupMenu(this);
|
||
15 years ago
|
|
||
|
idfilenew = file.insertItem("&New");
|
||
|
idfileopen = file.insertItem("&Open...");
|
||
|
idfilesave = file.insertItem("&Save");
|
||
12 years ago
|
idfilequit = file.insertItem("&Quit", kapp, SLOT("closeAllWindows()"));
|
||
15 years ago
|
|
||
|
connect ( file, SIGNAL( "highlighted(int)"), this, SLOT( "slotMenuEntryHelp (int)"));
|
||
|
|
||
|
menuBar().insertItem("&File",file);
|
||
|
|
||
13 years ago
|
TQPopupMenu help = helpMenu("KHelpers\n" +
|
||
15 years ago
|
"Copyright (C) 2000 By Joe Developer\n\n" +
|
||
|
"KHelpers demonstates a few of the ways " +
|
||
|
"that your application can provide help to a user");
|
||
|
|
||
|
help.insertSeparator();
|
||
|
help.insertItem("Help on a special topic", this, SLOT("slotSpecialHelp()"));
|
||
|
|
||
|
menuBar().insertItem("&Help",help);
|
||
|
|
||
|
// Create the statusbar
|
||
|
statusBar();
|
||
|
|
||
13 years ago
|
TQLabel clientarea = new TQLabel(this);
|
||
15 years ago
|
clientarea.setBackgroundColor(Qt.white());
|
||
|
|
||
13 years ago
|
TQToolTip.add(clientarea, "Functionless client area");
|
||
|
TQWhatsThis.add(clientarea,"This client area doesn't do anything.");
|
||
15 years ago
|
|
||
|
setCentralWidget(clientarea);
|
||
|
|
||
|
clientarea.setFocus();
|
||
|
}
|
||
|
|
||
|
public void slotMenuEntryHelp (int id) {
|
||
|
|
||
|
if (id == idfilenew) {
|
||
|
statusBar().message("Create a new document.",HelpMessageTime);
|
||
|
}
|
||
|
else if (id == idfileopen) {
|
||
|
|
||
|
statusBar().message("Open a file.",HelpMessageTime);
|
||
|
|
||
|
}
|
||
|
else if (id == idfilesave) {
|
||
|
|
||
|
statusBar().message("Save the current document.",HelpMessageTime);
|
||
|
|
||
|
}
|
||
12 years ago
|
else if (id == idfilequit) {
|
||
15 years ago
|
|
||
|
statusBar().message("Quit the application.",HelpMessageTime);
|
||
|
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void slotSpecialHelp() {
|
||
|
|
||
|
String helpfilename = kapp.name();
|
||
|
helpfilename += "/specialhelp.html";
|
||
|
kapp.invokeHelp(helpfilename,"");
|
||
|
}
|
||
|
|
||
|
}
|