From 33137ed3971c9bb5ef33339e384b02c39cc46594 Mon Sep 17 00:00:00 2001 From: mbirth Date: Thu, 9 Dec 2004 23:29:26 +0000 Subject: [PATCH] i Committed icon and Symbian packages --- com/symbian/devnet/util/TaskSwitch.java | 176 ++++++++++++++++++++++++ icon/20x16.bmp | Bin 0 -> 1000 bytes icon/20x16m.bmp | Bin 0 -> 126 bytes icon/32x32.bmp | Bin 0 -> 1940 bytes icon/32x32m.bmp | Bin 0 -> 192 bytes 5 files changed, 176 insertions(+) create mode 100644 com/symbian/devnet/util/TaskSwitch.java create mode 100644 icon/20x16.bmp create mode 100644 icon/20x16m.bmp create mode 100644 icon/32x32.bmp create mode 100644 icon/32x32m.bmp diff --git a/com/symbian/devnet/util/TaskSwitch.java b/com/symbian/devnet/util/TaskSwitch.java new file mode 100644 index 0000000..5838b9e --- /dev/null +++ b/com/symbian/devnet/util/TaskSwitch.java @@ -0,0 +1,176 @@ +// TaskSwitch.java +package com.symbian.devnet.util; + +/** + * Brings together four public utility methods giving Java applications + * access to non-AWT visual components provided by the EPOC system. + * @version 1.2 + * @author Copyright (c) 1998-1999 Symbian Ltd. All rights reserved. + */ + +public class TaskSwitch +{ + /** + * Loads the taskswitch1 library from epoc32\\release\\wins\\udeb using + * a debug build or epoc32\\release\\wins\\urel using a release build. + */ + static {System.loadLibrary("taskswitch1");} + + /** EPOC error code */ + private static final int KErrNone = 0; + /** EPOC error code */ + private static final int KErrNotFound = -1; + /** The int for defining the error code returned */ + private static int err; + /** Represents the current version number */ + private static final String VERSION_NUMBER = new String("1.2"); + + /** Represents the native method DisplayTaskList defined in taskswitch1 */ + private static native int DisplayTaskList(); + /** Represents the native method TaskToForeground defined in taskswitch1 */ + private static native int TaskToForeground(String caption); + /** Represents the native method InfoPrint defined in taskswitch1 */ + private static native int InfoPrint(String text); + /** Represents the native method Notify defined in taskswitch1 */ + private static native int Notify(String line1, String line2, String but1, String but2); + /** Represents the native method IsForeground defined in taskswitch1 */ + private static native int IsForeground(String caption); + + /** Private constructor, should not be used because all methods are static. */ + private TaskSwitch() + {} + + /** + * Gets the current TaskSwitch version number + * @return VERSION_NUMBER, the current version number + */ + public static String getVersion() + { + return VERSION_NUMBER; + } + + /** + * Allows the "Open files / programs" dialog to be launched from + * within Java code. As this dialog is not intended for display to end users of + * Quartz devices, developers should not use this method in Quartz Java programs + * other than for testing or debugging purposes. + *

