Back to index

wims  3.65+svn20090927
Public Member Functions | Static Public Attributes | Package Attributes | Private Attributes
rene.gui.ToggleIcon Class Reference
Inheritance diagram for rene.gui.ToggleIcon:
Inheritance graph
[legend]
Collaboration diagram for rene.gui.ToggleIcon:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ToggleIcon (IconBar bar, String file, IconGroup g)
 ToggleIcon (IconBar bar, String file, Color c, IconGroup g)
 ToggleIcon (IconBar bar, String file)
void pressed (MouseEvent e)
 Overwrite for children!
boolean getState ()
void setState (boolean state)
void unselect ()
void setStateInGroup (boolean state)
int countPeers ()
void unset ()
void dounset (boolean flag)
void set ()
void doset ()
String getDisplay (String name)
void dopaint (Graphics g)
void processKeyEvent (KeyEvent e)
void paint (Graphics g)
 Paint a button with an image.
void showFocus (Graphics g)
void update (Graphics g)
void mousePressed (MouseEvent e)
 User pressed the mouse key over this button.
void mouseReleased (MouseEvent e)
 User released the mouse key again.
void mouseClicked (MouseEvent e)
synchronized void mouseEntered (MouseEvent e)
 Start a thread, that waits for one second, then tells the icon bar to display the proper help text.
void run ()
 A thread to display an icon help.
synchronized void mouseExited (MouseEvent e)
 Tell the run method, that display is no longer necessary, and remove the help text.
int width ()
void setPosition (int x, int y)
Point getPosition ()
void setEnabled (boolean flag)
String getName ()
boolean hasFocus ()
void setFocus (boolean flag)
boolean isSet ()
void unset (boolean flag)

Static Public Attributes

static int Size = 22

Package Attributes

boolean State
Image I
Color C
int W
int H
int X
int Y
IconBar Bar
String Name
boolean Enabled
boolean On
boolean Focus = false
boolean MouseOver
boolean MouseDown
boolean Unset
Thread T
boolean Control

Private Attributes

IconGroup G

Detailed Description

Author:
Rene An action icon for one click.

Definition at line 583 of file IconBar.java.


Constructor & Destructor Documentation

rene.gui.ToggleIcon.ToggleIcon ( IconBar  bar,
String  file,
IconGroup  g 
) [inline]

Definition at line 587 of file IconBar.java.

       {      super(bar,file);
              State=false; G=g;
       }
rene.gui.ToggleIcon.ToggleIcon ( IconBar  bar,
String  file,
Color  c,
IconGroup  g 
) [inline]

Definition at line 592 of file IconBar.java.

       {      super(bar,file,c);
              State=false; G=g;
       }
rene.gui.ToggleIcon.ToggleIcon ( IconBar  bar,
String  file 
) [inline]

Definition at line 597 of file IconBar.java.

       {      this(bar,file,null);
       }

Member Function Documentation

Definition at line 626 of file IconBar.java.

       {      if (G==null) return 0;
              return G.getN();
       }

Here is the call graph for this function:

void rene.gui.IconWithGif.dopaint ( Graphics  g) [inline, inherited]

Reimplemented from rene.gui.BasicIcon.

Definition at line 361 of file IconBar.java.

       {      if (I!=null)
              {      if (W>getSize().width) g.drawImage(I,1,1,Size-2,Size-2,this);
                     else g.drawImage(I,X,Y,this);
              }
              else if (C!=null)
              {      g.setColor(C);
                     g.fillRect(3,3,Size-6,Size-6);
              }
              else
              {      g.setFont(new Font("Courier",Font.BOLD,Size/3));
                     FontMetrics fm=getFontMetrics(getFont());
                     String s=getDisplay(Name);
                     if (s.length()>3) s=s.substring(0,3);
                     int w=fm.stringWidth(s);
                     int h=fm.getHeight();
                     g.setColor(this.getForeground());
                     Graphics2D G=(Graphics2D)g;
                     G.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
                                   RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
                     G.drawString(s,Size/2-w/2,Size/2-h/2+fm.getAscent());
              }
       }

Here is the call graph for this function:

