TooltipFrame::TooltipFrame(QWidget *parent)
  : QFrame(parent)
{
  setupUi(this);

  if(tooltips.size() == 0)
  {
    tooltips
        << tr("Press Ctrl+Espace in the query editor to display the completer.")
        << tr("While a query is executed, you can edit an another one.")
        << tr("You can export a table or a query's content in a CSV file by right-clicking on the spreadsheet.")
        << tr("While it is connected, a database cannot be edited.");
  }

  srand(time(NULL));

  currentIndex = -1;
  showTooltip();

//  t.setInterval(30000);
//  t.setSingleShot(false);
//  t.start();
//  connect(&t, SIGNAL(timeout()), this, SLOT(showTooltip()));

  connect(nextButton, SIGNAL(clicked()), this, SLOT(showTooltip()));

  // theme icons
  nextButton->setIcon(IconManager::get("go-next"));
  label_2->setPixmap(IconManager::get("help-faq").pixmap(32, 32));
}
Exemple #2
0
//------------------------------------------------------------------------
CMessageResult CTooltipSupport::notify (CBaseObject* sender, const char* msg)
{
	if (msg == CVSTGUITimer::kMsgTimer)
	{
		if (state == kHiding)
		{
			hideTooltip ();
			timer->stop ();
			timer->setFireTime (delay);
		}
		else if (state == kShowing)
		{
			showTooltip ();
			timer->setFireTime (100);
		}
		else if (state == kForceVisible)
		{
			state = kVisible;
			timer->stop ();
			timer->setFireTime (delay);
		}
		return kMessageNotified;
	}
	return kMessageUnknown;
}
Exemple #3
0
void Placeable::highlight(bool enabled) {
	if (_model)
		_model->drawBound(enabled);

	if (enabled)
		showTooltip();
	else
		hideTooltip();
}
DefaultMapping::DefaultMapping(QtOpenGLWindow * window)
: AbstractQtMapping(window)
, m_metaInformationCapability(nullptr)
, m_viewportCapability(nullptr)
, m_typedRenderTargetCapability(nullptr)
, m_timer(new QTimer(this))
{
    m_timer->setInterval(g_tooltipTimeout);
    m_timer->setSingleShot(true);
    m_timer->stop();

    connect(m_timer, SIGNAL(timeout()), this, SLOT(showTooltip()));
}
Exemple #5
0
void System::tick(float delta)
{
    m_inTick = true;
    std::vector<WindowBase*>::iterator i = m_tickedWnd.begin();
    std::vector<WindowBase*>::iterator end = m_tickedWnd.end();
    std::vector<WindowBase*>::size_type subscribeTickWndSize = m_subscribeTickWnd.size();
    while(i != end)
    {
        WindowBase* wnd = (*i);
        if(wnd)
            wnd->onTick(delta);
        ++i;
    }
    if(m_tickClear)
    {
        m_tickedWnd.erase(std::remove_if(m_tickedWnd.begin(), end, tickClear()), end);
        m_tickClear = false;
    }

    if(subscribeTickWndSize)
    {
        std::vector<WindowBase*>::size_type tickedWndSize = m_tickedWnd.size();
        m_tickedWnd.resize(tickedWndSize + subscribeTickWndSize);
        std::copy(m_subscribeTickWnd.begin(), m_subscribeTickWnd.end(), m_tickedWnd.begin() + tickedWndSize);
        m_subscribeTickWnd.clear();
    }

    if(m_activateTooltip)
    {
        m_tttime += delta;
        if(m_tttime >= m_ttdelay)
        {
            m_tttime = 0.f;
            m_activateTooltip = false;

            showTooltip(m_containsMouse);
        }
    }

    if(m_tooltipWindow->getVisible() && m_ttlifetime > 1.f)
    {
        m_tttime += delta;
        if(m_tttime >= m_ttlifetime)
        {
            hideTooltip(m_containsMouse);
        }
    }

    m_inTick = false;
}
Exemple #6
0
	bool MarkupText::onMouseMove(void)
	{
		m_pt = transformToWndCoord(m_system.getCursor().getPosition());
		m_pt -= m_area.getPosition();

		bool linkhit = false;
		if(m_selectedlnk)
		{	
			linkhit = isHitChunk<LinkArea>(m_selectedlnk.get(), m_pt);
			if(!linkhit)
			{
				setHovered(m_selectedlnk.get(), false);
				m_selectedlnk.reset();
				invalidate();
			}
		}

		if(!m_selectedlnk)
		{
			std::vector<PLinkArea>::iterator ilink = std::find_if(m_links.begin(), m_links.end(), hovertester<LinkArea>(m_pt, *this));
			if(ilink != m_links.end())
			{
				m_selectedlnk = (*ilink);
				setHovered(m_selectedlnk.get(), true);
				invalidate();
			}
		}

		if(m_selectedtt)
		{	
			bool hit = isHitChunk<TooltipArea>(m_selectedtt.get(), m_pt);
			if(hit)
				return true;
			else
			{
				hideTooltip();
			}
		}

		std::vector<PTooltipArea>::iterator itt = std::find_if(m_tooltips.begin(), m_tooltips.end(), hovertester<TooltipArea>(m_pt, *this));
		if(itt != m_tooltips.end())
		{
			showTooltip(*itt);
		}

		return MarkupBase::onMouseMove();
	}
