int main(void) { GWindow window = newGWindow(320, 240); GButton button = newGButton("button"); setActionCommand( button, "check" ); addToRegion(window, button, "SOUTH"); while( true ) { GActionEvent event = waitForEvent( ACTION_EVENT ); if( getEventType(event) == WINDOW_CLOSED ) { break; } else if( strcmp( getActionCommand(event) , "click") == 0 ) { printf("button was clicked\n"); } } closeGWindow(window); return 0; }
int main(void) { // instantiate window GWindow window = newGWindow(320, 240); // instantiate button GButton button = newGButton("Button"); setActionCommand(button, "click"); // add button to southern region of window addToRegion(window, button, "SOUTH"); // listen for events while (true) { // wait for event GActionEvent event = waitForEvent(ACTION_EVENT); // if window was closed if (getEventType(event) == WINDOW_CLOSED) { break; } // if action command is "click" if (strcmp(getActionCommand(event), "click") == 0) { printf("button was clicked\n"); } } // that's all folks closeGWindow(window); return 0; }
int main(void) { // instantiate window GWindow window = newGWindow(320, 240); // instantiate slider addToRegion(window, newGLabel("0"), "SOUTH"); GSlider slider = newGSlider(0, 100, 50); setActionCommand(slider, "slide"); addToRegion(window, slider, "SOUTH"); addToRegion(window, newGLabel("100"), "SOUTH"); // listen for events while (true) { // wait for event GActionEvent event = waitForEvent(ACTION_EVENT); // if window was closed if (getEventType(event) == WINDOW_CLOSED) { break; } // if action command is "slide" if (strcmp(getActionCommand(event), "slide") == 0) { printf("slider was slid to %i\n", getValue(slider)); } } // that's all folks closeGWindow(window); return 0; }
GButton newGButton(string label) { GButton button = newGObject(GBUTTON); button->u.interactorRep.label = label; createGButtonOp(button, label); setActionCommand(button, label); return button; }
int main(void) { // instantiate window GWindow window = newGWindow(320, 240); GCheckBox checkBox = newGCheckBox("I agree"); setActionCommand(checkBox, "check"); addToRegion(window, checkBox, "SOUTH"); while (true) { GActionEvent event = waitForEvent(ACTION_EVENT); if (getEventType(event) == WINDOW_CLOSED) { break; } if (strcmp(getActionCommand(event), "check") == 0) { if (isSelected(checkBox)) { printf("Checkbox was checked\n"); } else { printf("Checkbox was unchecked\n"); } } } closeGWindow(window); return 0; }
CExposureComp::CExposureComp() { // set up action command setActionCommand("set_ExposureCompensation"); // Map of value and display name _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x18,"+3")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x15,"+2 2/3")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x14,"+2 1/2")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x13,"+2 1/3")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x10,"+2")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x0d,"+1 2/3")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x0c,"+1 1/2")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x0b,"+1 1/3")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x08,"+1")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x05,"+2/3")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x04,"+1/2")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x03,"+1/3")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x00,"0")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0xfd,"-1/3")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0xfc,"-1/2")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0xfb,"-2/3")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0xf8,"-1")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0xf5,"-1 1/3")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0xf4,"-1 1/2")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0xf3,"-1 2/3")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0xf0,"-2")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0xed,"-2 1/3")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0xec,"-2 1/2")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0xeb,"-2 2/3")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0xe8,"-3")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0xffffffff,"unknown")); }
CEvfAFMode::CEvfAFMode() { // set up action command setActionCommand("set_EvfAFMode"); // Map of value and display name _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x00,"Quick mode")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x01,"Live mode")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x02,"Live face detection mode")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0xffffffff,"unknown")); }
CMeteringMode::CMeteringMode() { // set up action command setActionCommand("set_MeteringMode"); // Map of value and display name _propertyTable.insert( std::pair<EdsUInt32, const char *>(1,"Spot")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(3,"Evaluative")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(4,"Partial")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(5,"Center-Weighted Average")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0xffffffff,"unknown")); }
o/** * slider.c * * David J. Malan * [email protected] * * Demonstrates a slider. */ // standard libraries #include <stdio.h> #include <string.h> // Stanford Portable Library #include <spl/gevents.h> #include <spl/ginteractors.h> #include <spl/gwindow.h> int main(void) { // instantiate window GWindow window = newGWindow(320, 240); // instantiate slider addToRegion(window, newGLabel("0"), "SOUTH"); GSlider slider = newGSlider(0, 100, 50); setActionCommand(slider, "slide"); addToRegion(window, slider, "SOUTH"); addToRegion(window, newGLabel("100"), "SOUTH"); // listen for events while (true) { // wait for event GActionEvent event = waitForEvent(ACTION_EVENT); // if window was closed if (getEventType(event) == WINDOW_CLOSED) { break; } // if action command is "slide" if (strcmp(getActionCommand(event), "slide") == 0) { printf("slider was slid to %i\n", getValue(slider)); } } // that's all folks closeGWindow(window); return 0; }
CAv::CAv() { // set up action command setActionCommand("set_Av"); // Map of value and display name _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x00,"00")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x08,"1")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x0B,"1.1")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x0C,"1.2")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x0D,"1.2")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x10,"1.4")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x13,"1.6")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x14,"1.8")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x15,"1.8")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x18,"2")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x1B,"2.2")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x1C,"2.5")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x1D,"2.5")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x20,"2.8")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x23,"3.2")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x24,"3.5")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x25,"3.5")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x28,"4")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x2B,"4.5")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x2C,"4.5")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x2D,"5.0")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x30,"5.6")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x33,"6.3")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x34,"6.7")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x35,"7.1")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x38,"8")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x3B,"9")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x3C,"9.5")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x3D,"10")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x40,"11")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x43,"13")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x44,"13")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x45,"14")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x48,"16")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x4B,"18")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x4C,"19")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x4D,"20")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x50,"22")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x53,"25")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x54,"27")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x55,"29")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x58,"32")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x5B,"36")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x5C,"38")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x5D,"40")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x60,"45")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x63,"51")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x64,"54")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x65,"57")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x68,"64")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x6B,"72")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x6C,"76")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x6D,"80")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x70,"91")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0xffffffff,"unknown")); }
CImageQuality::CImageQuality() { // set up action command setActionCommand("set_ImageQuality"); // PTP Camera _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x00640f0f, "RAW")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x00640013, "RAW + Large Fine Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x00640113, "RAW + Middle Fine Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x00640213, "RAW + Small Fine Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x00640012, "RAW + Large Normal Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x00640112, "RAW + Middle Normal Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x00640212, "RAW + Small Normal Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x00640010, "RAW + Large Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x00640510, "RAW + Middle1 Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x00640610, "RAW + Middle2 Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x00640210, "RAW + Small Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x01640f0f, "Middle Raw(Small RAW1)")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x01640013, "Middle Raw(Small RAW1) + Large Fine Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x01640113, "Middle Raw(Small RAW1) + Middle Fine Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x01640213, "Middle Raw(Small RAW1) + Small Fine Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x01640012, "Middle Raw(Small RAW1) + Large Normal Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x01640112, "Middle Raw(Small RAW1) + Middle Normal Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x01640212, "Middle Raw(Small RAW1) + Small Normal Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x01640010, "Middle Raw + Large Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x01640510, "Middle Raw + Middle1 Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x01640610, "Middle Raw + Middle2 Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x01640210, "Middle Raw + Small Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x02640f0f, "Small RAW(Small RAW2)")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x02640013, "Small RAW(Small RAW2) + Large Fine Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x02640113, "Small RAW(Small RAW2) + Middle Fine Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x02640213, "Small RAW(Small RAW2) + Small Fine Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x02640012, "Small RAW(Small RAW2) + Large Normal Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x02640112, "Small RAW(Small RAW2) + Middle Normal Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x02640212, "Small RAW(Small RAW2) + Small Normal Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x02640010, "Small RAW + Large Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x02640510, "Small RAW + Middle1 Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x02640610, "Small RAW + Middle2 Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x02640210, "Small RAW + Small Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x00130f0f, "Large Fine Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x00120f0f, "Large Normal Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x01130f0f, "Middle Fine Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x01120f0f, "Middle Normal Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x02130f0f, "Small Fine Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x02120f0f, "Small Normal Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x00100f0f, "Large Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x05100f0f, "Middle1 Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x06100f0f, "Middle2 Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x02100f0f, "Small Jpeg")); // Legacy Camera _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x00240000, "RAW")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x00240013, "RAW + Large Fine Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x00240113, "RAW + Middle Fine Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x00240213, "RAW + Small Fine Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x00240012, "RAW + Large Normal Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x00240112, "RAW + Middle Normal Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x00240212, "RAW + Small Normal Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x00130000, "Large Fine Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x01130000, "Middle Fine Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x02130000, "Small Fine Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x00120000, "Large Normal Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x01120000, "Middle Normal Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x02120000, "Small Normal Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x002f000f, "RAW")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x002f001f, "RAW + Large Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x002f051f, "RAW + Middle1 Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x002f061f, "RAW + Middle2 Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x002f021f, "RAW + Small Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x001f000f, "Large Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x051f000f, "Middle1 Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x061f000f, "Middle2 Jpeg")); _propertyTable.insert( std::pair<EdsUInt32, const char *>(0x021f000f, "Small Jpeg")); }