void rene.gui.ToggleIcon.doset ( ) [inline]

Definition at line 642 of file IconBar.java.

       {      super.unset(false);
       }
void rene.gui.ToggleIcon.dounset ( boolean  flag) [inline]

Definition at line 635 of file IconBar.java.

       {      super.unset(flag);
       }

Here is the caller graph for this function:

String rene.gui.IconWithGif.getDisplay ( String  name) [inline, inherited]

Definition at line 349 of file IconBar.java.

       {      if (!name.endsWith(")")) return "";
              int n=name.lastIndexOf('(');
              if (n<0) return "";
              return name.substring(n+1,name.length()-1);
       }

Here is the caller graph for this function:

String rene.gui.BasicIcon.getName ( ) [inline, inherited]

Implements rene.gui.IconBarElement.

Definition at line 277 of file IconBar.java.

       {      return Name;
       }

Here is the caller graph for this function:

Point rene.gui.BasicIcon.getPosition ( ) [inline, inherited]

Implements rene.gui.IconBarElement.

Definition at line 267 of file IconBar.java.

       {      return getLocationOnScreen();
       }

Definition at line 605 of file IconBar.java.

{ return State; }
boolean rene.gui.BasicIcon.hasFocus ( ) [inline, inherited]

Definition at line 281 of file IconBar.java.

{ return Focus; }
boolean rene.gui.BasicIcon.isSet ( ) [inline, inherited]

Definition at line 286 of file IconBar.java.

       {      return !Unset;
       }      

Here is the caller graph for this function:

void rene.gui.BasicIcon.mouseClicked ( MouseEvent  e) [inline, inherited]

Reimplemented in rene.gui.StateDisplay.

Definition at line 189 of file IconBar.java.

{}
synchronized void rene.gui.BasicIcon.mouseEntered ( MouseEvent  e) [inline, inherited]

Start a thread, that waits for one second, then tells the icon bar to display the proper help text.

Definition at line 198 of file IconBar.java.

       {      if (T!=null) return;
              if (Enabled) MouseOver=true;
              repaint();
              if (!Global.getParameter("iconbar.showtips",true)) return;
              Control=e.isControlDown();
              T=new Thread(this);
              T.start();
       }

Here is the call graph for this function:

synchronized void rene.gui.BasicIcon.mouseExited ( MouseEvent  e) [inline, inherited]

Tell the run method, that display is no longer necessary, and remove the help text.

Definition at line 250 of file IconBar.java.

       {      T=null;
              MouseOver=false;
              repaint();
              Bar.removeHelp();
       }

Here is the call graph for this function:

void rene.gui.BasicIcon.mousePressed ( MouseEvent  e) [inline, inherited]

User pressed the mouse key over this button.

Reimplemented in rene.gui.StateDisplay.

Definition at line 149 of file IconBar.java.

       {      if (!Enabled) return;
              MouseDown=true; repaint();
       }
void rene.gui.BasicIcon.mouseReleased ( MouseEvent  e) [inline, inherited]

User released the mouse key again.

Reimplemented in rene.gui.StateDisplay.

