Skip to content

Commit

Permalink
Buttons are working
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiantheblind committed Jul 30, 2011
1 parent ccfc03c commit 6ba2043
Show file tree
Hide file tree
Showing 9 changed files with 2,218 additions and 16 deletions.
Binary file modified Iconic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified IconicR.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions MPOLnch.fr
Original file line number Diff line number Diff line change
Expand Up @@ -432,15 +432,15 @@ resource MPOLnchNodeWidget (kMPOLnchListElementRsrcID + index_enUS)
__FILE__, __LINE__,
kMPOLnchListParentWidgetId, kPMRsrcID_None, // WidgetId, RsrcId
kBindLeft | kBindRight, // Frame binding
Frame(0, 0, 194, 44), // Frame
Frame(0, 0, 194, 38), // Frame
kTrue, kTrue, // Visible, Enabled
"", // Panel name
{
MPOLnchEyeballWidget
(
kMPOLnchListElementEyeballWidgetID, kMPOLnchPNGIconRsrcID, kMPOLnchPluginID, // WidgetId, RsrcId
kBindLeft, // Frame binding
Frame(3,1,44,42) // Frame
Frame(3,3,36,35) // Frame
kTrue, kTrue, // Visible, Enabled
kADBEIconSuiteButtonType,
),
Expand All @@ -461,7 +461,7 @@ resource MPOLnchNodeWidget (kMPOLnchListElementRsrcID + index_enUS)
(
kMPOLnchTextWidgetID, kPMRsrcID_None, // WidgetId, RsrcId
kBindLeft | kBindRight, // Frame binding
Frame(45,1,194,42) // Frame
Frame(40,3,194,35) // Frame
kTrue, kTrue, kAlignLeft,kEllipsizeEnd,kTrue, // Visible, Enabled, ellipsize style, convert ampersands
"", // Initial text
0, // Associated widget for focus
Expand Down
151 changes: 150 additions & 1 deletion MPOLnchEyeballObserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,27 @@
// Interface includes
#include "ISubject.h"
#include "ITriStateControlData.h"
#include "IControlView.h"
#include "ITreeViewController.h"
#include "IWidgetParent.h"
#include "IPanelControlData.h"
#include "ITextControlData.h"



// Implem includes
#include "CAlert.h"
#include "CObserver.h"
#include "MPOLnchID.h"

// Implem includes
#include "K2Vector.tpp" // For NodeIDList to compile
#include "MPOLnchNodeID.h"

// Scripting includes
#include "FileUtils.h"
#include "IScriptRunner.h"
#include "IScriptUtils.h"
/**
Observes the "eyeball" widget.
Expand Down Expand Up @@ -135,12 +150,146 @@ void MPOLnchEyeballObserver::Update
if(theChange == kTrueStateMessage) {
// Then the button has been activated.
do {
InterfacePtr<ITriStateControlData> data(this, IID_ITRISTATECONTROLDATA);

InterfacePtr<IWidgetParent> widgetParent(this, IID_IWIDGETPARENT);
if(widgetParent == nil){

CAlert::InformationAlert("widgetParent is nil");

break;
}

InterfacePtr<IPanelControlData> panelData((IPanelControlData*)widgetParent->QueryParentFor(IID_IPANELCONTROLDATA));
if(panelData == nil) {

CAlert::InformationAlert("panelData is nil");

break;

}

IControlView* nameView = panelData->FindWidget(kMPOLnchTextWidgetID);
InterfacePtr<ITextControlData> textControlData( nameView, UseDefaultIID() );

if( (textControlData== nil)) {
break;
CAlert::InformationAlert("textControlData is nil");

}
PMString myText(textControlData->GetString());

CAlert::InformationAlert(myText);

// InterfacePtr<IControlView> myTextWidget(panelData->FindWidget(kMPOLnchTextWidgetID), UseDefaultIID());
// if(myTextWidget == nil){
//
// CAlert::InformationAlert("myTextWidget is nil");
//
//
// break;
//
// }
// PMString myText = myTextWidget->getString();
//
// CAlert::InformationAlert(myText);

// InterfacePtr<ITreeViewController> myController(widgetParent->GetParent(), IID_ITREEVIEWCONTROLLER);

//ASSERT(myController);
// if(!myController)
// {
// CAlert::InformationAlert("myController is nil");
// break;
//
// }
//
// NodeIDList selectedItems;
// myController->GetSelectedItems(selectedItems);
// const int kSelectionLength = selectedItems.size() ;
// CAlert::InformationAlert(PMString("length "+kSelectionLength));

PMString dbgInfoString("MPOLnchEyeballObserver::Update() ");
dbgInfoString.SetTranslatable(kFalse); // only for debug- not real code
CAlert::InformationAlert(dbgInfoString);



} while(0);
}


// if ((protocol == IID_ITREEVIEWCONTROLLER) && (theChange == kListSelectionChangedMessage) ) {
// do {
//
// // CAlert::InformationAlert("You pressed the something");
//
// InterfacePtr<ITreeViewController> controller(this, UseDefaultIID());
// ASSERT(controller);
// if(!controller)
// {
// break;
// }
//
// NodeIDList selectedItems;
// controller->GetSelectedItems(selectedItems);
// const int kSelectionLength = selectedItems.size() ;
// if (kSelectionLength> 0 )
// {
// PMString nodeName("");
// K2Vector<NodeID>::const_iterator iter, startIter, endIter;
// startIter = selectedItems.begin();
// endIter = selectedItems.end();
// for(iter = startIter; iter != endIter; ++iter)
// {
// const MPOLnchNodeID* oneNode = static_cast<const MPOLnchNodeID*>(iter->Get());
// PMString item = oneNode->GetName();
// item.Translate();
// nodeName.Append(item);
// //dbgInfoString += ", ";
// }
//
//
// //dbgInfoString.Truncate(2); //remove the last ', '
// nodeName.SetTranslatable(kFalse); // only for debug- not real code
// CAlert::InformationAlert(nodeName);
//
// IDFile scriptFile;
//
// FileUtils::GetAppInstallationFolder(&scriptFile); //application folder path
// FileUtils::AppendPath(&scriptFile, PMString("Scripts"));
// FileUtils::AppendPath(&scriptFile, PMString("Scripts Panel"));
// FileUtils::AppendPath(&scriptFile, PMString("MPO Launcher"));
// if (FileUtils::DoesFileExist(scriptFile)) {
//
// PMString fn(nodeName);
// PMString ext(".jsx");
//
//
// FileUtils::AppendPath(&scriptFile, fn + ext);
//
// InterfacePtr<IScriptRunner>scriptRunner(Utils<IScriptUtils>()->QueryScriptRunner(scriptFile));
// bool filestatus=scriptRunner->CanHandleFile(scriptFile);
//
// RunScriptParams scriptParams(scriptRunner);
// scriptParams.SetShowErrorAlert(kTrue);
// scriptParams.SetInvokeDebugger(kFalse);
//
//
//
// if(filestatus==1)
// {
// scriptRunner->RunFile(scriptFile,scriptParams);
// }// close filestatus
// }else {
// CAlert::InformationAlert("Got an error. You need the MPO Launcher Folder in the Scripts Panel");
// }
//
//
// }
//
// } while(0);
// }

}


Expand Down
7 changes: 5 additions & 2 deletions MPOLnchListBoxObserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@
Observes the listbox via IID_ITREEVIEWCONTROLLER.
@ingroup wlistboxcomposite
@ingroup mpolauncher
*/
class MPOLnchListBoxObserver : public CObserver
{
public:

/**
Constructor for WLBListBoxObserver class.
Constructor for MPOLnchListBoxObserver class.
@param interface ptr from boss object on which this interface is aggregated.
*/
MPOLnchListBoxObserver(IPMUnknown *boss);
Expand Down Expand Up @@ -144,6 +144,9 @@ void MPOLnchListBoxObserver::Update
{
if ((protocol == IID_ITREEVIEWCONTROLLER) && (theChange == kListSelectionChangedMessage) ) {
do {

// CAlert::InformationAlert("You pressed the something");

InterfacePtr<ITreeViewController> controller(this, UseDefaultIID());
ASSERT(controller);
if(!controller)
Expand Down
8 changes: 0 additions & 8 deletions MPOLnchNodeID.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,12 +68,4 @@ void MPOLnchNodeID::Write(IPMStream* stream) const



/* SetName
*/
//void MPOLnchNodeID::SetName(const PMString& newName)
//{
// if (fName != newName)
// fName = newName;
//}

// end, File: PnlTrvDataNode.cpp
2 changes: 1 addition & 1 deletion MPOLnchTreeViewAdapter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

/**
* TreeViewAdapter.
@ingroup wlistboxcomposite
@ingroup mpolauncher
*/
class MPOLnchTreeViewAdapter : public ListTreeViewAdapter
{
Expand Down
17 changes: 16 additions & 1 deletion MPOLnchTreeViewWidgetMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,28 @@ bool16 MPOLnchTVWidgetMgr::ApplyDataToWidget(const NodeID& node,
PMString listName = nodeID->GetName();

IControlView* nameView = widgetList->FindWidget(kMPOLnchTextWidgetID);

IControlView* myNameView = widgetList->FindWidget(kMPOLnchListElementEyeballWidgetID);

InterfacePtr<ITextControlData> textControlData( nameView, UseDefaultIID() );
InterfacePtr<ITextControlData> myTextControlData( myNameView, UseDefaultIID() );


ASSERT(textControlData);
if( textControlData== nil) {
ASSERT(myTextControlData);

if( (textControlData== nil)) {
break;
}

textControlData->SetString(listName);

if( (myTextControlData== nil)) {
break;
}

myTextControlData->SetString(listName);

} while (false);

return kTrue;
Expand Down
Loading

0 comments on commit 6ba2043

Please sign in to comment.