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.
165 lines
5.5 KiB
165 lines
5.5 KiB
15 years ago
|
import java.util.*;
|
||
|
|
||
11 years ago
|
import org.trinitydesktop.qt.*;
|
||
|
import org.trinitydesktop.koala.*;
|
||
15 years ago
|
/*
|
||
|
$Id$
|
||
|
|
||
13 years ago
|
Requires the Qt widget libraries, available at no cost at
|
||
15 years ago
|
http://www.troll.no
|
||
|
|
||
|
Copyright (C) 1996 Bernd Johannes Wuebben
|
||
|
wuebben@math.cornell.edu
|
||
|
|
||
|
This program is free software; you can redistribute it and/or modify
|
||
|
it under the terms of the GNU General Public License as published by
|
||
|
the Free Software Foundation; either version 2 of the License, or
|
||
|
(at your option) any later version.
|
||
|
|
||
|
This program is distributed in the hope that it will be useful,
|
||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
GNU General Public License for more details.
|
||
|
|
||
|
You should have received a copy of the GNU General Public License
|
||
|
along with this program; if not, write to the Free Software
|
||
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||
|
|
||
|
*/
|
||
|
|
||
|
/**
|
||
12 years ago
|
* Class to test TDEFontDialog widgets.
|
||
15 years ago
|
*
|
||
12 years ago
|
* This is a translation to java from tdefontdialogtest.cpp in the tests library
|
||
13 years ago
|
* of tdeui source.
|
||
15 years ago
|
*
|
||
12 years ago
|
* @see TDEFontDialog
|
||
12 years ago
|
* @see TDEApplication
|
||
12 years ago
|
* @see TDEConfig
|
||
15 years ago
|
*
|
||
|
* @author Bernd Johannes Wuebben, java translation Kenneth J. Pouncey, kjpou@hotmail.com
|
||
|
* @version 0.1
|
||
|
*/
|
||
12 years ago
|
public class TDEFontDialogTest {
|
||
15 years ago
|
|
||
12 years ago
|
static String description = "Java TDEFontDialog test program.";
|
||
15 years ago
|
static String[][] options = { };
|
||
|
static String VERSION = "0.1";
|
||
|
|
||
|
public static void main(String[] cmdLineArgs) {
|
||
|
|
||
12 years ago
|
TDEAboutData aboutData = new TDEAboutData( "tdefontdialogtest", "TDEFontDialogTest",
|
||
12 years ago
|
VERSION, description, TDEAboutData.License_GPL,
|
||
15 years ago
|
"(c) 2002, Kenneth J. Pouncey");
|
||
|
aboutData.addAuthor("Kenneth J. Pouncey",null, "kjpou@hotmail.com");
|
||
12 years ago
|
TDECmdLineArgs.init( cmdLineArgs, aboutData );
|
||
|
TDECmdLineArgs.addCmdLineOptions( options ); // Add our own options.
|
||
15 years ago
|
|
||
12 years ago
|
TDEApplication app = new TDEApplication();
|
||
15 years ago
|
|
||
|
// parse the args
|
||
12 years ago
|
TDECmdLineArgs args = TDECmdLineArgs.parsedArgs();
|
||
15 years ago
|
|
||
12 years ago
|
TDEConfig aConfig = new TDEConfig();
|
||
12 years ago
|
aConfig.setGroup( "TDEFontDialog-test" );
|
||
15 years ago
|
|
||
|
// parameters are Font name, Font Point Size, Font Style, Font Italic
|
||
13 years ago
|
app.setFont(new TQFont("Helvetica",12,TQFont.Normal,false));
|
||
|
// app.setFont(new TQFont("Times",18,TQFont.Bold,true));
|
||
15 years ago
|
|
||
13 years ago
|
TQFont font = aConfig.readFontEntry( "Chosen" );
|
||
15 years ago
|
|
||
12 years ago
|
int nRet = TDEFontDialog.getFont(font);
|
||
15 years ago
|
|
||
12 years ago
|
// return values from TDEFontDialog
|
||
15 years ago
|
// nRet = 1 for OK Button
|
||
|
// nRet = 0 for Cancel button
|
||
|
|
||
|
if (nRet == 1) { // print out font values
|
||
12 years ago
|
System.out.println("Ok Button pressed from TDEFontDialog ");
|
||
15 years ago
|
System.out.println(" Font name selected: " + font.family());
|
||
|
System.out.println(" Font Point Size selected: " + font.pointSize());
|
||
|
System.out.println(" Font Bold?: " + font.bold());
|
||
|
System.out.println(" Font Italic?: " + font.italic());
|
||
|
System.out.println(" Font Underline?: " + font.underline());
|
||
|
// System.out.println(" Font Character Set: " + getCharacterSet(font.charSet()));
|
||
|
System.out.println(" Font raw name selected: " + font.rawName());
|
||
|
}
|
||
|
|
||
|
int[] flags = { 0 };
|
||
|
|
||
12 years ago
|
//Static method for TDEFontDialog needs to be generated
|
||
|
nRet = TDEFontDialog.getFontDiff(font, flags);
|
||
15 years ago
|
if (nRet == 1) {
|
||
12 years ago
|
System.out.println("Ok Button pressed from TDEFontDialog diff dialog ");
|
||
15 years ago
|
System.out.println(" Font diff flags: " + flags[0]);
|
||
|
System.out.println(" Font name selected: " + font.family());
|
||
|
System.out.println(" Font Point Size selected: " + font.pointSize());
|
||
|
System.out.println(" Font Bold?: " + font.bold());
|
||
|
System.out.println(" Font Italic?: " + font.italic());
|
||
|
System.out.println(" Font Underline?: " + font.underline());
|
||
|
System.out.println(" Font raw name selected: " + font.rawName());
|
||
|
}
|
||
|
|
||
|
// This should save off the font chose in the configuration so it can
|
||
|
// be read next time.
|
||
|
aConfig.writeEntry( "Chosen", font,true,false,false );
|
||
|
|
||
|
aConfig.sync();
|
||
|
|
||
|
app.exec();
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Returns the string representation of the character set.
|
||
|
* Others should be added here.
|
||
|
*/
|
||
|
/* private static String getCharacterSet (int cs) {
|
||
|
|
||
|
switch (cs) {
|
||
|
|
||
13 years ago
|
case TQFont.ISO_8859_1 :
|
||
15 years ago
|
return "ISO_8859_1";
|
||
13 years ago
|
case TQFont.ISO_8859_2 :
|
||
15 years ago
|
return "ISO_8859_2";
|
||
13 years ago
|
case TQFont.ISO_8859_3 :
|
||
15 years ago
|
return "ISO_8859_3";
|
||
13 years ago
|
case TQFont.ISO_8859_4 :
|
||
15 years ago
|
return "ISO_8859_4";
|
||
13 years ago
|
case TQFont.ISO_8859_5 :
|
||
15 years ago
|
return "ISO_8859_5";
|
||
13 years ago
|
case TQFont.ISO_8859_6 :
|
||
15 years ago
|
return "ISO_8859_6";
|
||
13 years ago
|
case TQFont.ISO_8859_7 :
|
||
15 years ago
|
return "ISO_8859_7";
|
||
13 years ago
|
case TQFont.ISO_8859_8 :
|
||
15 years ago
|
return "ISO_8859_8";
|
||
13 years ago
|
case TQFont.ISO_8859_9 :
|
||
15 years ago
|
return "ISO_8859_9";
|
||
13 years ago
|
case TQFont.ISO_8859_10 :
|
||
15 years ago
|
return "ISO_8859_10";
|
||
13 years ago
|
case TQFont.ISO_8859_11 :
|
||
15 years ago
|
return "ISO_8859_11";
|
||
13 years ago
|
case TQFont.ISO_8859_12 :
|
||
15 years ago
|
return "ISO_8859_12";
|
||
13 years ago
|
case TQFont.ISO_8859_13 :
|
||
15 years ago
|
return "ISO_8859_13";
|
||
13 years ago
|
case TQFont.ISO_8859_14 :
|
||
15 years ago
|
return "ISO_8859_14";
|
||
13 years ago
|
case TQFont.ISO_8859_15 :
|
||
15 years ago
|
return "ISO_8859_15";
|
||
|
|
||
|
// more should be added
|
||
|
default :
|
||
|
return " other ";
|
||
|
|
||
|
}
|
||
|
} */
|
||
|
static {
|
||
|
qtjava.initialize();
|
||
11 years ago
|
tdejava.initialize();
|
||
15 years ago
|
}
|
||
|
|
||
|
}
|