void
JXFontCharSetMenu::Receive
	(
	JBroadcaster*	sender,
	const Message&	message
	)
{
	if ((sender == itsFontNameMenu && message.Is(JXFontNameMenu::kNameChanged)) ||
		(sender == itsFontSizeMenu && message.Is(JXFontSizeMenu::kSizeChanged)))
		{
		itsBroadcastChangeFlag = kJFalse;
		const JString charSet  = GetCharSet();
		const JString fontName = itsFontNameMenu->GetFontName();
		BuildMenu(fontName, itsFontSizeMenu->GetFontSize());
		SetCharSet(charSet);
		itsBroadcastChangeFlag = kJTrue;
		}

	else if (sender == this && message.Is(JXMenu::kNeedsUpdate))
		{
		itsBroadcastChangeFlag = kJFalse;
		Broadcast(CharSetNeedsUpdate());
		CheckItem(itsCurrIndex);
		itsBroadcastChangeFlag = kJTrue;
		}
	else if (sender == this && message.Is(JXMenu::kItemSelected))
		{
		const JXMenu::ItemSelected* selection =
			dynamic_cast(const JXMenu::ItemSelected*, &message);
		assert( selection != NULL );
		ChooseCharSet(selection->GetIndex());
		}

	else
		{
void CDlgMenuThread::BuildMenu(CMenu* menu, CMenu* pMenu) 
{
	for ( UINT i=0; i< pMenu->GetMenuItemCount(); i++ )
	{
		CMenu* sub = pMenu->GetSubMenu(i);
		
		CString menuText;
		pMenu->GetMenuString(i, menuText, MF_BYPOSITION);
		UINT menuFlag = pMenu->GetMenuState(i, MF_BYPOSITION);
		UINT menuCode = pMenu->GetMenuItemID(i) ;

		if ( sub != NULL )
		{
			CMenu* subMenu = CreateMenu();
			BuildMenu(subMenu,(CMenu*)sub );
	        menu->AppendMenu(MF_POPUP, (UINT)subMenu->GetSafeHmenu(), menuText);
		}

		else
		{
	        menu->AppendMenu(MF_STRING | menuFlag, menuCode, menuText);
			if ( menuFlag & MF_CHECKED ) 
				 menu->CheckMenuItem( menu->GetMenuItemCount() - 1, MF_CHECKED);
		}

	}
}
void
TemplatesMenu::AttachedToWindow()
{
	BuildMenu();
	BMenu::AttachedToWindow();
	SetTargetForItems(fTarget);
}
Beispiel #4
0
QX::QX(QWidget *parent, Qt::WFlags f)
        : QWidget(parent)
{
    Q_UNUSED(f);

    BuildMenu();
    favouritesAction->setChecked(true);

    lineEdit = new QLineEdit("terminal.sh", this);

    bOk = new QPushButton(this);
    bOk->setMinimumWidth(100);
    bOk->setText("Run");
    connect(bOk, SIGNAL(clicked()), this, SLOT(okClicked()));

    lw = new QListWidget(this);
    connect(lw, SIGNAL(clicked(QModelIndex)), this, SLOT(listClicked()));

    lAppname = new QLabel(this);
    bResume = new QPushButton(this);
    bTerminate = new QPushButton(this);
    lAppname->setVisible(false);
    lAppname->setAlignment(Qt::AlignCenter);
    bResume->setVisible(false);
    bTerminate->setVisible(false);
    connect(bResume, SIGNAL(clicked()), this, SLOT(resumeClicked()));
    connect(bTerminate, SIGNAL(clicked()), this, SLOT(terminateClicked()));

    //------------------------------------------

    grid=new QGridLayout(this);
    grid->addWidget(lineEdit,0,0);
    grid->addWidget(bOk,0,1);
    grid->addWidget(lw,1,0,1,2);
    grid->addWidget(lAppname,2,0,1,2);
    grid->addWidget(bResume,3,0,1,2);
    grid->addWidget(bTerminate,4,0,1,2);

    LoadFavourites();
    scanner = new DesktopScanner();
    FillApps(favouritesAction->isChecked());

    //==========================================

    appRunScr = new AppRunningScreen();

    process = NULL;
    xprocess = NULL;
    screen = QX::ScreenMain;
#if QTOPIA
    powerConstraint = QtopiaApplication::Disable;

    // Start the "QX" service that handles application switching.
    new QxService(this);
#endif

    showScreen(QX::ScreenMain);
}
Beispiel #5
0
Shader::Shader()
	: wxFrame(NULL, wxID_ANY, wxT("FragmentShader"))
{
	BuildMenu();
	AddStatusBar();
	LoadConfig();
	m_Timer.SetOwner(this);
	m_Timer.Start(1000, wxTIMER_CONTINUOUS);
}
Beispiel #6
0
void SMenu::BuildMenu( HMENU menuPopup,pugi::xml_node xmlNode )
{
    pugi::xml_node xmlItem=xmlNode.first_child();

    while(xmlItem)
    {
        if(wcscmp(L"item",xmlItem.name())==0)
        {
            SMenuItemData *pdmmi=new SMenuItemData;
            pdmmi->hMenu=menuPopup;
            pdmmi->itemInfo.iIcon=xmlItem.attribute(L"icon").as_int(-1);
            SStringW strText = xmlItem.text().get();
            strText.TrimBlank();
            InitMenuItemData(pdmmi->itemInfo,strText);

            int nID=xmlItem.attribute(L"id").as_int(0);
            BOOL bCheck=xmlItem.attribute(L"check").as_bool(false);
            BOOL bRadio=xmlItem.attribute(L"radio").as_bool(false);
            BOOL bDisable=xmlItem.attribute(L"disable").as_bool(false);


            pugi::xml_writer_buff writer;
            xmlItem.print(writer,L"\t",pugi::format_default,pugi::encoding_utf16);
            SStringW str(writer.buffer(),writer.size());

            pugi::xml_node xmlChild=xmlItem.first_child();
            while(xmlChild && xmlChild.type()==pugi::node_pcdata) xmlChild=xmlChild.next_sibling();


            if(!xmlChild)
            {
                pdmmi->nID=nID;
                UINT uFlag=MF_OWNERDRAW;
                if(bCheck) uFlag|=MF_CHECKED;
                if(bDisable) uFlag |= MF_GRAYED;
                if(bRadio) uFlag |= MFT_RADIOCHECK|MF_CHECKED;
                AppendMenu(menuPopup,uFlag,(UINT_PTR)pdmmi->nID,(LPCTSTR)pdmmi);
            }
            else
            {
                HMENU hSubMenu=::CreatePopupMenu();
                pdmmi->nID=(UINT_PTR)hSubMenu;
                UINT uFlag=MF_OWNERDRAW|MF_POPUP;
                if(bDisable) uFlag |= MF_GRAYED;
                AppendMenu(menuPopup,uFlag,(UINT_PTR)hSubMenu,(LPCTSTR)pdmmi);
                BuildMenu(hSubMenu,xmlItem);//build sub menu
            }
            m_arrDmmi.Add(pdmmi);
        }
        else if(wcscmp(L"sep",xmlItem.name())==0)
        {
            AppendMenu(menuPopup,MF_SEPARATOR|MF_OWNERDRAW,(UINT_PTR)0,(LPCTSTR)NULL);
        }
        xmlItem=xmlItem.next_sibling();
    }
}
Beispiel #7
0
TMenu::TMenu(const char *name, const char *attribute, int32 message, bool popup,
		bool addRandom)
	: BPopUpMenu(name, false, false),
	fPopup(popup),
	fAddRandom(addRandom),
	fMessage(message)
{
	fAttribute = strdup(attribute);
	BuildMenu();
}
Beispiel #8
0
void CDuiMenu::BuildMenu( HMENU menuPopup,pugi::xml_node xmlNode )
{
	pugi::xml_node xmlItem=xmlNode.first_child();

    while(xmlItem)
    {
        if(strcmp("item",xmlItem.name())==0)
        {
            DuiMenuItemData *pdmmi=new DuiMenuItemData;
            pdmmi->hMenu=menuPopup;
			pdmmi->itemInfo.iIcon=xmlItem.attribute("icon").as_int(-1);
			pdmmi->itemInfo.strText=DUI_CA2T(xmlItem.text().get(),CP_UTF8);

            int nID=xmlItem.attribute("id").as_int(0);
            BOOL bCheck=xmlItem.attribute("check").as_bool(false);
			BOOL bRadio=xmlItem.attribute("radio").as_bool(false);
			BOOL bDisable=xmlItem.attribute("disable").as_bool(false);


			pugi::xml_writer_buff writer;
			xmlItem.print(writer);
			CDuiStringW str=DUI_CA2W(CDuiStringA(writer.buffer(),writer.size()),CP_UTF8);

			pugi::xml_node xmlChild=xmlItem.first_child();
			while(xmlChild && xmlChild.type()==pugi::node_pcdata) xmlChild=xmlChild.next_sibling();


			if(!xmlChild)
            {
                pdmmi->nID=nID;
                UINT uFlag=MF_OWNERDRAW;
                if(bCheck) uFlag|=MF_CHECKED;
                if(bDisable) uFlag |= MF_GRAYED;
                if(bRadio) uFlag |= MFT_RADIOCHECK|MF_CHECKED;
                AppendMenu(menuPopup,uFlag,(UINT_PTR)pdmmi->nID,(LPCTSTR)pdmmi);
            }
            else
            {
                HMENU hSubMenu=::CreatePopupMenu();
                pdmmi->nID=(UINT_PTR)hSubMenu;
                UINT uFlag=MF_OWNERDRAW|MF_POPUP;
                if(bDisable) uFlag |= MF_GRAYED;
                AppendMenu(menuPopup,uFlag,(UINT_PTR)hSubMenu,(LPCTSTR)pdmmi);
                BuildMenu(hSubMenu,xmlItem);//build sub menu
            }
            m_arrDmmi.Add(pdmmi);
        }
        else if(strcmp("sep",xmlItem.name())==0)
        {
            AppendMenu(menuPopup,MF_SEPARATOR|MF_OWNERDRAW,(UINT_PTR)0,(LPCTSTR)NULL);
        }
		xmlItem=xmlItem.next_sibling();
    }
}
Beispiel #9
0
void PopupMenu::AddSep(const char *path) {
	if (!path) {
		m_menu->addSeparator();
		return;
	}

	QString s(path);
	QMenu *m = BuildMenu(s, false);

	if (m)
		m->addSeparator();
}
Beispiel #10
0
BOOL SMenu::LoadMenu( pugi::xml_node xmlMenu )
{
    m_hMenu=CreatePopupMenu();
    if(!m_hMenu) return FALSE;

    m_menuAttr.InitFromXml(xmlMenu);
    SASSERT(m_menuAttr.m_pItemSkin);

    BuildMenu(m_hMenu,xmlMenu);

    return TRUE;
}
Beispiel #11
0
BOOL CDuiMenu::LoadMenu( pugi::xml_node xmlMenu )
{
	m_hMenu=CreatePopupMenu();
	if(!m_hMenu) return FALSE;

	m_menuSkin.Load(xmlMenu);
	DUIASSERT(m_menuSkin.m_pItemSkin);

	BuildMenu(m_hMenu,xmlMenu);

	return TRUE;
}
JXDisplayMenu::JXDisplayMenu
	(
	JXMenu*			owner,
	const JIndex	itemIndex,
	JXContainer*	enclosure
	)
	:
	JXTextMenu(owner, itemIndex, enclosure)
{
	itsNewDisplayDialog = NULL;
	BuildMenu();
}
void
SCNodeMenu::SCNodeMenuX
	(
	const SCCircuit* circuit
	)
{
	itsCircuit = circuit;
	ListenTo(itsCircuit->GetNodeList());

	itsBroadcastNodeChangeFlag = kJTrue;

	BuildMenu();
}
JXFontCharSetMenu::JXFontCharSetMenu
	(
	const JCharacter*	fontName,
	const JSize			fontSize,
	JXMenu*				owner,
	const JIndex		itemIndex,
	JXContainer*		enclosure
	)
	:
	JXTextMenu(owner, itemIndex, enclosure)
{
	JXFontCharSetMenuX(NULL, NULL);
	BuildMenu(fontName, fontSize);
}
void
JXDisplayMenu::Receive
	(
	JBroadcaster*	sender,
	const Message&	message
	)
{
	const JPtrArray<JXDisplay>* displayList = (JXGetApplication())->GetDisplayList();

	if (sender == this && message.Is(JXMenu::kNeedsUpdate))
		{
		Broadcast(DisplayNeedsUpdate());
		CheckItem(itsDisplayIndex);
		}
	else if (sender == this && message.Is(JXMenu::kItemSelected))
		{
		const JXMenu::ItemSelected* selection =
			dynamic_cast<const JXMenu::ItemSelected*>(&message);
		assert( selection != NULL );
		ChooseDisplay(selection->GetIndex());
		}

	else if (sender == const_cast<JPtrArray<JXDisplay>*>(displayList))
		{
		// we do this no matter what change occurs

		BuildMenu();
		}

	else if (sender == itsNewDisplayDialog &&
			 message.Is(JXDialogDirector::kDeactivated))
		{
		const JXDialogDirector::Deactivated* info =
			dynamic_cast<const JXDialogDirector::Deactivated*>(&message);
		assert( info != NULL );
		if (info->Successful())
			{
			itsDisplayIndex = itsNewDisplayDialog->GetDisplayIndex();
			Broadcast(DisplayChanged(itsDisplayIndex));
			}
		SetPopupChoice(itsDisplayIndex);
		itsNewDisplayDialog = NULL;
		}

	else
		{
		JXTextMenu::Receive(sender, message);
		}
}
JXFontCharSetMenu::JXFontCharSetMenu
	(
	JXFontNameMenu*		fontMenu,
	JXFontSizeMenu*		sizeMenu,
	JXMenu*				owner,
	const JIndex		itemIndex,
	JXContainer*		enclosure
	)
	:
	JXTextMenu(owner, itemIndex, enclosure)
{
	JXFontCharSetMenuX(fontMenu, sizeMenu);
	const JString fontName = itsFontNameMenu->GetFontName();
	BuildMenu(fontName, itsFontSizeMenu->GetFontSize());
}
void
JXFontCharSetMenu::SetFont
	(
	const JCharacter*	name,
	const JSize			size
	)
{
	JString fontName, charSet;
	JFontManager::ExtractCharacterSet(name, &fontName, &charSet);
	if (charSet.IsEmpty())
		{
		charSet = GetCharSet();
		}
	BuildMenu(name, size);
	SetCharSet(charSet);
}
JXDisplayMenu::JXDisplayMenu
	(
	const JCharacter*	title, 
	JXContainer*		enclosure,
	const HSizingOption	hSizing,
	const VSizingOption	vSizing,
	const JCoordinate	x,
	const JCoordinate	y,
	const JCoordinate	w,
	const JCoordinate	h
	)
	:
	JXTextMenu(title, enclosure, hSizing, vSizing, x,y, w,h)
{
	itsNewDisplayDialog = NULL;
	BuildMenu();
}
void AmBankChangeView::SetTrackRef(AmTrackRef trackRef)
{
	mTrackRef = trackRef;
	BMenu*	menu = Menu();
	if (!menu) return;
	if (menu->RemoveItems(0, menu->CountItems(), true) ) return;
	if (!mTrackRef.IsValid() ) return;

	// READ TRACK BLOCK
	#ifdef AM_TRACE_LOCKS
	printf("AmProgramChangeView::SetTrackRef() read lock\n");
	#endif
	const AmSong*	song = mSongRef.ReadLock();
	const AmTrack*	track = song ? song->Track(mTrackRef) : NULL;
	if (track) BuildMenu(track, menu);
	mSongRef.ReadUnlock(song);
	// END READ TRACK BLOCK
}
Beispiel #20
0
void WinConsole::Run()
{
	if (!m_appMode || m_addParam)
	{
		return;
	}

	CreateTrayIcon();

	LoadPrefs();
	ApplyPrefs();

	BuildMenu();

	if (m_showWebUI && !m_autoParam && mayStartBrowser)
	{
		ShowWebUI();
	}
	mayStartBrowser = false;

	int counter = 0;
	while (!IsStopped())
	{
		MSG msg;
		if (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE))
		{
			TranslateMessage(&msg);
			DispatchMessage(&msg);
		}
		else
		{
			usleep(20 * 1000);
			counter += 20;
			if (counter >= 200)
			{
				UpdateTrayIcon();
				counter = 0;
			}
		}
	}

	Shell_NotifyIcon(NIM_DELETE, m_iconData);
}
JXFontCharSetMenu::JXFontCharSetMenu
	(
	const JCharacter*	fontName,
	const JSize			fontSize,
	const JCharacter*	title,
	JXContainer*		enclosure,
	const HSizingOption	hSizing,
	const VSizingOption	vSizing,
	const JCoordinate	x,
	const JCoordinate	y,
	const JCoordinate	w,
	const JCoordinate	h
	)
	:
	JXTextMenu(title, enclosure, hSizing, vSizing, x,y, w,h)
{
	JXFontCharSetMenuX(NULL, NULL);
	BuildMenu(fontName, fontSize);
}
JXFontCharSetMenu::JXFontCharSetMenu
	(
	JXFontNameMenu*		fontMenu,
	JXFontSizeMenu*		sizeMenu,
	const JCharacter*	title, 
	JXContainer*		enclosure,
	const HSizingOption	hSizing,
	const VSizingOption	vSizing,
	const JCoordinate	x,
	const JCoordinate	y,
	const JCoordinate	w,
	const JCoordinate	h
	)
	:
	JXTextMenu(title, enclosure, hSizing, vSizing, x,y, w,h)
{
	JXFontCharSetMenuX(fontMenu, sizeMenu);
	const JString fontName = itsFontNameMenu->GetFontName();
	BuildMenu(fontName, itsFontSizeMenu->GetFontSize());
}
void
SCComponentMenu::SCComponentMenuX
	(
	const SCCircuit*	circuit,
	SCComponentFilter*	filter
	)
{
	itsCircuit = circuit;
	ListenTo(itsCircuit->GetComponentList());

	itsFilter = filter;

	itsCompList = new JArray<JIndex>;
	assert( itsCompList != NULL );

	itsBroadcastCompChangeFlag = kJTrue;

	BuildCompList();
	BuildMenu();
}
int main(int argc, char *argv[])
{
	// Initialize GLUT and GLEW, then create a window.
	////////////////////
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH);
	glutInitWindowPosition(100, 100);
	glutInitWindowSize(800, 600);
	glutCreateWindow("HW1 - 103062372"); // You cannot use OpenGL functions before this line; The OpenGL context must be created first by glutCreateWindow()!
	glewInit();
    dumpInfo();
	////////////////////
	
	inittexture();
	
	// Initialize OpenGL states.
	////////////////////////
	SetupRC();  //initial
	////////////////////////

	BuildMenu();  //build menu

	// Register GLUT callback functions.
	///////////////////////////////
	glutDisplayFunc(My_Display);
	glutReshapeFunc(My_Reshape);
	glutMouseFunc(My_Mouse);
	glutMotionFunc(My_MouseMove);
	glutKeyboardFunc(My_Keyboard);
	glutSpecialFunc(My_SpecialKeys);
	glutTimerFunc(timer_speed, My_Timer, 0); 
	///////////////////////////////


	
	// Enter main event loop.
	//////////////
	glutMainLoop();
	//////////////
	return 0;
}
void AmProgramChangeView::SetTrackRef(AmTrackRef trackRef)
{
	mTrackRef = trackRef;
	BMenu*	menu = Menu();
	if (!menu) return;
	int32			oldIndex = -1;
	BMenuItem*		item = menu->FindMarked();
	if (item) oldIndex = menu->IndexOf(item);
	menu->RemoveItems(0, menu->CountItems(), true);
	if (!mTrackRef.IsValid() ) return;

	// READ TRACK BLOCK
	#ifdef AM_TRACE_LOCKS
	printf("AmProgramChangeView::SetTrackRef() read lock\n");
	#endif
	const AmSong*	song = ReadLock();
	const AmTrack*	track = song ? song->Track( mTrackRef ) : 0;
	if (track) BuildMenu(track, menu, oldIndex);
	ReadUnlock(song);
	// END READ TRACK BLOCK
}
Beispiel #26
0
void NUseStoredOpsProp::Init()
{
	NObject* pobj;
	m_pvarBloc->GetValue(m_dwvarIdx, 0.0f, pobj);

	char* pszName="";

	//Display referenced object name (from varbloc)
	if (pobj)
	{
		NVarsBloc* pbloc = pobj->GetFirstVarsBloc();
		pbloc->GetValue(0, 0.0f, pszName);
	}

	//Create menu button
	m_button.Create(pszName, NRect(0,0,0,0), m_pParent, 0);
	m_button.OnChanged = FDelegate(this, (TDelegate)&NUseStoredOpsProp::OnValueChanged);

	//Buid menu's items
	NTreeNode* pnode = NEditorGUI::GetInstance()->GetAsset()->GetRootGroup();
	BuildMenu(pnode);
}
Beispiel #27
0
void
PriorityMenu::Update()
{
	BRow* selected = fTeamListView->CurrentSelection(NULL);
	int32 priority;
	bool enabled = selected != NULL;
	
	if (enabled && fTeamListView->CurrentSelection(selected) == NULL && !selected->HasLatch()) 
		priority = ((ThreadItem *)selected)->priority;
	else 
		priority = -1;

	if (priority != fPriority || fEnabled != enabled)
	{   
		fPriority = priority;
		fEnabled = enabled;
		if (CountItems() > 0) 
			RemoveItems(0, CountItems(), true);
		if (CountItems() < 1)
			BuildMenu();
	}

}
void
TemplatesMenu::UpdateMenuState()
{
	BuildMenu(false);
}
void
SCComponentMenu::Receive
	(
	JBroadcaster*	sender,
	const Message&	message
	)
{
	JBroadcaster* compList = itsCircuit->GetComponentList();	// insure that it isn't const

	if (sender == this && message.Is(JXMenu::kNeedsUpdate))
		{
		itsBroadcastCompChangeFlag = kJFalse;
		Broadcast(ComponentNeedsUpdate());
		CheckItem(itsMenuIndex);
		itsBroadcastCompChangeFlag = kJTrue;
		}
	else if (sender == this && message.Is(JXMenu::kItemSelected))
		{
		const JXMenu::ItemSelected* selection =
			dynamic_cast<const JXMenu::ItemSelected*>(&message);
		assert( selection != NULL );
		itsMenuIndex = selection->GetIndex();

		JIndex compIndex;
		const JBoolean ok = MenuIndexToCompIndex(itsMenuIndex, &compIndex);
		assert( ok );
		Broadcast(ComponentChanged(compIndex));
		}

	else if (sender == compList)
		{
		JIndex compIndex;
		const JBoolean ok = MenuIndexToCompIndex(itsMenuIndex, &compIndex);
		BuildCompList();

		if (!ok)
			{
			itsMenuIndex = 1;
			}
		else if (message.Is(JOrderedSetT::kElementsInserted))
			{
			const JOrderedSetT::ElementsInserted* info =
				dynamic_cast<const JOrderedSetT::ElementsInserted*>(&message);
			assert( info != NULL && info->GetCount() == 1 );
			info->AdjustIndex(&compIndex);
			const JBoolean ok = CompIndexToMenuIndex(compIndex, &itsMenuIndex);
			assert( ok );
			}
		else if (message.Is(JOrderedSetT::kElementsRemoved))
			{
			const JOrderedSetT::ElementsRemoved* info =
				dynamic_cast<const JOrderedSetT::ElementsRemoved*>(&message);
			assert( info != NULL && info->GetCount() == 1 );
			if (info->AdjustIndex(&compIndex))
				{
				const JBoolean ok = CompIndexToMenuIndex(compIndex, &itsMenuIndex);
				assert( ok );
				}
			else
				{
				itsMenuIndex = 1;
				}
			}
		else if (message.Is(JOrderedSetT::kElementMoved))
			{
			const JOrderedSetT::ElementMoved* info =
				dynamic_cast<const JOrderedSetT::ElementMoved*>(&message);
			assert( info != NULL );
			info->AdjustIndex(&compIndex);
			const JBoolean ok = CompIndexToMenuIndex(compIndex, &itsMenuIndex);
			assert( ok );
			}
		else if (message.Is(JOrderedSetT::kElementsSwapped))
			{
			const JOrderedSetT::ElementsSwapped* info =
				dynamic_cast<const JOrderedSetT::ElementsSwapped*>(&message);
			assert( info != NULL );
			info->AdjustIndex(&compIndex);
			const JBoolean ok = CompIndexToMenuIndex(compIndex, &itsMenuIndex);
			assert( ok );
			}
		else if (message.Is(JOrderedSetT::kSorted))
			{
			assert( 0 );
			}
		// nothing extra required for JOrderedSetT::kElementChanged

		const JIndex savedIndex = itsMenuIndex;
		BuildMenu();
		itsMenuIndex = savedIndex;
		if (itsCompList->IndexValid(itsMenuIndex))
			{
			SetPopupChoice(itsMenuIndex);
			}
		}

	else
		{
		JXTextMenu::Receive(sender, message);
		}
}
Beispiel #30
0
static void displayDTIcon(DTIconRec *dticon)
{
 XGCValues xgcv;
 GC shapeGC;
 Window shellwin;
 XmString labelstr;
 Dimension labelwidth, labelheight, togglewidth, toggleheight;
 Dimension tgl_offs_x, lbl_offs_x, lbl_offs_y;
 Atom targets[2];
 Boolean is_file = False;
 int i;

 targets[0] = dragAtoms.file;
 targets[1] = dragAtoms.filelist;
 drop_args[0].value = (XtArgVal) targets;

 dticon->app.form = XtVaCreateManagedWidget("form", xmFormWidgetClass, dticon->cont, XmNtranslations, XtParseTranslationTable(form_translations), XmNbackground, resources.dticon_color, XmNforeground, resources.label_color, XmNborderWidth, 0, XmNshadowThickness, 0, XmNhighlightThickness, 0, XmNx, 0, XmNy, 0, NULL);

 if (dticon->app.fname[0])
 {
     char path[MAXPATHLEN];
     struct stat stats;
     int errfl = 0;

     if (dticon->app.directory[0])
     {
	 strcpy(path, dticon->app.directory);
	 fnexpand(path);
	 errfl = chdir(path);
     }
     else  errfl = chdir(user.home);
     if (!errfl && !(stat(dticon->app.fname, &stats)) && S_ISREG(stats.st_mode))
	 is_file = True;
 }
 if (is_file)
 {
     for (i=0; i < XtNumber(file_popup_menu); i++)
	 file_popup_menu[i].callback_data = dticon;
     dticon->popup = BuildMenu(dticon->app.form, XmMENU_POPUP, "Button Actions", 0, False, file_popup_menu);
     if (resources.auto_save)
	 XtVaSetValues(file_popup_menu[5].object, XmNsensitive, False, NULL);
 }
 else
 {
     for (i=0; i < XtNumber(file_popup_menu); i++)
	 popup_menu[i].callback_data = dticon;
     dticon->popup = BuildMenu(dticon->app.form, XmMENU_POPUP, "Button Actions", 0, False, popup_menu);
     if (resources.auto_save)
	 XtVaSetValues(popup_menu[3].object, XmNsensitive, False, NULL);
 }

 labelstr = XmStringCreateLocalized(dticon->app.name);
 labelwidth = XmStringWidth((XmFontList) resources.icon_font, labelstr) + 2;
 togglewidth = dticon->app.icon_pm.width;
 toggleheight = dticon->app.icon_pm.height;
 if (labelwidth > togglewidth)
 {
     tgl_offs_x = (labelwidth - togglewidth) / 2;
     lbl_offs_x = 0;
 }
 else
 {
     tgl_offs_x = 0;
     lbl_offs_x = (togglewidth - labelwidth) / 2;
 }
 lbl_offs_y = dticon->app.icon_pm.height + 2;

 dticon->app.toggle = XtVaCreateManagedWidget("picture", xmLabelWidgetClass, dticon->app.form, XmNlabelType, XmPIXMAP, XmNlabelPixmap, dticon->app.icon_pm.bm, XmNtranslations, trans, XmNborderWidth, 0, XmNhighlightThickness, 0, XmNbackground, resources.dticon_color, XmNforeground, resources.label_color, XmNx, tgl_offs_x, XmNy, 0, NULL);
/*  RBW - 2001/08/15  */
XtInsertEventHandler(dticon->app.toggle,
                     EnterWindowMask|LeaveWindowMask,
                     False,
                     (XtEventHandler)CatchEntryLeave2,
                     (XtPointer)0,
                     XtListHead);

 dticon->app.label = XtVaCreateManagedWidget("label", xmLabelWidgetClass, dticon->app.form, XmNlabelString, labelstr, XmNfontList, resources.icon_font, XmNtranslations, trans, XmNbackground, resources.dticon_color, XmNforeground, resources.label_color, XmNborderWidth, 0, XmNhighlightThickness, 0, XmNx, lbl_offs_x, XmNy, lbl_offs_y, NULL);
/*  RBW - 2001/08/15  */
XtInsertEventHandler(dticon->app.label,
                     EnterWindowMask|LeaveWindowMask,
                     False,
                     (XtEventHandler)CatchEntryLeave2,
                     (XtPointer)0,
                     XtListHead);

 XmStringFree(labelstr);

 XtRealizeWidget(dticon->shell);
 shellwin = XtWindow(dticon->shell);

 XtVaGetValues(dticon->app.label, XmNwidth, &labelwidth, XmNwidth, &labelheight, NULL);
 labelheight += 2;
 dticon->label_mask = XCreatePixmap(dpy, shellwin, labelwidth, labelheight, 1);
 shapeGC = XCreateGC(dpy, dticon->label_mask, 0, &xgcv);
 XSetForeground(dpy, shapeGC, 1);
 XFillRectangle(dpy, dticon->label_mask, shapeGC, 0, 0, labelwidth, labelheight);
 XFreeGC(dpy, shapeGC);
 if (dticon->app.icon_pm.mask == None)
 {
     dticon->app.icon_pm.mask = XCreatePixmap(dpy, shellwin, dticon->app.icon_pm.width, dticon->app.icon_pm.height, 1);
     shapeGC = XCreateGC(dpy, dticon->app.icon_pm.mask, 0, &xgcv);
     XSetForeground(dpy, shapeGC, 1);
     XFillRectangle(dpy, dticon->app.icon_pm.mask, shapeGC, 0, 0, togglewidth, toggleheight);
     XFreeGC(dpy, shapeGC);
 }
 XShapeCombineMask(dpy, shellwin, ShapeBounding, tgl_offs_x + 2, 2, dticon->app.icon_pm.mask, ShapeSet);
 XShapeCombineMask(dpy, shellwin, ShapeBounding, lbl_offs_x + 2, lbl_offs_y + 2, dticon->label_mask, ShapeUnion);
 XShapeCombineMask(dpy, XtWindow(dticon->app.form), ShapeClip, tgl_offs_x + 2, 2, dticon->app.icon_pm.mask, ShapeSet);
 XShapeCombineMask(dpy, XtWindow(dticon->app.form), ShapeClip, lbl_offs_x + 2, lbl_offs_y + 2, dticon->label_mask, ShapeUnion);
 XShapeCombineMask(dpy, XtWindow(dticon->app.toggle), ShapeClip, 2, 2, dticon->app.icon_pm.mask, ShapeSet);

 XtVaGetValues(dticon->shell, XmNwidth, &dticon->width, XmNheight, &dticon->height, NULL);

 dticon->drop_pixmap = XCreatePixmap(dpy, shellwin, dticon->width, dticon->height, DefaultDepth(dpy, DefaultScreen(dpy)));
 shapeGC = XCreateGC(dpy, dticon->drop_pixmap, 0, &xgcv);
 XSetForeground(dpy, shapeGC, resources.drop_color);
 XFillRectangle(dpy, dticon->drop_pixmap, shapeGC, 0, 0, dticon->width, dticon->height);
 XFreeGC(dpy, shapeGC);
 drop_args[4].value = (XtArgVal) dticon->drop_pixmap;

 if (dticon->app.drop_action[0])
     XmDropSiteRegister(dticon->app.form, drop_args, XtNumber(drop_args));

}