"Fossies" - the Fresh Open Source Software Archive

Member "audacious-plugins-3.10.1/src/skins/textbox.h" (26 Dec 2018, 2421 Bytes) of package /linux/misc/audacious-plugins-3.10.1.tar.bz2:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "textbox.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2  * Audacious - a cross-platform multimedia player
    3  * Copyright (c) 2007 Tomasz Moń
    4  * Copyright (c) 2011 John Lindgren
    5  *
    6  * Based on:
    7  * BMP - Cross-platform multimedia player
    8  * Copyright (C) 2003-2004  BMP development team.
    9  * XMMS:
   10  * Copyright (C) 1998-2003  XMMS development team.
   11  *
   12  * This program is free software; you can redistribute it and/or modify
   13  * it under the terms of the GNU General Public License as published by
   14  * the Free Software Foundation; under version 3 of the License.
   15  *
   16  * This program is distributed in the hope that it will be useful,
   17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
   18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   19  * GNU General Public License for more details.
   20  *
   21  * You should have received a copy of the GNU General Public License
   22  * along with this program.  If not, see <http://www.gnu.org/licenses>.
   23  *
   24  * The Audacious team does not consider modular code linking to
   25  * Audacious or using our public API to be a derived work.
   26  */
   27 
   28 #ifndef SKINS_UI_SKINNED_TEXTBOX_H
   29 #define SKINS_UI_SKINNED_TEXTBOX_H
   30 
   31 #include <libaudcore/hook.h>
   32 #include <libaudcore/objects.h>
   33 
   34 #include "widget.h"
   35 
   36 typedef SmartPtr<cairo_surface_t, cairo_surface_destroy> CairoSurfacePtr;
   37 typedef SmartPtr<PangoFontDescription, pango_font_description_free> PangoFontDescPtr;
   38 
   39 class TextBox : public Widget
   40 {
   41 public:
   42     TextBox (int width, const char * font, bool scroll);
   43     ~TextBox ();
   44 
   45     void set_width (int width);
   46     const String & get_text () { return m_text; }
   47     void set_text (const char * text);
   48     void set_font (const char * font);
   49     void set_scroll (bool scroll);
   50 
   51     typedef bool (* PressCB) (GdkEventButton *);
   52     void on_press (PressCB callback) { press = callback; }
   53 
   54     static void update_all ();
   55 
   56 private:
   57     virtual void draw (cairo_t * cr);
   58     virtual bool button_press (GdkEventButton * event);
   59 
   60     void scroll_timeout ();
   61     void render_vector (const char * text);
   62     void render_bitmap (const char * text);
   63     void render ();
   64 
   65     const Timer<TextBox>
   66      scroll_timer {TimerRate::Hz30, this, & TextBox::scroll_timeout};
   67 
   68     String m_text;
   69     PangoFontDescPtr m_font;
   70     CairoSurfacePtr m_buf;
   71 
   72     int m_width = 0, m_buf_width = 0;
   73     bool m_may_scroll = false, m_two_way = false;
   74     bool m_scrolling = false, m_backward = false;
   75     int m_offset = 0, m_delay = 0;
   76 
   77     PressCB press = nullptr;
   78 };
   79 
   80 #endif