Exemple #7
0
static void drawBrushSlider(Sprite* sprite, s32 x, s32 y)
{
	enum {Count = 4, Size = 5};

	tic_rect rect = {x, y, Size, (Size+1)*Count};

	bool over = false;
	if(checkMousePos(&rect))
	{
		setCursor(tic_cursor_hand);

		showTooltip("BRUSH SIZE");
		over = true;

		if(checkMouseDown(&rect, tic_mouse_left))
		{
			s32 my = getMouseY() - y;

			sprite->brushSize = Count - my / (Size+1);
		}
	}

	sprite->tic->api.rect(sprite->tic, x+1, y, Size-2, Size*Count, (tic_color_black));

	for(s32 i = 0; i < Count; i++)
	{
		s32 offset = y + i*(Size+1);

		sprite->tic->api.rect(sprite->tic, x, offset, Size, Size, (tic_color_black));
		sprite->tic->api.rect(sprite->tic, x + 6, offset + 2, Count - i, 1, (tic_color_black));
	}

	sprite->tic->api.rect(sprite->tic, x+2, y+1, 1, Size*Count+1, (over ? tic_color_white : tic_color_gray));

	s32 offset = y + (Count - sprite->brushSize)*(Size+1);
	sprite->tic->api.rect(sprite->tic, x, offset, Size, Size, (tic_color_black));
	sprite->tic->api.rect(sprite->tic, x+1, offset+1, Size-2, Size-2, (over ? tic_color_white : tic_color_gray));
}
Exemple #8
0
void CList::CListItem::clickRight(tribool down, bool previousState)
{
    if (down == true)
        showTooltip();
}
Exemple #9
0
static void drawPalette(Sprite* sprite, s32 x, s32 y)
{
	tic_rect rect = {x, y, PALETTE_WIDTH-1, PALETTE_HEIGHT-1};

	if(checkMousePos(&rect))
	{
		setCursor(tic_cursor_hand);

		bool left = checkMouseDown(&rect, tic_mouse_left);
		bool right = checkMouseDown(&rect, tic_mouse_right);

		if(left || right)
		{
			s32 mx = getMouseX() - x;
			s32 my = getMouseY() - y;

			mx /= PALETTE_CELL_SIZE;
			my /= PALETTE_CELL_SIZE;

			s32 index = mx + my * PALETTE_COLS;

			if(left) sprite->color = index;
			if(right) sprite->color2 = index;
		}
	}

	sprite->tic->api.rect(sprite->tic, rect.x-1, rect.y-1, rect.w+2, rect.h+2, (tic_color_white));
	sprite->tic->api.rect(sprite->tic, rect.x-1, rect.y+rect.h+1, PALETTE_WIDTH+1, 1, (tic_color_black));

	{
		s32 offsetX = x + (sprite->color % PALETTE_COLS) * PALETTE_CELL_SIZE;
		s32 offsetY = y + (sprite->color / PALETTE_COLS) * PALETTE_CELL_SIZE;

		if(offsetY > y)
			sprite->tic->api.rect(sprite->tic, offsetX - 2, rect.y + rect.h+2, PALETTE_CELL_SIZE+3, 1, (tic_color_black));		
	}

	{
		static const u8 Icon[] = 
		{
			0b01000000,
			0b11111111,
			0b00000000,
			0b00000010,
			0b11111111,
			0b00000000,
			0b00010000,
			0b11111111,
		};

		tic_rect rect = {x + PALETTE_WIDTH + 3, y + (PALETTE_HEIGHT-8)/2-1, 8, 8};

		bool down = false;
		bool over = false;
		if(checkMousePos(&rect))
		{
			setCursor(tic_cursor_hand);
			over = true;

			showTooltip("EDIT PALETTE");

			if(checkMouseDown(&rect, tic_mouse_left))
				down = true;

			if(checkMouseClick(&rect, tic_mouse_left))
				sprite->editPalette = !sprite->editPalette;
		}

		if(sprite->editPalette || down)
		{
			drawBitIcon(rect.x, rect.y+1, Icon, (over ? tic_color_light_blue : tic_color_white));
		}
		else
		{
			drawBitIcon(rect.x, rect.y+1, Icon, (tic_color_black));
			drawBitIcon(rect.x, rect.y, Icon, (over ? tic_color_light_blue : tic_color_white));			
		}
	}
}
Exemple #10
0
static void drawRGBTools(Sprite* sprite, s32 x, s32 y)
{
	{
		enum{Size = 5};
		static const u8 Icon[] = 
		{
			0b11110000,
			0b10010000,
			0b10111000,
			0b11101000,
			0b00111000,
			0b00000000,
			0b00000000,
			0b00000000,	
		};

		tic_rect rect = {x, y, Size, Size};

		bool over = false;
				bool down = false;

		if(checkMousePos(&rect))
		{
			setCursor(tic_cursor_hand);

			showTooltip("COPY PALETTE");
			over = true;

			if(checkMouseDown(&rect, tic_mouse_left))
				down = true;

			if(checkMouseClick(&rect, tic_mouse_left))
				toClipboard(getBankPalette()->data, sizeof(tic_palette), false);
		}

		if(down)
		{
			drawBitIcon(rect.x, rect.y+1, Icon, (tic_color_light_blue));
		}
		else
		{
			drawBitIcon(rect.x, rect.y+1, Icon, (tic_color_black));
			drawBitIcon(rect.x, rect.y, Icon, (over ? tic_color_light_blue : tic_color_white));
		}
	}

	{
		enum{Size = 5};
		static const u8 Icon[] = 
		{
			0b01110000,
			0b10001000,
			0b11111000,
			0b11011000,
			0b11111000,
			0b00000000,
			0b00000000,
			0b00000000,
		};

		tic_rect rect = {x + 8, y, Size, Size};
		bool over = false;
		bool down = false;

		if(checkMousePos(&rect))
		{
			setCursor(tic_cursor_hand);

			showTooltip("PASTE PALETTE");
			over = true;

			if(checkMouseDown(&rect, tic_mouse_left))
				down = true;

			if(checkMouseClick(&rect, tic_mouse_left))
			{
				pasteColor(sprite);
			}
		}

		if(down)
		{
			drawBitIcon(rect.x, rect.y+1, Icon, (tic_color_light_blue));
		}
		else
		{
			drawBitIcon(rect.x, rect.y+1, Icon, (tic_color_black));
			drawBitIcon(rect.x, rect.y, Icon, (over ? tic_color_light_blue : tic_color_white));
		}
	}
}
Exemple #11
0
static void drawSpriteToolbar(Sprite* sprite)
{
	tic_mem* tic = sprite->tic;
	sprite->tic->api.rect(sprite->tic, 0, 0, TIC80_WIDTH, TOOLBAR_SIZE, (tic_color_white));

	// draw sprite size control
	{
		tic_rect rect = {TIC80_WIDTH - 58, 1, 23, 5};

		if(checkMousePos(&rect))
		{
			setCursor(tic_cursor_hand);

			showTooltip("CANVAS ZOOM");

			if(checkMouseDown(&rect, tic_mouse_left))
			{
				s32 mx = getMouseX() - rect.x;
				mx /= 6;

				s32 size = 1;
				while(mx--) size <<= 1;

				updateSpriteSize(sprite, size * TIC_SPRITESIZE);
			}
		}

		for(s32 i = 0; i < 4; i++)
			sprite->tic->api.rect(sprite->tic, rect.x + i*6, 1, 5, 5, (tic_color_black));

		sprite->tic->api.rect(sprite->tic, rect.x, 2, 23, 3, (tic_color_black));
		sprite->tic->api.rect(sprite->tic, rect.x+1, 3, 21, 1, (tic_color_white));

		s32 size = sprite->size / TIC_SPRITESIZE, val = 0;
		while(size >>= 1) val++;

		sprite->tic->api.rect(sprite->tic, rect.x + val*6, 1, 5, 5, (tic_color_black));
		sprite->tic->api.rect(sprite->tic, rect.x+1 + val*6, 2, 3, 3, (tic_color_white));
	}

	bool bg = sprite->index < TIC_BANK_SPRITES;

	{
		static const char Label[] = "BG";
		tic_rect rect = {TIC80_WIDTH - 2 * tic->font.width - 2, 0, 2 * tic->font.width + 1, TIC_SPRITESIZE-1};
		sprite->tic->api.rect(sprite->tic, rect.x, rect.y, rect.w, rect.h, bg ? (tic_color_black) : (tic_color_gray));
		sprite->tic->api.fixed_text(sprite->tic, Label, rect.x+1, rect.y+1, (tic_color_white));

		if(checkMousePos(&rect))
		{
			setCursor(tic_cursor_hand);

			showTooltip("TILES [tab]");

			if(!bg && checkMouseClick(&rect, tic_mouse_left))
			{
				sprite->index -= TIC_BANK_SPRITES;
				clearCanvasSelection(sprite);
			}
		}
	}

	{
		static const char Label[] = "FG";
		tic_rect rect = {TIC80_WIDTH - 4 * tic->font.width - 4, 0, 2 * tic->font.width + 1, TIC_SPRITESIZE-1};
		sprite->tic->api.rect(sprite->tic, rect.x, rect.y, rect.w, rect.h, bg ? (tic_color_gray) : (tic_color_black));
		sprite->tic->api.fixed_text(sprite->tic, Label, rect.x+1, rect.y+1, (tic_color_white));

		if(checkMousePos(&rect))
		{
			setCursor(tic_cursor_hand);

			showTooltip("SPRITES [tab]");

			if(bg && checkMouseClick(&rect, tic_mouse_left))
			{
				sprite->index += TIC_BANK_SPRITES;
				clearCanvasSelection(sprite);
			}
		}
	}
}
Exemple #12
0
static void drawTools(Sprite* sprite, s32 x, s32 y)
{
	static const u8 Icons[] = 
	{
		0b00001000,
		0b00011100,
		0b00111110,
		0b01111100,
		0b10111000,
		0b10010000,
		0b11100000,
		0b00000000,

		0b00111000,
		0b00111000,
		0b01111100,
		0b00101000,
		0b00101000,
		0b00101000,
		0b00010000,
		0b00000000,

		0b10101010,
		0b00000000,
		0b10000010,
		0b00000000,
		0b10000010,
		0b00000000,
		0b10101010,
		0b00000000,

		0b00001000,
		0b00000100,
		0b00000010,
		0b01111111,
		0b10111110,
		0b10011100,
		0b10001000,
		0b00000000,
	};

	enum{Gap = TIC_SPRITESIZE + 3};

	for(s32 i = 0; i < COUNT_OF(Icons)/BITS_IN_BYTE; i++)
	{
		tic_rect rect = {x + i * Gap, y, TIC_SPRITESIZE, TIC_SPRITESIZE};

		bool over = false;
		if(checkMousePos(&rect))
		{
			setCursor(tic_cursor_hand);
			over = true;

			static const char* Tooltips[] = {"BRUSH [1]", "COLOR PICKER [2]", "SELECT [3]", "FILL [4]"};

			showTooltip(Tooltips[i]);

			if(checkMouseClick(&rect, tic_mouse_left))
			{				
				sprite->mode = i;

				clearCanvasSelection(sprite);
			}
		}

		bool pushed = i == sprite->mode;

		if(pushed)
		{
			static const u8 Icon[] = 
			{
				0b01111100,
				0b00111000,
				0b00010000,
				0b00000000,
				0b00000000,
				0b00000000,
				0b00000000,
				0b00000000,
			};

			drawBitIcon(rect.x, y - 4, Icon, (tic_color_black));
			drawBitIcon(rect.x, y - 5, Icon, (tic_color_white));

			drawBitIcon(rect.x, y + 1, Icons + i*BITS_IN_BYTE, (over ? tic_color_light_blue : tic_color_white));
		}
		else
		{
			drawBitIcon(rect.x, y+1, Icons + i*BITS_IN_BYTE, (tic_color_black));
			drawBitIcon(rect.x, y, Icons + i*BITS_IN_BYTE, (over ? tic_color_light_blue : tic_color_white));
		}
	}

	drawSpriteTools(sprite, x + COUNT_OF(Icons)/BITS_IN_BYTE * Gap + 1, y);
}
Exemple #13
0
static void drawSpriteTools(Sprite* sprite, s32 x, s32 y)
{
	static const u8 Icons[] =
	{
		0b11101110,
		0b11010110,
		0b11101110,
		0b11101110,
		0b11101110,
		0b11010110,
		0b11101110,
		0b00000000,

		0b11111110,
		0b11111110,
		0b10111010,
		0b01000100,
		0b10111010,
		0b11111110,
		0b11111110,
		0b00000000,

		0b00111000,
		0b01000100,
		0b10010101,
		0b10001110,
		0b10000100,
		0b01000000,
		0b00111000,
		0b00000000,

		0b00111110,
		0b01111111,
		0b00101010,
		0b00101010,
		0b00101010,
		0b00101010,
		0b00111110,
		0b00000000,
	};
	static const char* Tooltips[] = {"FLIP HORZ [5]", "FLIP VERT [6]", "ROTATE [7]", "ERASE [8]"};

	enum{Gap = TIC_SPRITESIZE + 3};

	for(s32 i = 0; i < COUNT_OF(Icons)/BITS_IN_BYTE; i++)
	{
		bool pushed = false;
		bool over = false;
		
		tic_rect rect = {x + i * Gap, y, TIC_SPRITESIZE, TIC_SPRITESIZE};

		if(checkMousePos(&rect))
		{
			setCursor(tic_cursor_hand);

			over = true;

			showTooltip(Tooltips[i]);

			if(checkMouseDown(&rect, tic_mouse_left)) pushed = true;

			if(checkMouseClick(&rect, tic_mouse_left))
			{		
				if(hasCanvasSelection(sprite))
				{
					CanvasToolsFunc[i](sprite);
				}
				else
				{
					SpriteToolsFunc[i](sprite);
					clearCanvasSelection(sprite);
				}
			}
		}

		if(pushed)
		{
			drawBitIcon(rect.x, y + 1, Icons + i*BITS_IN_BYTE, (over ? tic_color_light_blue : tic_color_white));
		}
		else
		{
			drawBitIcon(rect.x, y+1, Icons + i*BITS_IN_BYTE, (tic_color_black));
			drawBitIcon(rect.x, y, Icons + i*BITS_IN_BYTE, (over ? tic_color_light_blue : tic_color_white));
		}
	}
}