Definition at line 157 of file IconBar.java.

       {      if (!Enabled) return;
              MouseDown=false;
              Dimension d=getSize();
              if (e.getX()<0 || e.getX()>d.width ||
                     e.getY()<0 || e.getY()>d.height) 
              {      repaint(); return;
              }
              Unset=false;
              pressed(e); // call method for children to change states etc.
              repaint();
              T=null; // stop icon help thread
              // Notify Iconbar about activation:
              long time=System.currentTimeMillis();
              Bar.iconPressed(Name,e.isShiftDown(),e.isControlDown());
              // Necessary, since Java 1.4 does not report
              // MouseExited, if a modal dialog is active:
              time=System.currentTimeMillis()-time;
              if (MouseOver && time>1000) 
              {      MouseOver=false;
                     repaint();
              }
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void rene.gui.BasicIcon.paint ( Graphics  g) [inline, inherited]

Paint a button with an image.

Reimplemented in rene.gui.StateDisplay.

Definition at line 87 of file IconBar.java.

       {      if (MouseDown)
              {      g.setColor(getBackground());
                     g.fill3DRect(0,0,Size,Size,false);
              }
              else
              {      if (MouseOver)
                     {      if (On)
                            {      Color c=getBackground();
                                   g.setColor(
                                          new SaveColor(c.getRed()-30,c.getGreen()-30,c.getBlue()));
                            }
                            else g.setColor(getBackground());
                            g.fill3DRect(0,0,Size,Size,true);
                     }
                     else
                     {      if (On)
                            {      Color c=getBackground();
                                   g.setColor(c);
                                   g.fillRect(0,0,Size,Size);
                                   g.setColor(
                                          new SaveColor(c.getRed()-100,c.getGreen()-100,c.getBlue()));
                                   g.fillRect(3,3,Size-2,Size-2);
                                   g.setColor(
                                          new SaveColor(c.getRed()-50,c.getGreen()-50,c.getBlue()));
                                   g.fillRect(1,1,Size-2,Size-2);
                            }
                            else
                            {      g.setColor(getBackground());
                                   g.fillRect(0,0,Size,Size);
                            }
                     }
              }
              dopaint(g);   
              if (Unset)
              {      Color c=getBackground();
                     g.setColor(
                            new SaveColor(c.getRed()-100,c.getGreen(),c.getBlue()));
                     g.drawLine(0,0,Size,Size);
              }      
              if (Focus) showFocus(g);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void rene.gui.ToggleIcon.pressed ( MouseEvent  e) [inline]

Overwrite for children!

Parameters:
eMouse event for determining right button etc.

Reimplemented from rene.gui.BasicIcon.

Reimplemented in rene.gui.OnOffIcon.

Definition at line 601 of file IconBar.java.

       {      setState(!On);
       }

Here is the call graph for this function:

void rene.gui.BasicIcon.processKeyEvent ( KeyEvent  e) [inline, inherited]

Definition at line 80 of file IconBar.java.

       {      Bar.getKey(e);
       }

Here is the call graph for this function:

void rene.gui.BasicIcon.run ( ) [inline, inherited]

A thread to display an icon help.

Definition at line 211 of file IconBar.java.

       {      try
              {      Thread.sleep(1000);
              }
              catch (Exception e) {}
              if (T!=null)
              {      synchronized(this)
                     {      try
                            {      Point P=getLocationOnScreen();
                                   String help=Global.name("iconhelp."+Name,"");
                                   if (help.equals("") && Name.length()>1)
                                   {      help=Global.name("iconhelp."+
                                                 Name.substring(0,Name.length()-1)+"?","");
                                   }
                                   if (help.equals(""))
                                          help=Bar.getHelp(Name);
                                   if (help.equals(""))
                                          help=Global.name("iconhelp.nohelp","No help available");
                                   if (Control)
                                   {      String hc=Global.name("iconhelp.control."+Name,"");
                                          if (!hc.equals("")) help=hc;
                                   }
                                   Bar.displayHelp(this,help);
                            }
                            catch (Exception e) {}
                     }
                     try
                     {      Thread.sleep(5000);
                     }
                     catch (Exception e) {}
                     if (T!=null) Bar.removeHelp();
                     T=null;
              }
       }

Here is the call graph for this function:

void rene.gui.ToggleIcon.set ( ) [inline]

Definition at line 638 of file IconBar.java.

       {      if (G!=null) G.unset(false);
              else super.unset(false);
       }      

Here is the call graph for this function:

void rene.gui.BasicIcon.setEnabled ( boolean  flag) [inline, inherited]

Implements rene.gui.IconBarElement.

Definition at line 271 of file IconBar.java.

       {      if (Enabled==flag) return;
              Enabled=flag;
              repaint();
       }

Here is the caller graph for this function:

void rene.gui.BasicIcon.setFocus ( boolean  flag) [inline, inherited]

Definition at line 282 of file IconBar.java.

{ Focus=flag; repaint(); }  

Here is the caller graph for this function:

void rene.gui.BasicIcon.setPosition ( int  x,
int  y 
) [inline, inherited]

Implements rene.gui.IconBarElement.

Definition at line 263 of file IconBar.java.

       {      setLocation(x,y);
       }
void rene.gui.ToggleIcon.setState ( boolean  state) [inline]

Definition at line 607 of file IconBar.java.

       {      if (G!=null) G.toggle(this);
              else
              {      if (On==state) { State=state; return; }
                     On=State=state;
                     repaint();
              }
       }

Here is the call graph for this function:

Here is the caller graph for this function:

void rene.gui.ToggleIcon.setStateInGroup ( boolean  state) [inline]

Definition at line 620 of file IconBar.java.

       {      if (On==state) { State=state; return; }
              On=State=state;
              repaint();
       }

Here is the caller graph for this function:

void rene.gui.BasicIcon.showFocus ( Graphics  g) [inline, inherited]

Definition at line 130 of file IconBar.java.

       {      g.setColor(Color.white);
              g.drawRect(4,4,1,1);
              g.drawRect(Size-5,4,1,1);
              g.drawRect(4,Size-5,1,1);
              g.drawRect(Size-5,Size-5,1,1);
       }

Here is the caller graph for this function:

void rene.gui.ToggleIcon.unselect ( ) [inline]

Definition at line 616 of file IconBar.java.

       {      if (G!=null) G.unselect();
       }

Here is the call graph for this function:

void rene.gui.BasicIcon.unset ( boolean  flag) [inline, inherited]

Definition at line 289 of file IconBar.java.

       {      Unset=flag;
       }

Here is the caller graph for this function:

void rene.gui.ToggleIcon.unset ( ) [inline]

Reimplemented from rene.gui.BasicIcon.

Definition at line 631 of file IconBar.java.

       {      if (G!=null) G.unset(true);
              else super.unset();
       }      

Here is the call graph for this function:

void rene.gui.BasicIcon.update ( Graphics  g) [inline, inherited]

Definition at line 142 of file IconBar.java.

       {      paint(g);
       }

Here is the call graph for this function:

int rene.gui.BasicIcon.width ( ) [inline, inherited]

Implements rene.gui.IconBarElement.

Definition at line 259 of file IconBar.java.

       {      return Size;
       }

Here is the caller graph for this function:


Member Data Documentation

IconBar rene.gui.BasicIcon.Bar [package, inherited]

Definition at line 64 of file IconBar.java.

Color rene.gui.IconWithGif.C [package, inherited]

Definition at line 303 of file IconBar.java.

boolean rene.gui.BasicIcon.Control [package, inherited]

Definition at line 192 of file IconBar.java.

boolean rene.gui.BasicIcon.Enabled [package, inherited]

Definition at line 66 of file IconBar.java.

boolean rene.gui.BasicIcon.Focus = false [package, inherited]

Definition at line 68 of file IconBar.java.

Definition at line 585 of file IconBar.java.

int rene.gui.IconWithGif.H [package, inherited]

Definition at line 304 of file IconBar.java.

Image rene.gui.IconWithGif.I [package, inherited]

Definition at line 302 of file IconBar.java.

boolean rene.gui.BasicIcon.MouseDown [package, inherited]

Definition at line 70 of file IconBar.java.

boolean rene.gui.BasicIcon.MouseOver [package, inherited]

Definition at line 70 of file IconBar.java.

String rene.gui.BasicIcon.Name [package, inherited]

Definition at line 65 of file IconBar.java.

boolean rene.gui.BasicIcon.On [package, inherited]

Definition at line 67 of file IconBar.java.

int rene.gui.BasicIcon.Size = 22 [static, inherited]

Definition at line 69 of file IconBar.java.

Definition at line 584 of file IconBar.java.

Thread rene.gui.BasicIcon.T [package, inherited]

Definition at line 191 of file IconBar.java.

boolean rene.gui.BasicIcon.Unset [package, inherited]

Definition at line 71 of file IconBar.java.

int rene.gui.IconWithGif.W [package, inherited]

Definition at line 304 of file IconBar.java.

int rene.gui.IconWithGif.X [package, inherited]

Definition at line 304 of file IconBar.java.

int rene.gui.IconWithGif.Y [package, inherited]

Definition at line 304 of file IconBar.java.


The documentation for this class was generated from the following file: