Back to index

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

List of all members.

Public Member Functions

 BasicIcon (IconBar bar, String name)
void processKeyEvent (KeyEvent e)
void paint (Graphics g)
 Paint a button with an image.
void showFocus (Graphics g)
void dopaint (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 pressed (MouseEvent e)
 Overwrite for children!
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)
void unset ()

Static Public Attributes

static int Size = 22

Package Attributes

IconBar Bar
String Name
boolean Enabled
boolean On
boolean Focus = false
boolean MouseOver
boolean MouseDown
boolean Unset
Thread T
boolean Control

Detailed Description

Author:
Rene This is the most basic icon, handling mouse presses and display in activated, pressed, unset or disabled state.

Definition at line 62 of file IconBar.java.


Constructor & Destructor Documentation

rene.gui.BasicIcon.BasicIcon ( IconBar  bar,
String  name 
) [inline]

Definition at line 73 of file IconBar.java.

       {      Bar=bar; Name=name; Enabled=true; On=false;
              addMouseListener(this);
              enableEvents(AWTEvent.KEY_EVENT_MASK);
              setSize(Size,Size);
       }

Member Function Documentation

void rene.gui.BasicIcon.dopaint ( Graphics  g) [inline]

Reimplemented in rene.gui.MultipleStringIcon, rene.gui.ColorIcon, rene.gui.MultipleIcon, and rene.gui.IconWithGif.

Definition at line 138 of file IconBar.java.

       {
       }

Here is the caller graph for this function:

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

Implements rene.gui.IconBarElement.

Definition at line 277 of file IconBar.java.

       {      return Name;
       }

Here is the caller graph for this function:

Implements rene.gui.IconBarElement.

Definition at line 267 of file IconBar.java.

       {      return getLocationOnScreen();
       }

Definition at line 281 of file IconBar.java.

{ return Focus; }

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]

Reimplemented in rene.gui.StateDisplay.

Definition at line 189 of file IconBar.java.

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

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]

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]

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]

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]

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.BasicIcon.pressed ( MouseEvent  e) [inline]

Overwrite for children!

Parameters:
eMouse event for determining right button etc.

Reimplemented in rene.gui.OnOffIcon, rene.gui.ToggleIcon, and rene.gui.MultipleIcon.

Definition at line 185 of file IconBar.java.

       {
       }

Here is the caller graph for this function:

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

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]

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.BasicIcon.setEnabled ( boolean  flag) [inline]

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]

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]

Implements rene.gui.IconBarElement.

Definition at line 263 of file IconBar.java.

       {      setLocation(x,y);
       }
void rene.gui.BasicIcon.showFocus ( Graphics  g) [inline]

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.BasicIcon.unset ( boolean  flag) [inline]

Definition at line 289 of file IconBar.java.

       {      Unset=flag;
       }

Here is the caller graph for this function:

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

Reimplemented in rene.gui.ToggleIcon.

Definition at line 292 of file IconBar.java.

       {      unset(true);
       }

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 142 of file IconBar.java.

       {      paint(g);
       }

Here is the call graph for this function:

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

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

Definition at line 64 of file IconBar.java.

Definition at line 192 of file IconBar.java.

Definition at line 66 of file IconBar.java.

Definition at line 68 of file IconBar.java.

Definition at line 70 of file IconBar.java.

Definition at line 70 of file IconBar.java.

String rene.gui.BasicIcon.Name [package]

Definition at line 65 of file IconBar.java.

Definition at line 67 of file IconBar.java.

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

Definition at line 69 of file IconBar.java.

Thread rene.gui.BasicIcon.T [package]

Definition at line 191 of file IconBar.java.

Definition at line 71 of file IconBar.java.


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