XenevaOS
Loading...
Searching...
No Matches
Classes | Macros | Typedefs | Functions
calculator.h File Reference
#include <stdint.h>
#include <chitralekha.h>
#include <widgets/base.h>
#include <widgets/window.h>
Include dependency graph for calculator.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _display_widget_
 

Macros

#define CALC_OPERATOR_DIVIDE   1
 
#define CALC_OPERATOR_MULT   2
 
#define CALC_OPERATOR_ADD   3
 
#define CALC_OPERATOR_SUB   4
 
#define CALC_OPERATOR_MOD   5
 

Typedefs

typedef struct _display_widget_ CalculatorDisplay
 

Functions

CalculatorDisplay * CalculatorGetMainDisplay ()
 
void CalcUpdateDisplay (CalculatorDisplay *disp)
 
void CalcAddDigit (CalculatorDisplay *disp, int number)
 
void CalcRemoveDigit (CalculatorDisplay *disp)
 
void CalcAllClear (CalculatorDisplay *disp)
 
void CalculatorProcess (CalculatorDisplay *calc)
 
void CalcAddToHistory (CalculatorDisplay *disp, char *num, uint8_t operator_)
 
void CalcClearHistory (CalculatorDisplay *disp)
 
void CalcClearOutput (CalculatorDisplay *disp)
 
void SevenAction (ChWidget *wid, ChWindow *win)
 
void SixAction (ChWidget *wid, ChWindow *win)
 
void FiveAction (ChWidget *wid, ChWindow *win)
 
void FourAction (ChWidget *wid, ChWindow *win)
 
void ThreeAction (ChWidget *wid, ChWindow *win)
 
void TwoAction (ChWidget *wid, ChWindow *win)
 
void OneAction (ChWidget *wid, ChWindow *win)
 
void EightAction (ChWidget *wid, ChWindow *win)
 
void NineAction (ChWidget *wid, ChWindow *win)
 
void ZeroAction (ChWidget *wid, ChWindow *win)
 
void BackAction (ChWidget *wid, ChWindow *win)
 
void AllClearAction (ChWidget *wid, ChWindow *win)
 
void AddAction (ChWidget *wid, ChWindow *win)
 
void DivideAction (ChWidget *wid, ChWindow *win)
 
void MultAction (ChWidget *wid, ChWindow *win)
 
void SubAction (ChWidget *wid, ChWindow *win)
 
void ModAction (ChWidget *wid, ChWindow *win)
 
void EqualAction (ChWidget *wid, ChWindow *win)
 
void HandleKeyEvents (int keycode)
 

Macro Definition Documentation

◆ CALC_OPERATOR_ADD

#define CALC_OPERATOR_ADD   3

◆ CALC_OPERATOR_DIVIDE

#define CALC_OPERATOR_DIVIDE   1

BSD 2-Clause License

Copyright (c) 2022, Manas Kamal Choudhury All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

◆ CALC_OPERATOR_MOD

#define CALC_OPERATOR_MOD   5

◆ CALC_OPERATOR_MULT

#define CALC_OPERATOR_MULT   2

◆ CALC_OPERATOR_SUB

#define CALC_OPERATOR_SUB   4

Typedef Documentation

◆ CalculatorDisplay

Function Documentation

◆ AddAction()

void AddAction ( ChWidget *  wid,
ChWindow *  win 
)

◆ AllClearAction()

void AllClearAction ( ChWidget *  wid,
ChWindow *  win 
)

◆ BackAction()

void BackAction ( ChWidget *  wid,
ChWindow *  win 
)

◆ CalcAddDigit()

void CalcAddDigit ( CalculatorDisplay *  disp,
int  number 
)
extern

◆ CalcAddToHistory()

void CalcAddToHistory ( CalculatorDisplay *  disp,
char *  num,
uint8_t  operator_ 
)
extern

◆ CalcAllClear()

void CalcAllClear ( CalculatorDisplay *  disp)
extern

◆ CalcClearHistory()

void CalcClearHistory ( CalculatorDisplay *  disp)
extern

◆ CalcClearOutput()

void CalcClearOutput ( CalculatorDisplay *  disp)
extern

◆ CalcRemoveDigit()

void CalcRemoveDigit ( CalculatorDisplay *  disp)
extern

◆ CalculatorGetMainDisplay()

CalculatorDisplay * CalculatorGetMainDisplay ( )
extern

◆ CalculatorProcess()

void CalculatorProcess ( CalculatorDisplay *  calc)
extern

◆ CalcUpdateDisplay()

void CalcUpdateDisplay ( CalculatorDisplay *  disp)
extern

◆ DivideAction()

void DivideAction ( ChWidget *  wid,
ChWindow *  win 
)

◆ EightAction()

void EightAction ( ChWidget *  wid,
ChWindow *  win 
)

◆ EqualAction()

void EqualAction ( ChWidget *  wid,
ChWindow *  win 
)

◆ FiveAction()

void FiveAction ( ChWidget *  wid,
ChWindow *  win 
)

◆ FourAction()

void FourAction ( ChWidget *  wid,
ChWindow *  win 
)

◆ HandleKeyEvents()

void HandleKeyEvents ( int  keycode)

◆ ModAction()

void ModAction ( ChWidget *  wid,
ChWindow *  win 
)

◆ MultAction()

void MultAction ( ChWidget *  wid,
ChWindow *  win 
)

◆ NineAction()

void NineAction ( ChWidget *  wid,
ChWindow *  win 
)

◆ OneAction()

void OneAction ( ChWidget *  wid,
ChWindow *  win 
)

◆ SevenAction()

void SevenAction ( ChWidget *  wid,
ChWindow *  win 
)

BSD 2-Clause License

Copyright (c) 2022, Manas Kamal Choudhury All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

◆ SixAction()

void SixAction ( ChWidget *  wid,
ChWindow *  win 
)

◆ SubAction()

void SubAction ( ChWidget *  wid,
ChWindow *  win 
)

◆ ThreeAction()

void ThreeAction ( ChWidget *  wid,
ChWindow *  win 
)

◆ TwoAction()

void TwoAction ( ChWidget *  wid,
ChWindow *  win 
)

◆ ZeroAction()

void ZeroAction ( ChWidget *  wid,
ChWindow *  win 
)