File: classBrowseFrame.cpp

package info (click to toggle)
unixodbc 2.2.11-13
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 17,292 kB
  • ctags: 12,410
  • sloc: ansic: 116,624; cpp: 29,333; sh: 16,966; makefile: 2,961; lex: 241; yacc: 182; perl: 141; sed: 16; sql: 1
file content (97 lines) | stat: -rw-r--r-- 2,875 bytes parent folder | download | duplicates (4)
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/**************************************************
 *
 *
 **************************************************
 * This code was created by Peter Harvey @ CodeByDesign.
 * Released under GPL 30.NOV.00
 *
 * Contributions from...
 * -----------------------------------------------
 * Peter Harvey		- pharvey@codebydesign.com
 **************************************************/
#include "classBrowseFrame.h"

#include "run.xpm"
#include "new.xpm"
#include "open.xpm"
#include "save.xpm"

classBrowseFrame::classBrowseFrame( SQLHDBC hDbc, QString qsTable, QWidget *parent, const char *name )
	: QMainWindow( parent, name, 0 )
{
    QString         qsCaption;

    this->hDbc	 	= hDbc;
    this->qsTable	= qsTable;
    qsCaption.sprintf( "Browse %s", (const char *)qsTable );
    setCaption( qsCaption );
    
    // CLIENT AREA
    browse = new classBrowse( hDbc, qsTable, this ); 
    setCentralWidget( browse );

    // SETUP MAIN MENU
    menubarMain = new QMenuBar( this );
    menubarMain->setFrameStyle( QFrame::NoFrame );

    QPopupMenu *pFile = new QPopupMenu();
    pFile->insertItem( QPixmap( new_xpm ), tr("Clear"),  this, SLOT(Clear()) );
    pFile->insertItem( QPixmap( save_xpm ), tr("&Save"), this, SLOT(Save()), CTRL+Key_S );
    pFile->insertItem( tr("Save &As"), this, SLOT(SaveAs()), CTRL+Key_A );
    menubarMain->insertItem( tr("&File"), pFile );
    
    QPopupMenu *pEdit = new QPopupMenu();
    pEdit->insertItem( tr("Se&lect All Columns"),  browse, SLOT(SelectAllColumns()) );
    pEdit->insertItem( tr("&Unselect All Columns"),  browse, SLOT(UnSelectAllColumns()) );
    menubarMain->insertItem( tr("&Edit"), pEdit );
    
    menubarMain->setSeparator( QMenuBar::InWindowsStyle );

    // SETUP TOOLBAR
    toolbarMain = new QToolBar( this );
    addToolBar( toolbarMain, tr( "ToolBar" ), Top, FALSE );

    QToolButton *toolbutton = new QToolButton( QPixmap( new_xpm ), QString(tr("Clear")), QString(""), this, SLOT(Clear()), toolbarMain );
    toolbutton = new QToolButton( QPixmap( save_xpm ), QString(tr("Save")), QString(""), this, SLOT(Save()), toolbarMain );
    toolbutton = new QToolButton( QPixmap( run_xpm ), QString(tr("Run")), QString(""), this, SLOT(Exec()), toolbarMain );
    QWhatsThis::whatsThisButton ( toolbarMain );

    // RESIZE
	connect( parent, SIGNAL(changedSize(int,int)), SLOT(resize(int,int)) );
	resize( parent->size() );
	setMinimumSize( 50, 50 );
	setMaximumSize( 32767, 32767 );
}


classBrowseFrame::~classBrowseFrame()
{
}

void classBrowseFrame::resizeEvent( QResizeEvent *p )
{
    resize( p->size() );
}


void classBrowseFrame::Clear()         // CLEAR QUERY AND DATA
{
    browse->Clear();
}

void classBrowseFrame::Save()        // DATA
{
    browse->Save();
}

void classBrowseFrame::SaveAs()      // DATA
{
    browse->SaveAs();
}

void classBrowseFrame::Exec()        // RUN QUERY
{
    browse->Exec();
}