+ * @exception NotFoundException if the Eikon window group is not found + * @throws RuntimeException if any other error condition arises in native code + */ + public static void displayTaskList() throws NotFoundException + { + err = DisplayTaskList(); + if (err != 0) + { + handleWgError(err); + } + } + + /** + * Allows the Java app to find out if it is currently in the foreground. To do + * this it relies on the fact that the Java app's window group (if it has one) + * will always be given by the com.symbian.appName system property + *

+ * @exception NotFoundException if the window group associated with the Java app + * name is not found + * @throws RuntimeException if any other error condition arises in native code + */ + public static boolean isForeground() throws NotFoundException + { + int result = IsForeground(System.getProperty("com.symbian.appName")); + if (result < 0) + { + handleWgError(result); // throws an Exception + } + if (result == 0) + { + return false; + } + else + { + return true; + } + } + + + /** + * Brings to the foreground the window group for the app with a given caption. + * @param caption the task to bring to the foreground + * @exception NotFoundException if the window group with the caption specified + * is not found + * @throws RuntimeException if any other error condition arises in native code + */ + + public static void taskToForeground(String caption) throws NotFoundException + { + err = TaskToForeground(caption); + if(err != 0) + { + handleWgError(err); + } + } + + /** + * Displays the string "text" as an info message in the top right hand corner + * of the screen for a few seconds. The rest of the screen remains responsive + * to user input. + * @param text the text which is displayed in the InfoPrint box + * @throws RuntimeException if any error condition arises in native code + */ + public static void infoPrint(String text) + { + err = InfoPrint(text); + if(err != KErrNone) + { + throw(new RuntimeException("InfoPrint failed. EPOC error code was: " + err)); + } + } + + /** + * Displays a modal dialog asking the user for a confirmation. + * @param line1 the title displayed in the dialog box + * @param line2 the question to be answered + * @param but1 the text for the negative response button + * @param but2 the text for the positive response button + * @return 0 for a "no" and 1 for a "yes" + * @throws RuntimeException if any error condition arises in native code + */ + public static int notify(String line1, String line2, String but1, String but2) + { + int ret = Notify(line1, line2, but1, but2); + if (ret < 0) + { + throw(new RuntimeException("Notify failed. EPOC error code was: " + ret)); + } + else + { + return ret; + } + + } + + + /** + *

Handles EPOC errors arising while attempting to locate non-Java window groups. + * Called by {@link #displayTaskList() displayTaskList}, + * {@link #isForeground() isForeground} and {@link #taskToForeground(java.lang.String) taskToForeground} + * in response to EPOC error codes other than KErrNone = 0.

+ *

A {@link com.symbian.devnet.util.NotFoundException NotFoundException} + * is thrown in response to EPOC error KErrNotFound = -1. + * A RuntimeException, specifying the EPOC error code in its detail message + * string, is thrown in all other cases.

+ * @param errCode the error code returned in the calling function + */ + protected static void handleWgError(int errCode) throws NotFoundException + { + if (errCode == KErrNotFound) + { + throw(new NotFoundException("Window group not found")); + } + else + { + throw(new RuntimeException("Unexpected EPOC Exception. Error code was: " + errCode)); + } + } +} \ No newline at end of file diff --git a/icon/20x16.bmp b/icon/20x16.bmp new file mode 100644 index 0000000000000000000000000000000000000000..1f5f69070af314ec65aa5b5793751f26a2b6b846 GIT binary patch literal 1000 zcmYLHOK?+V7(Ew6`#?dYTA^49S_xDoZFvNWO6r3aK?x5fS`}iI5(|_oiiU^QSRbTS zArvTgy68-@=uEoE%*}$Cn@whJ7M;0Wbmn%^nXu^MXQqq0=;AJ1{G2rD_|5#eU(THK zo$vep-+$=Qax6x28L)-fTAtNB3Mv+HzXGhOE**_X@f1T!iNu%*XWoTekZ^>9(5VpQ zf6V6{=xH5lp9iG zS+J5R*g5*ll9x8%+wO(T7;q*n$RakHK$O0*o-nl*^qX;nPX-~!5^%>;)acOrqX^Mo zPVj$5hs+v~jsxk^Q_yErgMKvvV;~BdH|d#xoU-6BHS-NOQmp%~(qRG8#z+$e6L50mW;o}9fIY$)^D(%S#HKmxbP9zWIikS11MER%jWEQ6 zVx2e&#kyH)b1HQa?kY-c9PX?RF-J{0z`wue`OT z{#j}Sy7$Xq<-3t+|FzAY*SFUyb@e5Ae%ve$Bo6Htuwall RP@WNpnIZT9kPXH_J^;wY9f|+| literal 0 HcmV?d00001 diff --git a/icon/32x32.bmp b/icon/32x32.bmp new file mode 100644 index 0000000000000000000000000000000000000000..432be6eccbe34435989553c6de5304ee1e9fec66 GIT binary patch literal 1940 zcmZuwUszLR7=Mra8!FpCNks`ktZn`SB?N)U3E>8aVp1ShriO-pfT?8*48v(iXfzcO zDa}!#P>E;gbZDXn72MM4@xtdB7hIeRFLvR@x$xrjI|sEcdY|XpzVG|}-rx8BJH|qL z7%A2gM5M!R=8MIUO1U2wOcXU?Y(2(}ykwIki7cC%ND?HHM2Yk|JxR|c5}%0_cp4yK zR3P>OOO|R2Rc@)I^t5#HKk*aq2aX3EzswmyK3IHX17g6P%pbzN4>4oU z)>??iy{E%Y#*}1ex{1TSIM+zx086|RIk&)f5V7JcdEKa&K!H)YRy^??c(27u{w_PY zZI#Fav3pr^G+Oa4Pr^VqCC}B9;ItDDZE*m#@pdCV2XT#Mh><0s2Q~6K$g?jUH9#Gn z%e@uIUyc5I+fi36;L-@{B%oiT$l)nZqK!!C+JL&ke+WJGqR-XPM2yk}GxFU)feXO< z5!Zl)#C{9%utE<#^+EG7YCnR!Ixtf`=@jUaeac9Lp9mijnt{P45_~LKtD)1S$6R?3 zGkP=NCO2}h?kOh!XgBdA$O&4WQ8yWD^~64LkiKmyHQ>GUo@AmnqWHvkG8dYuY#m~h zdxE}s&;vL6&!S(do~bm|r6>KMk&+)5lliHI;%!DM6Yb;x&p3oWW2Sh_9fw&n_egkK zpeCoEM0^v;EvVZwiHvI;(8g?fdAuW#i0>v45J?a)TbM5a^To(EiFFnzoB#irG{HH! zCSzHlFkAJp0DQ!`T$*hZG-Y%$72%0NbA}eaU zFZ}s?=jko)WG_fsxG2wLPGFdrf)F_%jcYvc^S!V?O5ezSOCcEIfW)R=l<`PTUA67} zRrl52o@Hr^L0AlhQ2FiI&Y||bzojf%2*Q-;Xvo82QX>?+uWJ9f{%h{u z9R`^&BWT*RpkRftBV<0Kxy;M>wd?)8ADRs*X-k4%FD)$#4b95R%1o>QuHo-gHFRCS ze(f*4*6@8($igs3#=X7@+wq;l!?%aWl_X>$uAt~CK?&K} zNefeQQNc@&QysSYZ(Mip-u4tJQD;U+Pf1b=m5=_SHPtsY)$d!D6DAYl@>0^| zIxJY0iWAp)@LSuVF!K@IHR?m{z+#ZX% z;YiDo7R9zEGIenvnDUma9veAM?Us&)01x))yj*SiPQ*&N*HQJp!cb2WMuHLwDU5TkIN*kk6YcEe9d;UMa(_xzFA25u(d38_p58NE@ A4*&oF literal 0 HcmV?d00001 diff --git a/icon/32x32m.bmp b/icon/32x32m.bmp new file mode 100644 index 0000000000000000000000000000000000000000..bbb680a585e9c1ef1ec66649a9395dcfb7791fda GIT binary patch literal 192 zcmZwBu?>JA5Czbqvam350WF~f2lE;1SAmKQJd~0XfXl