Files
oboe/osx/dialogxml/field.cpp
Celtic Minstrel 7cd4a618b4 - Got rid of the prefix header in favour of directly including it in every file that needs it (though some files still need the include yet apparently work fine; perhaps a clean build would catch that)
- Replaced all occurrences of FillCRect with the new tileImage, to get away from 'ppat' resources.
- Fixed a minor error in the character editor where part of a text string was off the window.
- With the prefix header gone, libticpp.dylib has been removed; TinyXML++ is now compiled right into the program.
- The scenario editor splash screen is now loaded from a file.
- The pc editor title has its transparency problem fixed.
- Added an overload of tileImage that takes a RgnHandle instead of a Rect in order to replace the single occurrence of FillCRgn.
- Removed an unused function in boe.graphics.cpp
- Changed loading of patterns. Instead of loading each pattern individually from a resource, a single file containing all of them is loading. The arrays that formerly contained the actual patterns now contain the source rects of the patterns.
- Fixed the cursor hotspots (the coordinates were reversed)
- Removed the useless flip_pict that was written when I didn't know what I was doing.
- Fixed error in tileImage in which vrep and hrep were switched.
- Added code to tileImage to ensure that the pattern will line up with anything already onscreen, regardless of the rect to fill.
- Two images were altered: pcedtitle.png to fix the transparenct problem, and pixpats.png to add one pattern that had been missed (and also rearrange the smaller patterns a little)

git-svn-id: http://openexile.googlecode.com/svn/trunk@91 4ebdad44-0ea0-11de-aab3-ff745001d230
2009-06-10 04:01:15 +00:00

76 lines
1.8 KiB
C++

/*
* field.cpp
* BoE
*
* Created by Celtic Minstrel on 11/05/09.
*
*/
#include <Carbon/Carbon.h>
#include <sstream>
#include "dialog.h"
void cTextField::attachClickHandler(click_callback_t f __attribute__((unused))) throw(xHandlerNotSupported){
throw xHandlerNotSupported(false);
}
void cTextField::attachFocusHandler(focus_callback_t f __attribute__((unused))) throw(){
onFocus = f;
}
bool cTextField::triggerFocusHandler(cDialog& me, std::string id, bool losingFocus){
// TODO: If isNumericField, verify that the contents are in fact a number.
if(onFocus != NULL) onFocus(me,id,losingFocus);
return true;
}
void cTextField::setFormat(eFormat prop, short val __attribute__((unused))) throw(xUnsupportedProp){
throw xUnsupportedProp(prop);
}
short cTextField::getFormat(eFormat prop) throw(xUnsupportedProp){
throw xUnsupportedProp(prop);
}
void cTextField::setText(std::string what){
char message[1024];
strcpy(message,what.c_str());
c2pstr(message);
OSErr err = SetControlData(theField,kControlEditTextPart,kControlEditTextTextTag,what.size() + 1,message);
if(isVisible()) draw();
}
std::string cTextField::getText(){
unsigned char message[1024];
OSErr err = GetControlData(theField,kControlEditTextPart,kControlEditTextTextTag,1024,message,NULL);
p2cstr(message);
return std::string((char*)message);
}
bool cTextField::isClickable(){
return false;
}
cTextField::cTextField(cDialog* parent) : cControl(parent,CTRL_FIELD) {
OSStatus err;
err = CreateEditTextControl(parent->win,&frame,NULL,false,true/*useInlineInput*/,NULL,&theField);
}
cTextField::~cTextField(){
DisposeControl(theField);
}
void cTextField::show(){
ShowControl(theField);
cControl::show();
}
void cTextField::hide(){
HideControl(theField);
cControl::hide();
}
void cTextField::draw(){
Draw1Control(theField);
}