Commit b120c19c authored by claes's avatar claes

Tooltip in brow

parent 22423646
/* /*
* Proview $Id: flow_browapi.cpp,v 1.10 2007-05-11 15:07:21 claes Exp $ * Proview $Id: flow_browapi.cpp,v 1.11 2008-01-24 09:33:47 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#include "flow_conpoint.h" #include "flow_conpoint.h"
#include "flow_annot.h" #include "flow_annot.h"
#include "flow_radiobutton.h" #include "flow_radiobutton.h"
#include "flow_tiptext.h"
#include "flow_draw.h" #include "flow_draw.h"
#include "flow_browapi.h" #include "flow_browapi.h"
...@@ -755,3 +756,8 @@ void brow_SetFillColor( brow_tNode node, flow_eDrawType color) ...@@ -755,3 +756,8 @@ void brow_SetFillColor( brow_tNode node, flow_eDrawType color)
{ {
((FlowNode *)node)->set_fillcolor( color); ((FlowNode *)node)->set_fillcolor( color);
} }
void brow_SetTipText( brow_tCtx ctx, brow_tObject object, char *text, int x, int y)
{
ctx->tiptext->draw_text( (FlowArrayElem *)object, text, x, y);
}
/* /*
* Proview $Id: flow_browapi.h,v 1.10 2007-05-11 15:07:21 claes Exp $ * Proview $Id: flow_browapi.h,v 1.11 2008-01-24 09:33:47 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB. * Copyright (C) 2005 SSAB Oxelsund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -236,6 +236,7 @@ void brow_SetInputFocus( brow_tCtx ctx); ...@@ -236,6 +236,7 @@ void brow_SetInputFocus( brow_tCtx ctx);
void brow_SetClickSensitivity( brow_tCtx ctx, int value); void brow_SetClickSensitivity( brow_tCtx ctx, int value);
void brow_SetWhiteBackground( brow_tCtx ctx); void brow_SetWhiteBackground( brow_tCtx ctx);
void brow_SetFillColor( brow_tNode node, flow_eDrawType color); void brow_SetFillColor( brow_tNode node, flow_eDrawType color);
void brow_SetTipText( brow_tCtx ctx, brow_tObject object, char *text, int x, int y);
#if defined __cplusplus #if defined __cplusplus
} }
......
/* /*
* Proview $Id: flow_tiptext.h,v 1.1 2008-01-18 13:55:06 claes Exp $ * Proview $Id: flow_tiptext.h,v 1.2 2008-01-24 09:33:47 claes Exp $
* Copyright (C) 2005 SSAB Oxelösund AB. * Copyright (C) 2005 SSAB Oxelösund AB.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -17,22 +17,20 @@ ...@@ -17,22 +17,20 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/ **/
#ifndef flow_tiptext_h #ifndef glow_tiptext_h
#define flow_tiptext_h #define glow_tiptext_h
#include <iostream.h> #include <iostream.h>
#include <fstream.h> #include <fstream.h>
#include "flow.h" #include "glow.h"
#define TIPTEXT_ROWS 3 class GrowCtx;
class GlowArrayElem;
class FlowCtx; /*! \file glow_tiptext.h
class FlowArrayElem; \brief Contains the GlowTipText class. */
/*! \addtogroup Glow */
/*! \file flow_tiptext.h
\brief Contains the FlowTipText class. */
/*! \addtogroup Flow */
/*@{*/ /*@{*/
...@@ -43,29 +41,28 @@ class FlowArrayElem; ...@@ -43,29 +41,28 @@ class FlowArrayElem;
The text is visible until the remove_text() or remove() function are called. The text is visible until the remove_text() or remove() function are called.
*/ */
class FlowTipText { class GlowTipText {
public: public:
//! Constructor //! Constructor
/*! /*!
\param gctx Flow context. \param gctx Glow context.
*/ */
FlowTipText( FlowCtx *gctx) : ctx(gctx), tiptext_rows(0), active(false), timer_id(0) {} GlowTipText( GrowCtx *gctx) : ctx(gctx), active(false), timer_id(0) {}
//! Destructor //! Destructor
/*! Removes the timer if it is set. /*! Removes the timer if it is set.
*/ */
~FlowTipText(); ~GlowTipText();
FlowCtx *ctx; //!< Flow context. GrowCtx *ctx; //!< Glow context.
int text_x; //!< x coordinate in pixels for text. int text_x; //!< x coordinate in pixels for text.
int text_y; //!< y coordinate in pixels for text. int text_y; //!< y coordinate in pixels for text.
int text_width; //!< Text width in pixels. int text_width; //!< Text width in pixels.
int text_height; //!< Text height in pixels. int text_height; //!< Text height in pixels.
int text_descent; //!< Text descent in pixels. int text_descent; //!< Text descent in pixels.
FlowArrayElem *text_object; //!< Object that activated the current tip text. GlowArrayElem *text_object; //!< Object that activated the current tip text.
int tiptext_rows; //!< Number of rows in current tiptext. char tiptext[200]; //!< Current tip text.
char tiptext[TIPTEXT_ROWS][512]; //!< Current tip text.
bool active; //!< Tip text is active, i.e. timer is running or text is displayed. bool active; //!< Tip text is active, i.e. timer is running or text is displayed.
void *timer_id; //!< Timer id. void *timer_id; //!< Timer id.
...@@ -80,13 +77,13 @@ class FlowTipText { ...@@ -80,13 +77,13 @@ class FlowTipText {
no remove function is called, the text will be displayed within 1 second, and remain until no remove function is called, the text will be displayed within 1 second, and remain until
a remove function is called. a remove function is called.
*/ */
void draw_text( FlowArrayElem *e, char *text, int x, int y); void draw_text( GlowArrayElem *e, char *text, int x, int y);
//! Remove or inactivate the text for the specified object. //! Remove or inactivate the text for the specified object.
/*! /*!
\param e Object which the text should be removed for. \param e Object which the text should be removed for.
*/ */
void remove_text( FlowArrayElem *e); void remove_text( GlowArrayElem *e);
//! Remove or inactivate texts for any object. //! Remove or inactivate texts for any object.
/*! If the timer is running, it is stopped. If the text is diplayed, it is erased. /*! If the timer is running, it is stopped. If the text is diplayed, it is erased.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment