OpenASIP 2.2
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
WidgetTools Class Reference

#include <WidgetTools.hh>

Collaboration diagram for WidgetTools:
Collaboration graph

Static Public Member Functions

static void setWidgetLabel (wxWindow *widget, std::string text)
 
static void setWidgetLabel (wxStaticBoxSizer *widget, std::string text)
 
static void setLabel (Texts::TextGenerator *generator, wxWindow *widget, int textID)
 
static std::string lcStringSelection (wxListCtrl *list, int column)
 

Detailed Description

Helper functions for handling wxWidgets controls.

Definition at line 46 of file WidgetTools.hh.

Member Function Documentation

◆ lcStringSelection()

std::string WidgetTools::lcStringSelection ( wxListCtrl *  list,
int  column 
)
static

Returns wxListCtrl's first selected item as a string.

Parameters
listList to search for selected item.
columnColumn of the string to return.
Returns
Selected list item string, or empty string if no item is selected.

Definition at line 108 of file WidgetTools.cc.

108 {
109
110 long item = -1;
111 item = list->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
112
113 if (item == -1) {
114 return "";
115 }
116
117 wxListItem info;
118 info.SetId(item);
119 info.SetColumn(column);
120 list->GetItem(info);
121
122 return WxConversion::toString(info.GetText());
123}
static std::string toString(const wxString &source)

References WxConversion::toString().

Referenced by BlockImplementationDialog::doOK(), OperationDialog::onBindOperand(), FUImplementationDialog::onClearOpcode(), OperationDialog::onDeleteOperand(), FUDialog::onDeleteOperation(), GCUDialog::onDeleteOperation(), FUImplementationDialog::onDeleteSourceFile(), RFImplementationDialog::onDeleteSourceFile(), OperationPropertyDialog::onModifyInputOperand(), OperationPropertyDialog::onModifyOutputOperand(), OperationPropertyDialog::onMoveInputDown(), OperationPropertyDialog::onMoveInputUp(), OperationPropertyDialog::onMoveOutputDown(), OperationPropertyDialog::onMoveOutputUp(), RFImplementationDialog::onMoveSourceFileDown(), FUImplementationDialog::onMoveSourceFileDown(), RFImplementationDialog::onMoveSourceFileUp(), FUImplementationDialog::onMoveSourceFileUp(), FUImplementationDialog::onOpcodeSelection(), OperationDialog::onOperandSelection(), OperationPropertyDialog::onSelection(), FUImplementationDialog::onSetOpcode(), FUImplementationDialog::onSourceFileSelection(), RFImplementationDialog::onSourceFileSelection(), SimulateDialog::onUpdateValue(), OSEdInfoView::selectedModule(), OSEdInfoView::selectedOperation(), FUDialog::selectedOperation(), GCUDialog::selectedOperation(), OTAFormatListDialog::selectedOperation(), OSEdInfoView::selectedPath(), FUDialog::selectedPort(), GCUDialog::selectedPort(), and TemplateListDialog::selectedSlot().

Here is the call graph for this function:

◆ setLabel()

void WidgetTools::setLabel ( Texts::TextGenerator generator,
wxWindow *  widget,
int  textID 
)
static

Sets a widget label text.

Parameters
generatorTextGenerator which provides the label text.
widgetWidget to set the label to.
textIDText generator string ID for the label text.

Definition at line 92 of file WidgetTools.cc.

93 {
94
95 format fmt = generator->text(textID);
96 setWidgetLabel(widget, fmt.str());
97}
virtual boost::format text(int textId)
static void setWidgetLabel(wxWindow *widget, std::string text)

References setWidgetLabel(), and Texts::TextGenerator::text().

Referenced by OperationPropertyDialog::setBehaviorLabel(), GCUDialog::setLabels(), AddModuleDialog::setTexts(), InputOperandDialog::setTexts(), MemoryDialog::setTexts(), OperationDAGDialog::setTexts(), OperationPropertyDialog::setTexts(), OSEdAboutDialog::setTexts(), OSEdOptionsDialog::setTexts(), OutputOperandDialog::setTexts(), ResultDialog::setTexts(), SimulateDialog::setTexts(), AboutDialog::setTexts(), AddressSpaceDialog::setTexts(), AddressSpacesDialog::setTexts(), BridgeDialog::setTexts(), BusDialog::setTexts(), FUDialog::setTexts(), FUGuardDialog::setTexts(), FUPortDialog::setTexts(), ImmediateSlotDialog::setTexts(), IUDialog::setTexts(), IUPortDialog::setTexts(), OperationDialog::setTexts(), OTAFormatListDialog::setTexts(), RFDialog::setTexts(), RFGuardDialog::setTexts(), RFPortDialog::setTexts(), SocketDialog::setTexts(), SRPortDialog::setTexts(), TemplateListDialog::setTexts(), and TemplateSlotDialog::setTexts().

Here is the call graph for this function:

◆ setWidgetLabel() [1/2]

void WidgetTools::setWidgetLabel ( wxStaticBoxSizer *  sizer,
std::string  text 
)
static

Sets a boxsizer label text.

Parameters
sizerwxStaticBoxSizer to set the label to.
textIdEnumerated ID which identifies the text label.

Definition at line 76 of file WidgetTools.cc.

77 {
78 wxControl* box = sizer->GetStaticBox();
79 wxString label = WxConversion::toWxString(text);
80 box->SetLabel(label);
81}
static wxString toWxString(const std::string &source)

References WxConversion::toWxString().

Here is the call graph for this function:

◆ setWidgetLabel() [2/2]

void WidgetTools::setWidgetLabel ( wxWindow *  widget,
std::string  text 
)
static

Sets a wxControl label text.

Parameters
widgetWidget to set the label to.
textIdEnumerated ID which identifies the text label.
Exceptions
WrongSubclassIf the widget was not a wxControl.

Definition at line 52 of file WidgetTools.cc.

52 {
53 // wxControls
54 if (widget->IsKindOf(CLASSINFO(wxControl))) {
55 wxControl* control = dynamic_cast<wxControl*>(widget);
56 assert(widget != NULL);
57 wxString label = WxConversion::toWxString(text);
58 control->SetLabel(label);
59 return;
60 }
61
62
63 string method = "GUITextGenerator::setWidgetLabel()";
64 string message = "Widget is not a wxControl, ";
65 message += "unable to set the widget label.";
66 throw WrongSubclass(__FILE__, __LINE__, method, message);
67}
#define assert(condition)

References assert, and WxConversion::toWxString().

Referenced by setLabel(), GCUDialog::setLabels(), InputOperandDialog::setTexts(), OperationPropertyDialog::setTexts(), SimulateDialog::setTexts(), AddressSpaceDialog::setTexts(), BusDialog::setTexts(), FUDialog::setTexts(), IUDialog::setTexts(), OperationDialog::setTexts(), OTAFormatListDialog::setTexts(), RFDialog::setTexts(), SocketDialog::setTexts(), and TemplateListDialog::setTexts().

Here is the call graph for this function:

The documentation for this class was generated from the following files: