~ubuntu-branches/ubuntu/utopic/java-gnome/utopic

« back to all changes in this revision

Viewing changes to src/bindings/org/gnome/gtk/Tooltip.java

  • Committer: Package Import Robot
  • Author(s): Guillaume Mazoyer
  • Date: 2014-05-19 17:39:50 UTC
  • mfrom: (10.2.5 sid)
  • Revision ID: package-import@ubuntu.com-20140519173950-83fho9yg0xqijcfu
Tags: 4.1.3-1
* New upstream release.
* debian/control
  - Remove libunique dependency.
  - Remove DM-Upload-Allowed field.
  - Add dbus-x11 dependency to take doc screenshots.
  - Update Standards-Version to 3.9.4.
* debian/README.Maintainer
  - Add instructions for maintainers.
* debian/libjava-gnome-java.docs
  - Update documentation filenames.
* debian/libjava-gnome-java-doc.install
  - Fix HACKING file installation.
* debian/patches/02_unique_dependency.diff
  - Remove no longer needed patch (fixed upstream).
* debian/patches/02_build_python.diff
  - Add patch to fix build process (python2 env variable not found).
* debian/patches/03_build_doc_snapshots.diff (Closes: #748565)
  - Add patch to fix build process of the documentation (accessibilty bug).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * java-gnome, a UI library for writing GTK and GNOME programs from Java!
3
3
 *
4
 
 * Copyright © 2008-2011 Operational Dynamics Consulting, Pty Ltd and Others
 
4
 * Copyright © 2008-2013 Operational Dynamics Consulting, Pty Ltd and Others
5
5
 *
6
6
 * The code in this file, and the program it is a part of, is made available
7
7
 * to you by its authors as open source software: you can redistribute it
32
32
 */
33
33
package org.gnome.gtk;
34
34
 
 
35
import org.gnome.gdk.Pixbuf;
35
36
import org.gnome.glib.Object;
36
37
 
37
38
/**
38
 
 * FIXME
39
 
 * 
40
 
 * @author Thomas Schmitz
41
 
 * @author Vreixo Formoso
42
 
 */
43
 
/*
44
 
 * FIXME this is a placeholder stub for what will become the public API for
45
 
 * this type. Replace this comment with appropriate javadoc including author
46
 
 * and since tags. Note that the class may need to be made abstract, implement
47
 
 * interfaces, or even have its parent changed. No API stability guarantees
48
 
 * are made about this class until it has been reviewed by a hacker and this
49
 
 * comment has been replaced.
 
39
 * Displaying a tooltip when a user hovers the mouse over the widget or when
 
40
 * the widget receives notification the cursor is at it when in keyboard mode.
 
41
 * 
 
42
 * <p>
 
43
 * By default you can set text to show as a tooltip by using
 
44
 * {@link Widget#setTooltipText(java.lang.String) } and
 
45
 * {@link Widget#setTooltipMarkup(java.lang.String) } . However that is for
 
46
 * basic text and only text. If you want more then that you can hookup your
 
47
 * own tooltip query handler which in turn will provide an object of this
 
48
 * class for you to use.
 
49
 * 
 
50
 * <p>
 
51
 * In order to get an object of this class you first have to connect a
 
52
 * queryTooltip Handler.
 
53
 * 
 
54
 * <pre>
 
55
 * // any widget will do
 
56
 * widget = new Button();
 
57
 * widget.connect(new Widget.queryTooltip() {
 
58
 *     &#064;Override
 
59
 *     public boolean onQueryTooltip(Widget source, int x, int y, boolean keyboardMode, Tooltip tooltip) {
 
60
 *         // setup your tooltip.
 
61
 *     }
 
62
 * });
 
63
 * </pre>
 
64
 * 
 
65
 * <p>
 
66
 * Inside the method you can create your tooltip. You also receive the X and Y
 
67
 * values at which you can determine whether to show the tooltip or not. Which
 
68
 * is needed for example a TreeView which has a method to help you with. See
 
69
 * {@link TreeView#hasTooltipContext(int, int, boolean) } for more information
 
70
 * on how a TreeView handles tooltips.
 
71
 * 
 
72
 * <p>
 
73
 * KeyboardMode indicates that the application is run by only the keyboard and
 
74
 * no mouse.
 
75
 * 
 
76
 * <p>
 
77
 * When you want to show your tooltip return true, otherwise false.
 
78
 * 
 
79
 * <p>
 
80
 * There are two modes of displaying your tooltip contents. The first is the
 
81
 * basic Icon and String. You can set this up in anyway you want. Please do
 
82
 * note that both are on the same line and that the icon will always be on the
 
83
 * left.
 
84
 * 
 
85
 * <p>
 
86
 * If you want something more fancy or display more information you set any
 
87
 * widget to show. Suggested is a container of course. Where you have full
 
88
 * freedom to place all your tooltip contents.
 
89
 * 
 
90
 * @author Sarah Leibbrand
 
91
 * @since 4.1.3
50
92
 */
51
93
public class Tooltip extends Object
52
94
{
53
95
    protected Tooltip(long pointer) {
54
96
        super(pointer);
55
97
    }
 
98
 
 
99
    /**
 
100
     * The text to display in the tooltip.
 
101
     * 
 
102
     * @since 4.1.3
 
103
     */
 
104
    public void setText(String text) {
 
105
        GtkTooltip.setText(this, text);
 
106
    }
 
107
 
 
108
    /**
 
109
     * The text in pango markup to display in the tooltip.
 
110
     * 
 
111
     * @since 4.1.3
 
112
     */
 
113
    public void setMarkup(String markup) {
 
114
        GtkTooltip.setMarkup(this, markup);
 
115
    }
 
116
 
 
117
    /**
 
118
     * The icon to display in your tooltip.
 
119
     * 
 
120
     * @since 4.1.3
 
121
     */
 
122
    public void setIcon(Pixbuf icon) {
 
123
        GtkTooltip.setIcon(this, icon);
 
124
    }
 
125
 
 
126
    /**
 
127
     * The stock icon with the requested size to display in the tooltip.
 
128
     * 
 
129
     * @since 4.1.3
 
130
     */
 
131
    public void setStockIcon(Stock stock, IconSize size) {
 
132
        GtkTooltip.setIcon(this, stock.getStockId(), size);
 
133
    }
 
134
 
 
135
    /**
 
136
     * The widget to display in the tooltip.
 
137
     * 
 
138
     * This can be any widget but containers such as {@link Grid} are
 
139
     * recommended.
 
140
     * 
 
141
     * @since 4.1.3
 
142
     */
 
143
    public void setCustomWidget(Widget widget) {
 
144
        GtkTooltip.setCustom(this, widget);
 
145
    }
56
146
}