File: categorylabel.cpp

package info (click to toggle)
kascade 1.0-beta10-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 964 kB
  • ctags: 815
  • sloc: cpp: 7,780; makefile: 39
file content (52 lines) | stat: -rw-r--r-- 1,076 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include <qlabel.h>
#include <qwidget.h>
#include <qevent.h>
#include <qmainwindow.h>
#include <stdio.h>
#include <qstatusbar.h>
#include <iostream>

#include "category.h"
#include "categorylabel.h"
#include "globals.h"
#include "browser.h"
#include "utility.h"

CategoryLabel::CategoryLabel( QWidget *parent, Category *category, string memory = "" ) : QLabel( parent )
{
	this->category = category;
	this->memory = memory;

//	int i;
//	if( ( i = text().find( ";" ) ) != -1 )
//		printf( "bledder\n" );
	
//	if( category )
//		cout << category->title << endl;

	extension = FALSE;

	setMouseTracking( TRUE );

	show();
}

void CategoryLabel::mousePressEvent( QMouseEvent *event )
{
	if( event->button() == LeftButton ) 
	{
		if( !category )
		{
			emit LeftMouseButtonClicked( memory );
			emit LeftMouseButtonClicked( (const char *)text(), memory ); 
		}	
		else
			emit LeftMouseButtonClicked( category );
	}	

	else if( extension )
		emit rightMenuExtension( event->globalX(), event->globalY(), category );
	else
		emit rightMenu( event->globalX(), event->globalY() );
}