void MCButton::SetStyle(MCExecContext& ctxt, intenum_t p_style)
{
	flags &= ~(F_STYLE | F_DISPLAY_STYLE | F_ALIGNMENT);
	if (entry != NULL)
		deleteentry();

	switch (p_style)
	{
	case kMCButtonStyleStandard:
		flags |= F_STANDARD | F_SHOW_BORDER | F_OPAQUE
				| F_ALIGN_CENTER | F_HILITE_BOTH | F_ARM_BORDER;
		break;
	case kMCButtonStyleMenu:
	case kMCButtonStylePopup:
		flags |= F_MENU | F_SHOW_BORDER | F_OPAQUE | F_ALIGN_CENTER | F_ARM_BORDER;
		if (menumode == WM_COMBO)
			createentry();
		if (menumode == WM_TOP_LEVEL)
		{
			MCValueRelease(tabs);
			/* UNCHECKED */ MCStringSplit(menustring, MCSTR("\n"), nil, kMCStringOptionCompareExact, tabs);
		}
		break;
	case kMCButtonStyleCheck:
		flags |= F_CHECK | F_ALIGN_LEFT;
		break;
	case kMCButtonStyleRadio:
		flags |= F_RADIO | F_ALIGN_LEFT;
		flags &= ~F_SHARED_HILITE;
		break;
	case kMCButtonStyleRoundrect:
		flags |=  F_ROUNDRECT | F_SHOW_BORDER | F_OPAQUE | F_ALIGN_CENTER | F_HILITE_FILL;
		break;
	case kMCButtonStyleRectangle:
		flags |= F_RECTANGLE | F_SHOW_BORDER | F_OPAQUE
		        | F_ALIGN_CENTER | F_HILITE_BOTH | F_ARM_BORDER;
		break;
	case kMCButtonStyleOval:
		flags |= F_OVAL_BUTTON | F_HILITE_FILL;
		break;
	case kMCButtonStyleTransparent:
		flags |= F_STANDARD | F_ALIGN_CENTER;
		break;
	case kMCButtonStyleShadow:
		flags |= F_STANDARD | F_SHOW_BORDER | F_OPAQUE
				| F_SHADOW | F_ALIGN_CENTER | F_HILITE_BOTH | F_ARM_BORDER;
		break;
	case kMCButtonStyleShowBorder:
		flags |= F_STANDARD | F_OPAQUE
		        | F_ALIGN_CENTER | F_HILITE_FILL | F_ARM_BORDER;
		break;
	default:
		break;
	}
	// MW-2011-09-21: [[ Layers ]] Make sure the layerattrs are recomputed.
	m_layer_attr_changed = true;
	Redraw();
}
Exemple #2
0
void main(int argc, char * argv[]) {
  int channel, rcvid, returncode;

  if(open("/sys/addressbook", O_PROC) != -1) {
    fprintf(stderr, "The addressbook service is already running.\n");
    exit(EXIT_FAILURE);
  }

  xmlfile = XMLloadFile(fpathname("data/addressbook.xml", getappdir(), 1));
  xmlelem = XMLgetNode(xmlfile, "xml");

  channel = makeChanP("/sys/addressbook");

  retexit(1);

  while(1) {
    rcvid = recvMsg(channel,(void *)&msg); 

    switch(msg->code) {
      case GET_ATTRIB:
        returncode = getattrib();
      break;
      case GET_ALL_LIST:
        returncode = getalllist();
      break;
      case MAKE_ENTRY:
        returncode = makeentry();
      break;
      case PUT_ATTRIB:
        returncode = putattrib();
      break;
      case DEL_ENTRY:
        returncode = deleteentry();
      break;
      case DEL_ATTRIB:
        returncode = deleteattrib();
      break;
      case IO_OPEN:
        if(*(int *)( ((char*)msg) +6) & (O_PROC|O_STAT))
          returncode = makeCon(rcvid, 1);
        else 
          returncode = -1;
      break;
    }

    replyMsg(rcvid, returncode);    
  }
} 
void ordersfrm::contmenu()
{
    QMenu* contextMenu = new QMenu( this );
    Q_CHECK_PTR( contextMenu );

    QAction* edititem = new QAction( tr("&Edit entry"), this );
	connect(edititem , SIGNAL(triggered()), this, SLOT(editentry()));
	contextMenu->addAction(edititem);

    QAction* delitem = new QAction( tr("&Delete entry"), this );
	connect(delitem , SIGNAL(triggered()), this, SLOT(deleteentry()));
	contextMenu->addAction(delitem);
		
    contextMenu->exec( QCursor::pos() );
    delete contextMenu;
}
void MCButton::SetMenuMode(MCExecContext& ctxt, intenum_t p_mode)
{
	if (entry != nil)
		deleteentry();
	else
		freemenu(False);

	setmenumode((uint1)p_mode);
	
	if (p_mode == WM_COMBO)
		createentry();
	else if (p_mode == WM_TOP_LEVEL)
	{
		if (getstyleint(flags) == F_MENU)
		{
			MCValueRelease(tabs);
			/* UNCHECKED */ MCStringSplit(menustring, MCSTR("\n"), nil, kMCStringOptionCompareExact, tabs);
		}
	}
	
	Redraw();
}
int ordersfrm::init()
{
    int r = this->checkrights();
    if(r == 1)
		btnadd->setEnabled(FALSE);
    if(r==0)
		QMessageBox::information(0, tr("Authorization Required..."), tr("You are not authorized to open this modul\n\nPlease contact your Administrator")); 

	treeindex->header()->setResizeMode(0, QHeaderView::Stretch);
	treeindex->setColumnWidth(1, 50);
	treeindex->setColumnHidden(2, TRUE);
	
	treemain->setColumnWidth(0, 40);
	
    vars v;
    QStringList sgeo = v.loadgeo(this->objectName());
    if(sgeo.size() > 0	)
    {
        if(sgeo[0] == "1")
			this->setWindowState(this->windowState() ^ Qt::WindowMaximized);
	    this->setGeometry(sgeo[1].toInt(), sgeo[2].toInt(), sgeo[3].toInt(), sgeo[4].toInt());
   	}
    
   	lbluser->setText(username);
   	progbar->setMaximum(1);
   	progbar->setValue(1);
    this->countentries();

	connect(treeindex, SIGNAL(itemClicked ( QTreeWidgetItem*, int)), this, SLOT(loadentries()));
	connect(btnadd, SIGNAL(released()), this, SLOT(newentry()));
	connect(btnedit, SIGNAL(released()), this, SLOT(editentry()));
	connect(btndelete, SIGNAL(released()), this, SLOT(deleteentry()));
	connect(btncompleted, SIGNAL(released()), this, SLOT(complete()));
	connect(treemain, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contmenu()));
	connect(btnclose, SIGNAL(released()), this, SLOT(close()));

    return r;
}
Exemple #6
0
// creates all menus
void WMain::createMenus() {
	fileMenu=new QMenu(this);
	wordMenu=new QMenu(this);
	testMenu=new QMenu(this);
	helpMenu=new QMenu(this);

	newAction=new QAction(tr("&New"), this);
	newAction->setShortcuts(QKeySequence::New);
	newAction->setStatusTip(tr("Create new dictionary"));

	openAction=new QAction(tr("&Open..."), this);
	openAction->setShortcuts(QKeySequence::Open);
	openAction->setStatusTip(tr("Open dictionary"));

	saveAction=new QAction(tr("&Save"), this);
	saveAction->setShortcuts(QKeySequence::Save);
	saveAction->setStatusTip(tr("Save dictionary"));

	saveasAction=new QAction(tr("&Save as..."), this);
	saveasAction->setShortcuts(QKeySequence::SaveAs);
	saveasAction->setStatusTip(tr("Save dictionary as"));

	printAction=new QAction(tr("&Print"), this);
	printAction->setShortcuts(QKeySequence::Print);
	printAction->setStatusTip(tr("Print dictionary"));
	
	settingsAction=new QAction(tr("&Settings"), this);
	settingsAction->setShortcut(QKeySequence("Ctrl+B"));
	settingsAction->setStatusTip(tr("Settings"));

	quitAction=new QAction(tr("&Quit"), this);
	quitAction->setShortcut(QKeySequence("Ctrl+Q"));
	quitAction->setStatusTip(tr("Quit dicto"));

	addAction=new QAction(tr("&Add..."), this);
	addAction->setShortcut(Qt::Key_Insert);
	addAction->setStatusTip(tr("Add new word"));

	editAction=new QAction(tr("&Edit..."), this);
	editAction->setStatusTip(tr("Edit current word"));

	deleteAction=new QAction(tr("&Delete"), this);
	deleteAction->setShortcut(Qt::Key_Delete);
	deleteAction->setStatusTip(tr("Delete current word"));

	sortAction=new QAction(tr("&Sort"), this);
	sortAction->setShortcut(QKeySequence("Ctrl+A"));
	sortAction->setStatusTip(tr("Sort dictionary"));

	testAction=new QAction(tr("&Test..."), this);
	testAction->setShortcut(QKeySequence("Ctrl+T"));
	testAction->setStatusTip(tr("Prepare test"));

	examAction=new QAction(tr("&Exam..."), this);
	examAction->setShortcut(QKeySequence("Ctrl+E"));
	examAction->setStatusTip(tr("Prepare exam"));

	statsAction=new QAction(tr("&Statistics..."), this);
	statsAction->setShortcut(QKeySequence("Ctrl+W"));
	statsAction->setStatusTip(tr("Show statistics"));

	aboutAction=new QAction(tr("&About"), this);
	aboutAction->setStatusTip(tr("About dicto"));

	fileMenu = menuBar()->addMenu(tr("&File"));
	fileMenu->addAction(newAction);
	fileMenu->addAction(openAction);
	fileMenu->addAction(saveAction);
	fileMenu->addAction(saveasAction);
	fileMenu->addAction(printAction);
	fileMenu->addSeparator();
	

	for (int i = 0; i < 10/*maxRecentFiles*/; ++i) {
		recentFilesActions[i] = new QAction(this);
		recentFilesActions[i]->setVisible(false);
		fileMenu->addAction(recentFilesActions[i]);
		connect(recentFilesActions[i], SIGNAL(triggered()),this, SLOT(openRecentFile()));
	}
	updateRecentFileActions();

	
	fileMenu->addSeparator();
	fileMenu->addAction(settingsAction);
	fileMenu->addSeparator();
	fileMenu->addAction(quitAction);

	wordMenu = menuBar()->addMenu(tr("&Words"));
	wordMenu->addAction(addAction);
	wordMenu->addAction(editAction);
	wordMenu->addAction(deleteAction);
	wordMenu->addSeparator();
	wordMenu->addAction(sortAction);

	testMenu = menuBar()->addMenu(tr("&Test"));
	testMenu->addAction(testAction);
	testMenu->addAction(examAction);
	testMenu->addSeparator();
	testMenu->addAction(statsAction);

	helpMenu = menuBar()->addMenu(tr("&Help"));
	helpMenu->addAction(aboutAction);

	connect(newAction, SIGNAL(triggered()), this, SLOT(newfile()));
	connect(openAction, SIGNAL(triggered()), this, SLOT(openfile()));
	connect(saveAction, SIGNAL(triggered()), this, SLOT(savefile()));
	connect(saveasAction, SIGNAL(triggered()), this, SLOT(saveas()));
	connect(printAction, SIGNAL(triggered()), this, SLOT(print()));
	connect(settingsAction, SIGNAL(triggered()), this, SLOT(show_settings()));
	connect(quitAction, SIGNAL(triggered()), this, SLOT(close()));

	connect(addAction, SIGNAL(triggered()), this, SLOT(addentry()));
	connect(editAction, SIGNAL(triggered()), this, SLOT(editentry()));
	connect(deleteAction, SIGNAL(triggered()), this, SLOT(deleteentry()));
	connect(sortAction, SIGNAL(triggered()), this, SLOT(sortall()));

	connect(testAction, SIGNAL(triggered()), this, SLOT(preparetest()));
	connect(examAction, SIGNAL(triggered()), this, SLOT(prepareexam()));
	connect(statsAction, SIGNAL(triggered()), this, SLOT(stats()));

	connect(aboutAction, SIGNAL(triggered()), this, SLOT(about()));
}